---
title: "Create document relation"
method: POST
path: "/api/v1/document_relations"
tags: ["Document Relation"]
---

# Create document relation

`POST /api/v1/document_relations`

Create a new document relation object.

## Request body

- DocumentRelationBase
  - `id` integer — ID of the document relation
  - `type` 'export' | 'einvoice' — Type of relationship. Possible values: - `export` - Related documents are exports of the annotation data (e.g. in XML or JSON formats). - `einvoice` - Related documents were created during import of an einvoice (e.g. validation report, visualisation, ...)
  - `key` string, nullable — Key used to distinguish several relationships of the same type. Note: The combination of `type`, `key` and `annotation` attribute values must be *unique*.
  - `annotation` string, uri — Annotation
  - `documents` string[] — List of related documents
  - `url` string, uri — URL of the relation

## Response `201`

Created

- DocumentRelation
  - `id` integer, required — ID of the document relation
  - `type` 'export' | 'einvoice', required — Type of relationship. Possible values: - `export` - Related documents are exports of the annotation data (e.g. in XML or JSON formats). - `einvoice` - Related documents were created during import of an einvoice (e.g. validation report, visualisation, ...)
  - `key` string, nullable, required — Key used to distinguish several relationships of the same type. Note: The combination of `type`, `key` and `annotation` attribute values must be *unique*.
  - `annotation` string, uri, required — Annotation
  - `documents` string[], required — List of related documents
  - `url` string, uri, required — URL of the relation

## Other responses

- `400` — Invalid input data.
- `401` — The username/password is invalid or token is invalid (e.g. expired).
- `403` — Insufficient permission, missing authentication, invalid CSRF token and similar issue.
- `404` — The specified resource was not found.
- `409` — Conflict
- `413` — Payload too large (especially for files uploaded).
- `429` — Request rate is too high, wait before sending more requests. See [Rate Limiting](/guides/overview#rate-limiting) for more details.
- `500` — Server failure while processing the request.
- `502` — Invalid response from the upstream server.
- `503` — We're temporarily offline for maintenance. Please try again later.
- `504` — Upstream server could not complete the request in time.

---

[API](https://skmtc.dev/rossum/apis/rossum-api.md) · [All operations](https://skmtc.dev/rossum/apis/rossum-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/rossum/rossum-api/revisions/f1b5a910991d/schema)
