> 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/syntho-api/syntho-rest-api/foreign-keys.md).

# Foreign Keys

## GET /api/v1/foreign\_keys/{database\_id}/

> List of foreign keys

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ListOfForeignKeys":{"properties":{"foreign_keys":{"items":{"$ref":"#/components/schemas/ForeignKeySchema"},"title":"Foreign Keys","type":"array"}},"required":["foreign_keys"],"title":"ListOfForeignKeys","type":"object"},"ForeignKeySchema":{"properties":{"id":{"format":"uuid","title":"Id","type":"string"},"table_id":{"format":"uuid","title":"Table Id","type":"string"},"references_table_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"References Table Id"},"name":{"title":"Name","type":"string"},"apply":{"title":"Apply","type":"boolean"},"is_virtual":{"title":"Is Virtual","type":"boolean"},"scan_result":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"Scan Result"},"fk_columns":{"items":{"type":"string"},"title":"Fk Columns","type":"array"},"fk_schema":{"title":"Fk Schema","type":"string"},"fk_table":{"title":"Fk Table","type":"string"},"pk_columns":{"items":{"type":"string"},"title":"Pk Columns","type":"array"},"pk_schema":{"title":"Pk Schema","type":"string"},"pk_table":{"title":"Pk Table","type":"string"},"sync_status":{"anyOf":[{"$ref":"#/components/schemas/SyncStatus"},{"type":"null"}],"default":null}},"required":["id","table_id","name","apply","is_virtual","fk_columns","fk_schema","fk_table","pk_columns","pk_schema","pk_table"],"title":"ForeignKeySchema","type":"object"},"SyncStatus":{"enum":["new","updated","deleted","identical"],"title":"SyncStatus","type":"string"},"HTTPValidationError":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Id"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Code"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Title"},"body":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"title":"Body"},"durability":{"anyOf":[{"$ref":"#/components/schemas/Durability"},{"type":"null"}],"default":"temporary"},"duration":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":5000,"title":"Duration"},"kind":{"anyOf":[{"$ref":"#/components/schemas/SystemMessageKind"},{"type":"null"}],"default":"info"},"details":{"anyOf":[{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},{"type":"null"}],"default":null,"title":"Details"},"payload":{"default":null,"title":"Payload"},"action":{"anyOf":[{"type":"object"},{"type":"null"}],"default":null,"title":"Action"},"display":{"anyOf":[{"$ref":"#/components/schemas/Display"},{"type":"null"}],"default":"notification"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Created At"}},"title":"HTTPValidationError","type":"object"},"Durability":{"enum":["transient","persistent","temporary"],"title":"Durability","type":"string"},"SystemMessageKind":{"enum":["success","error","warning","info"],"title":"SystemMessageKind","type":"string"},"Display":{"enum":["field","screen","notification"],"title":"Display","type":"string"}}},"paths":{"/api/v1/foreign_keys/{database_id}/":{"get":{"operationId":"foreign_keys_retrieve","description":"List of foreign keys","parameters":[{"in":"path","name":"database_id","schema":{"type":"string"},"required":true}],"tags":["Foreign Keys"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOfForeignKeys"}}},"description":"Success: List of foreign keys"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Message: unable to fetch engine from external service"}}}}}}
```

## POST /api/v1/foreign\_keys/{database\_id}/create/

> Create virtual foreign key

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ListOfCreateForeignKeys":{"properties":{"foreign_keys":{"items":{"$ref":"#/components/schemas/CreateForeignKeySchema"},"title":"Foreign Keys","type":"array"}},"required":["foreign_keys"],"title":"ListOfCreateForeignKeys","type":"object"},"CreateForeignKeySchema":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Name"},"table_id":{"format":"uuid","title":"Table Id","type":"string"},"references_table_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"References Table Id"},"apply":{"title":"Apply","type":"boolean"},"fk_columns":{"items":{"type":"string"},"title":"Fk Columns","type":"array"},"fk_schema":{"title":"Fk Schema","type":"string"},"fk_table":{"title":"Fk Table","type":"string"},"pk_columns":{"items":{"type":"string"},"title":"Pk Columns","type":"array"},"pk_schema":{"title":"Pk Schema","type":"string"},"pk_table":{"title":"Pk Table","type":"string"}},"required":["table_id","apply","fk_columns","fk_schema","fk_table","pk_columns","pk_schema","pk_table"],"title":"CreateForeignKeySchema","type":"object"},"ApplicationMessage":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Id"},"code":{"title":"Code","type":"string"},"title":{"title":"Title","type":"string"},"body":{"items":{"type":"string"},"title":"Body","type":"array"},"durability":{"anyOf":[{"$ref":"#/components/schemas/Durability"},{"type":"null"}],"default":"temporary"},"duration":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":5000,"title":"Duration"},"kind":{"anyOf":[{"$ref":"#/components/schemas/SystemMessageKind"},{"type":"null"}],"default":"info"},"details":{"anyOf":[{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},{"type":"null"}],"default":null,"title":"Details"},"payload":{"default":null,"title":"Payload"},"action":{"anyOf":[{"type":"object"},{"type":"null"}],"default":null,"title":"Action"},"display":{"anyOf":[{"$ref":"#/components/schemas/Display"},{"type":"null"}],"default":"notification"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Created At"}},"required":["code","title","body"],"title":"ApplicationMessage","type":"object"},"Durability":{"enum":["transient","persistent","temporary"],"title":"Durability","type":"string"},"SystemMessageKind":{"enum":["success","error","warning","info"],"title":"SystemMessageKind","type":"string"},"Display":{"enum":["field","screen","notification"],"title":"Display","type":"string"}}},"paths":{"/api/v1/foreign_keys/{database_id}/create/":{"post":{"operationId":"foreign_keys_create_create","description":"Create virtual foreign key","parameters":[{"in":"path","name":"database_id","schema":{"type":"string"},"required":true}],"tags":["Foreign Keys","Table","Generators"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOfCreateForeignKeys"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationMessage"}}},"description":"Success: Created foreign keys"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationMessage"}}},"description":"Import error"}}}}}}
```

