> For the complete documentation index, see [llms.txt](https://docs.truedat.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.truedat.io/v8.12/api-integrations/data-catalog-data-lineage-and-grants-apis/relation-types.md).

# Relation Types

## List relation types

> Returns a list of all relation types available in the system.\
> \
> No pagination is applied.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/relation_types":{"get":{"description":"Returns a list of all relation types available in the system.\n\nNo pagination is applied.\n","operationId":"TdDdWeb.RelationTypeController.index","parameters":[],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelationTypeListResponse"}}},"description":"Relation type list"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List relation types","tags":["Relation Types"]}}},"components":{"schemas":{"RelationTypeListResponse":{"additionalProperties":false,"properties":{"data":{"description":"List of relation types","items":{"$ref":"#/components/schemas/RelationTypeResource"},"type":"array"}},"required":["data"],"title":"RelationTypeListResponse","type":"object"},"RelationTypeResource":{"additionalProperties":false,"properties":{"description":{"description":"Description","nullable":true,"type":"string"},"id":{"description":"Relation type ID","type":"integer"},"inserted_at":{"format":"date-time","nullable":true,"type":"string"},"name":{"description":"Unique name","type":"string"},"updated_at":{"format":"date-time","nullable":true,"type":"string"}},"required":["id","name"],"title":"RelationTypeResource","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Create relation type

