> For the complete documentation index, see [llms.txt](https://docs.syntho.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.syntho.ai/configure-a-data-generation-job/manage-foreign-keys/add-virtual-foreign-keys/export-foreign-keys-via-json.md).

# Export foreign keys via JSON

You can export a JSON file containing foreign keys to populate them across multiple workspaces sharing the same source data structure. To export a foreign key JSON file, follow these steps:

1. Navigate to the **Foreign Keys** tab.
2. Click the "**Download foreign keys**" button.

The downloaded JSON file will contain the foreign keys and their configurations.

Below is an example of a foreign key JSON file downloaded from the Syntho workspace:

```json
[
   {
      "apply":true,
      "fk_columns":[
         "PATIENT"
      ],
      "fk_schema":"covid_patient_sample_db_synthetic",
      "fk_table":"encounters",
      "pk_columns":[
         "Id"
      ],
      "pk_schema":"covid_patient_sample_db_synthetic",
      "pk_table":"patients"
   },
   {
      "apply":true,
      "fk_columns":[
         "PAYER"
      ],
      "fk_schema":"covid_patient_sample_db_synthetic",
      "fk_table":"encounters",
      "pk_columns":[
         "Id"
      ],
      "pk_schema":"covid_patient_sample_db_synthetic",
      "pk_table":"payers"
   },
```

In this example, the first foreign key column is "**PATIENT**," located in the "**encounters**" table under the schema "**covid\_patient\_sample\_db\_synthetic**." This foreign key is linked to the primary key "**Id**" in the "**patients**" table, which is under the same schema, "**covid\_patient\_sample\_db\_synthetic**."


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.syntho.ai/configure-a-data-generation-job/manage-foreign-keys/add-virtual-foreign-keys/export-foreign-keys-via-json.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