## GET /api/v1/foreign\_keys/{database\_id}/export/

> Export list of foreign keys

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ListOfExportedForeignKeys":{"properties":{"foreign_keys":{"items":{"$ref":"#/components/schemas/ImportExportForeignKeySchema"},"title":"Foreign Keys","type":"array"}},"required":["foreign_keys"],"title":"ListOfExportedForeignKeys","type":"object"},"ImportExportForeignKeySchema":{"properties":{"apply":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":true,"title":"Apply"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Name"},"fk_columns":{"items":{"type":"string"},"title":"Fk Columns","type":"array"},"fk_schema":{"title":"Fk Schema","type":"string"},"fk_table":{"title":"Fk Table","type":"string"},"pk_columns":{"items":{"type":"string"},"title":"Pk Columns","type":"array"},"pk_schema":{"title":"Pk Schema","type":"string"},"pk_table":{"title":"Pk Table","type":"string"}},"required":["fk_columns","fk_schema","fk_table","pk_columns","pk_schema","pk_table"],"title":"ImportExportForeignKeySchema","type":"object"}}},"paths":{"/api/v1/foreign_keys/{database_id}/export/":{"get":{"operationId":"foreign_keys_export_retrieve","description":"Export list of foreign keys","parameters":[{"in":"path","name":"database_id","schema":{"type":"string"},"required":true}],"tags":["Foreign Keys"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOfExportedForeignKeys"}}},"description":"Success: Exported list of foreign keys"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```

## POST /api/v1/foreign\_keys/{database\_id}/filter/