> Creates a new relation type with the provided name and optional description.\
> \
> \*\*Only administrators\*\* can create relation types.\
> \
> \*\*Request body:\*\*\
> \- \`relation\_type\` (required) – Object containing:\
> &#x20; \- \`name\` (required, string) – Unique name for the relation type.\
> &#x20; \- \`description\` (optional, string) – Description of the relation type.\
> \
> If a relation type with the same \`name\` already exists, the endpoint returns \`422 Unprocessable Entity\`.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/relation_types":{"post":{"description":"Creates a new relation type with the provided name and optional description.\n\n**Only administrators** can create relation types.\n\n**Request body:**\n- `relation_type` (required) – Object containing:\n  - `name` (required, string) – Unique name for the relation type.\n  - `description` (optional, string) – Description of the relation type.\n\nIf a relation type with the same `name` already exists, the endpoint returns `422 Unprocessable Entity`.\n","operationId":"TdDdWeb.RelationTypeController.create","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelationTypeCreateRequest"}}},"description":"Relation type payload","required":false},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelationTypeResponse"}}},"description":"Relation type created"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdForbiddenResponse"}}},"description":"Forbidden"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnprocessableEntityChangesetResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create relation type","tags":["Relation Types"]}}},"components":{"schemas":{"RelationTypeCreateRequest":{"additionalProperties":false,"properties":{"relation_type":{"additionalProperties":false,"properties":{"description":{"description":"Description","nullable":true,"type":"string"},"name":{"description":"Unique name","type":"string"}},"required":["name"],"type":"object"}},"required":["relation_type"],"title":"RelationTypeCreateRequest","type":"object"},"RelationTypeResponse":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/RelationTypeResource"}},"required":["data"],"title":"RelationTypeResponse","type":"object"},"RelationTypeResource":{"additionalProperties":false,"properties":{"description":{"description":"Description","nullable":true,"type":"string"},"id":{"description":"Relation type ID","type":"integer"},"inserted_at":{"format":"date-time","nullable":true,"type":"string"},"name":{"description":"Unique name","type":"string"},"updated_at":{"format":"date-time","nullable":true,"type":"string"}},"required":["id","name"],"title":"RelationTypeResource","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdForbiddenResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdForbiddenResponse","type":"object"},"TdDdUnprocessableEntityChangesetResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"}},"required":["errors"],"title":"TdDdUnprocessableEntityChangesetResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Get relation type

> Retrieves a single relation type by its ID.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/relation_types/{id}":{"get":{"description":"Retrieves a single relation type by its ID.\n","operationId":"TdDdWeb.RelationTypeController.show","parameters":[{"description":"Relation type ID","in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelationTypeResponse"}}},"description":"Relation type details"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get relation type","tags":["Relation Types"]}}},"components":{"schemas":{"RelationTypeResponse":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/RelationTypeResource"}},"required":["data"],"title":"RelationTypeResponse","type":"object"},"RelationTypeResource":{"additionalProperties":false,"properties":{"description":{"description":"Description","nullable":true,"type":"string"},"id":{"description":"Relation type ID","type":"integer"},"inserted_at":{"format":"date-time","nullable":true,"type":"string"},"name":{"description":"Unique name","type":"string"},"updated_at":{"format":"date-time","nullable":true,"type":"string"}},"required":["id","name"],"title":"RelationTypeResource","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Update relation type

> Updates an existing relation type with the provided payload. Only the provided fields are updated; omitted fields retain their previous values.\
> \
> \*\*Only administrators\*\* can update relation types.\
> \
> \*\*Request body:\*\*\
> \- \`relation\_type\` (required) – Object containing fields to update:\
> &#x20; \- \`name\` (optional, string) – Updated name.\
> &#x20; \- \`description\` (optional, string) – Updated description.\
> \
> If the new \`name\` conflicts with an existing type, returns \`422 Unprocessable Entity\`.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/relation_types/{id}":{"put":{"description":"Updates an existing relation type with the provided payload. Only the provided fields are updated; omitted fields retain their previous values.\n\n**Only administrators** can update relation types.\n\n**Request body:**\n- `relation_type` (required) – Object containing fields to update:\n  - `name` (optional, string) – Updated name.\n  - `description` (optional, string) – Updated description.\n\nIf the new `name` conflicts with an existing type, returns `422 Unprocessable Entity`.\n","operationId":"TdDdWeb.RelationTypeController.update","parameters":[{"description":"Relation type ID","in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelationTypeCreateRequest"}}},"description":"Relation type payload","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelationTypeResponse"}}},"description":"Relation type updated"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdForbiddenResponse"}}},"description":"Forbidden"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnprocessableEntityChangesetResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Update relation type","tags":["Relation Types"]}}},"components":{"schemas":{"RelationTypeCreateRequest":{"additionalProperties":false,"properties":{"relation_type":{"additionalProperties":false,"properties":{"description":{"description":"Description","nullable":true,"type":"string"},"name":{"description":"Unique name","type":"string"}},"required":["name"],"type":"object"}},"required":["relation_type"],"title":"RelationTypeCreateRequest","type":"object"},"RelationTypeResponse":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/RelationTypeResource"}},"required":["data"],"title":"RelationTypeResponse","type":"object"},"RelationTypeResource":{"additionalProperties":false,"properties":{"description":{"description":"Description","nullable":true,"type":"string"},"id":{"description":"Relation type ID","type":"integer"},"inserted_at":{"format":"date-time","nullable":true,"type":"string"},"name":{"description":"Unique name","type":"string"},"updated_at":{"format":"date-time","nullable":true,"type":"string"}},"required":["id","name"],"title":"RelationTypeResource","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdForbiddenResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdForbiddenResponse","type":"object"},"TdDdUnprocessableEntityChangesetResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"}},"required":["errors"],"title":"TdDdUnprocessableEntityChangesetResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Delete relation type

> Permanently deletes a relation type by its ID.\
> \
> nly administrators can delete relation types.\
> \
> Deleting a relation type that is currently in use by data structure links may result in integrity errors. The endpoint returns \`422 Unprocessable Entity\` if the relation type cannot be deleted due to existing references.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/relation_types/{id}":{"delete":{"description":"Permanently deletes a relation type by its ID.\n\nnly administrators can delete relation types.\n\nDeleting a relation type that is currently in use by data structure links may result in integrity errors. The endpoint returns `422 Unprocessable Entity` if the relation type cannot be deleted due to existing references.\n","operationId":"TdDdWeb.RelationTypeController.delete","parameters":[{"description":"Relation type ID","in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"204":{"description":"Relation type deleted"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Delete relation type","tags":["Relation Types"]}}},"components":{"schemas":{"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```

