> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
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=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