> Filter foreign keys

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ForeignKeyFilterParams":{"properties":{"is_virtual":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Virtual"},"is_applied":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Applied"},"fk_columns":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Fk Columns"},"pk_columns":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Pk Columns"},"table_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Table Ids"}},"required":["is_virtual","is_applied","fk_columns","pk_columns","table_ids"],"title":"ForeignKeyFilterParams","type":"object"},"PaginatedListOfForeignKeys":{"properties":{"foreign_keys":{"items":{"$ref":"#/components/schemas/ForeignKeySchema"},"title":"Foreign Keys","type":"array"},"pagination":{"anyOf":[{"$ref":"#/components/schemas/PaginatedContentSchema"},{"type":"null"}],"default":null}},"required":["foreign_keys"],"title":"PaginatedListOfForeignKeys","type":"object"},"ForeignKeySchema":{"properties":{"id":{"format":"uuid","title":"Id","type":"string"},"table_id":{"format":"uuid","title":"Table Id","type":"string"},"references_table_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"References Table Id"},"name":{"title":"Name","type":"string"},"apply":{"title":"Apply","type":"boolean"},"is_virtual":{"title":"Is Virtual","type":"boolean"},"scan_result":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"Scan Result"},"fk_columns":{"items":{"type":"string"},"title":"Fk Columns","type":"array"},"fk_schema":{"title":"Fk Schema","type":"string"},"fk_table":{"title":"Fk Table","type":"string"},"pk_columns":{"items":{"type":"string"},"title":"Pk Columns","type":"array"},"pk_schema":{"title":"Pk Schema","type":"string"},"pk_table":{"title":"Pk Table","type":"string"},"sync_status":{"anyOf":[{"$ref":"#/components/schemas/SyncStatus"},{"type":"null"}],"default":null}},"required":["id","table_id","name","apply","is_virtual","fk_columns","fk_schema","fk_table","pk_columns","pk_schema","pk_table"],"title":"ForeignKeySchema","type":"object"},"SyncStatus":{"enum":["new","updated","deleted","identical"],"title":"SyncStatus","type":"string"},"PaginatedContentSchema":{"properties":{"total_elements":{"title":"Total Elements","type":"integer"},"total_pages":{"title":"Total Pages","type":"integer"},"current_page":{"title":"Current Page","type":"integer"},"returned_elements":{"title":"Returned Elements","type":"integer"},"is_last_page":{"title":"Is Last Page","type":"boolean"}},"required":["total_elements","total_pages","current_page","returned_elements","is_last_page"],"title":"PaginatedContentSchema","type":"object"}}},"paths":{"/api/v1/foreign_keys/{database_id}/filter/":{"post":{"operationId":"foreign_keys_filter_create","description":"Filter foreign keys","parameters":[{"in":"path","name":"database_id","schema":{"type":"string"},"required":true},{"in":"query","name":"elements_per_page","schema":{"type":"integer"}},{"in":"query","name":"keyword","schema":{"type":"string"}},{"in":"query","name":"requested_page","schema":{"type":"integer"}}],"tags":["Foreign Keys"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForeignKeyFilterParams"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedListOfForeignKeys"}}},"description":"Success: Paginated filtered list of foreign keys"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```

## POST /api/v1/foreign\_keys/{database\_id}/import/