## Update relation type

> Updates an existing relation type with the provided payload. Only the provided fields are updated; omitted fields retain their previous values.\
> \
> \*\*Only administrators\*\* can update relation types.\
> \
> \*\*Request body:\*\*\
> \- \`relation\_type\` (required) – Object containing fields to update:\
> &#x20; \- \`name\` (optional, string) – Updated name.\
> &#x20; \- \`description\` (optional, string) – Updated description.\
> \
> If the new \`name\` conflicts with an existing type, returns \`422 Unprocessable Entity\`.<br>

```json
{"openapi":"3.0.0","info":{"title":"td-dd","version":"Truedat 8.12.2"},"paths":{"/api/relation_types/{id}":{"patch":{"description":"Updates an existing relation type with the provided payload. Only the provided fields are updated; omitted fields retain their previous values.\n\n**Only administrators** can update relation types.\n\n**Request body:**\n- `relation_type` (required) – Object containing fields to update:\n  - `name` (optional, string) – Updated name.\n  - `description` (optional, string) – Updated description.\n\nIf the new `name` conflicts with an existing type, returns `422 Unprocessable Entity`.\n","operationId":"TdDdWeb.RelationTypeController.update (2)","parameters":[{"description":"Relation type ID","in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelationTypeCreateRequest"}}},"description":"Relation type payload","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelationTypeResponse"}}},"description":"Relation type updated"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdForbiddenResponse"}}},"description":"Forbidden"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdUnprocessableEntityChangesetResponse"}}},"description":"Unprocessable Entity"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdDdInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Update relation type","tags":["Relation Types"]}}},"components":{"schemas":{"RelationTypeCreateRequest":{"additionalProperties":false,"properties":{"relation_type":{"additionalProperties":false,"properties":{"description":{"description":"Description","nullable":true,"type":"string"},"name":{"description":"Unique name","type":"string"}},"required":["name"],"type":"object"}},"required":["relation_type"],"title":"RelationTypeCreateRequest","type":"object"},"RelationTypeResponse":{"additionalProperties":false,"properties":{"data":{"$ref":"#/components/schemas/RelationTypeResource"}},"required":["data"],"title":"RelationTypeResponse","type":"object"},"RelationTypeResource":{"additionalProperties":false,"properties":{"description":{"description":"Description","nullable":true,"type":"string"},"id":{"description":"Relation type ID","type":"integer"},"inserted_at":{"format":"date-time","nullable":true,"type":"string"},"name":{"description":"Unique name","type":"string"},"updated_at":{"format":"date-time","nullable":true,"type":"string"}},"required":["id","name"],"title":"RelationTypeResource","type":"object"},"TdDdUnauthorizedResponse":{"anyOf":[{"$ref":"#/components/schemas/TdDdUnauthorizedMessageResponse"},{"$ref":"#/components/schemas/TdDdUnauthorizedErrorResponse"}],"description":"Unauthorized response from auth plug or error view","title":"TdDdUnauthorizedResponse"},"TdDdUnauthorizedMessageResponse":{"additionalProperties":false,"properties":{"message":{"type":"string"}},"required":["message"],"title":"TdDdUnauthorizedMessageResponse","type":"object"},"TdDdUnauthorizedErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"required":["errors"],"title":"TdDdUnauthorizedErrorResponse","type":"object"},"TdDdForbiddenResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdForbiddenResponse","type":"object"},"TdDdUnprocessableEntityChangesetResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"}},"required":["errors"],"title":"TdDdUnprocessableEntityChangesetResponse","type":"object"},"TdDdInternalServerErrorResponse":{"additionalProperties":false,"properties":{"errors":{"additionalProperties":false,"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"}},"required":["errors"],"title":"TdDdInternalServerErrorResponse","type":"object"}}}}
```