> Import list of foreign keys

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ListOfImportExportForeignKeys":{"properties":{"foreign_keys":{"items":{"$ref":"#/components/schemas/ImportExportForeignKeySchema"},"maxItems":50,"title":"Foreign Keys","type":"array"}},"required":["foreign_keys"],"title":"ListOfImportExportForeignKeys","type":"object"},"ImportExportForeignKeySchema":{"properties":{"apply":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":true,"title":"Apply"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Name"},"fk_columns":{"items":{"type":"string"},"title":"Fk Columns","type":"array"},"fk_schema":{"title":"Fk Schema","type":"string"},"fk_table":{"title":"Fk Table","type":"string"},"pk_columns":{"items":{"type":"string"},"title":"Pk Columns","type":"array"},"pk_schema":{"title":"Pk Schema","type":"string"},"pk_table":{"title":"Pk Table","type":"string"}},"required":["fk_columns","fk_schema","fk_table","pk_columns","pk_schema","pk_table"],"title":"ImportExportForeignKeySchema","type":"object"},"ApplicationMessage":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Id"},"code":{"title":"Code","type":"string"},"title":{"title":"Title","type":"string"},"body":{"items":{"type":"string"},"title":"Body","type":"array"},"durability":{"anyOf":[{"$ref":"#/components/schemas/Durability"},{"type":"null"}],"default":"temporary"},"duration":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":5000,"title":"Duration"},"kind":{"anyOf":[{"$ref":"#/components/schemas/SystemMessageKind"},{"type":"null"}],"default":"info"},"details":{"anyOf":[{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},{"type":"null"}],"default":null,"title":"Details"},"payload":{"default":null,"title":"Payload"},"action":{"anyOf":[{"type":"object"},{"type":"null"}],"default":null,"title":"Action"},"display":{"anyOf":[{"$ref":"#/components/schemas/Display"},{"type":"null"}],"default":"notification"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Created At"}},"required":["code","title","body"],"title":"ApplicationMessage","type":"object"},"Durability":{"enum":["transient","persistent","temporary"],"title":"Durability","type":"string"},"SystemMessageKind":{"enum":["success","error","warning","info"],"title":"SystemMessageKind","type":"string"},"Display":{"enum":["field","screen","notification"],"title":"Display","type":"string"}}},"paths":{"/api/v1/foreign_keys/{database_id}/import/":{"post":{"operationId":"foreign_keys_import_create","description":"Import list of foreign keys","parameters":[{"in":"path","name":"database_id","schema":{"type":"string"},"required":true}],"tags":["Foreign Keys","Table","Generators"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOfImportExportForeignKeys"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationMessage"}}},"description":"Success: list of foreign keys imported"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationMessage"}}},"description":"Import error"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```

## POST /api/v1/foreign\_keys/{database\_id}/scan/

> Scan for foreign keys

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}}},"paths":{"/api/v1/foreign_keys/{database_id}/scan/":{"post":{"operationId":"foreign_keys_scan_create","description":"Scan for foreign keys","parameters":[{"in":"query","name":"allow_pk_strings","schema":{"type":"boolean"}},{"in":"query","name":"bidirectional_data_check","schema":{"type":"boolean"}},{"in":"query","name":"column_name_check","schema":{"type":"boolean"}},{"in":"query","name":"data_batch_size","schema":{"type":"integer"}},{"in":"path","name":"database_id","schema":{"type":"string"},"required":true},{"in":"query","name":"exact_data_type_check","schema":{"type":"boolean"}},{"in":"query","name":"n_scanners","schema":{"type":"integer"}},{"in":"query","name":"pk_scan","schema":{"type":"boolean"}}],"tags":["Foreign Keys","Jobs"],"responses":{"204":{"description":"Success: Started the job"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```

## GET /api/v1/foreign\_keys/{database\_id}/stats/

> Get foreign keys stats

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ForeignKeysStats":{"properties":{"n_virtual":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"N Virtual"}},"title":"ForeignKeysStats","type":"object"}}},"paths":{"/api/v1/foreign_keys/{database_id}/stats/":{"get":{"operationId":"foreign_keys_stats_retrieve","description":"Get foreign keys stats","parameters":[{"in":"path","name":"database_id","schema":{"type":"string"},"required":true}],"tags":["Foreign Keys"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForeignKeysStats"}}},"description":"Success: foreign keys stats"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```

## DELETE /api/v1/foreign\_keys/{foreign\_key\_id}/delete/

> Delete foreign key

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ApplicationMessage":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Id"},"code":{"title":"Code","type":"string"},"title":{"title":"Title","type":"string"},"body":{"items":{"type":"string"},"title":"Body","type":"array"},"durability":{"anyOf":[{"$ref":"#/components/schemas/Durability"},{"type":"null"}],"default":"temporary"},"duration":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":5000,"title":"Duration"},"kind":{"anyOf":[{"$ref":"#/components/schemas/SystemMessageKind"},{"type":"null"}],"default":"info"},"details":{"anyOf":[{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},{"type":"null"}],"default":null,"title":"Details"},"payload":{"default":null,"title":"Payload"},"action":{"anyOf":[{"type":"object"},{"type":"null"}],"default":null,"title":"Action"},"display":{"anyOf":[{"$ref":"#/components/schemas/Display"},{"type":"null"}],"default":"notification"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Created At"}},"required":["code","title","body"],"title":"ApplicationMessage","type":"object"},"Durability":{"enum":["transient","persistent","temporary"],"title":"Durability","type":"string"},"SystemMessageKind":{"enum":["success","error","warning","info"],"title":"SystemMessageKind","type":"string"},"Display":{"enum":["field","screen","notification"],"title":"Display","type":"string"}}},"paths":{"/api/v1/foreign_keys/{foreign_key_id}/delete/":{"delete":{"operationId":"foreign_keys_delete_destroy","description":"Delete foreign key","parameters":[{"in":"path","name":"foreign_key_id","schema":{"type":"string"},"required":true}],"tags":["Foreign Keys","Table","Generators"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplicationMessage"}}},"description":""}}}}}}
```

## POST /api/v1/foreign\_keys/update\_batch/

> Resolve foreign\_keys

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ListOfUpdateForeignKeys":{"properties":{"foreign_keys":{"items":{"$ref":"#/components/schemas/UpdateForeignKeySchema"},"title":"Foreign Keys","type":"array"}},"required":["foreign_keys"],"title":"ListOfUpdateForeignKeys","type":"object"},"UpdateForeignKeySchema":{"properties":{"id":{"format":"uuid","title":"Id","type":"string"},"apply":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"title":"Apply"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Name"},"table_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"Table Id"},"references_table_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"References Table Id"},"fk_columns":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"title":"Fk Columns"},"fk_schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Fk Schema"},"fk_table":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Fk Table"},"pk_columns":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"title":"Pk Columns"},"pk_schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Pk Schema"},"pk_table":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Pk Table"}},"required":["id"],"title":"UpdateForeignKeySchema","type":"object"},"ListOfForeignKeys":{"properties":{"foreign_keys":{"items":{"$ref":"#/components/schemas/ForeignKeySchema"},"title":"Foreign Keys","type":"array"}},"required":["foreign_keys"],"title":"ListOfForeignKeys","type":"object"},"ForeignKeySchema":{"properties":{"id":{"format":"uuid","title":"Id","type":"string"},"table_id":{"format":"uuid","title":"Table Id","type":"string"},"references_table_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"References Table Id"},"name":{"title":"Name","type":"string"},"apply":{"title":"Apply","type":"boolean"},"is_virtual":{"title":"Is Virtual","type":"boolean"},"scan_result":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"title":"Scan Result"},"fk_columns":{"items":{"type":"string"},"title":"Fk Columns","type":"array"},"fk_schema":{"title":"Fk Schema","type":"string"},"fk_table":{"title":"Fk Table","type":"string"},"pk_columns":{"items":{"type":"string"},"title":"Pk Columns","type":"array"},"pk_schema":{"title":"Pk Schema","type":"string"},"pk_table":{"title":"Pk Table","type":"string"},"sync_status":{"anyOf":[{"$ref":"#/components/schemas/SyncStatus"},{"type":"null"}],"default":null}},"required":["id","table_id","name","apply","is_virtual","fk_columns","fk_schema","fk_table","pk_columns","pk_schema","pk_table"],"title":"ForeignKeySchema","type":"object"},"SyncStatus":{"enum":["new","updated","deleted","identical"],"title":"SyncStatus","type":"string"}}},"paths":{"/api/v1/foreign_keys/update_batch/":{"post":{"operationId":"foreign_keys_update_batch_create","description":"Resolve foreign_keys","tags":["Foreign Keys","Table","Generators"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOfUpdateForeignKeys"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOfForeignKeys"}}},"description":"Success: Resolved foreign keys"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```


---

# 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/syntho-api/syntho-rest-api/foreign-keys.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.
