---
title: "Create a link"
method: POST
path: "/contracts/{contract_id}/links"
tags: ["Contract - Links"]
---

# Create a link

`POST /contracts/{contract_id}/links`

Use this endpoint to create a link between contracts.

## Path parameters

- `contract_id` integer, required

## Headers

- `x-oneflow-api-token` string, required
- `x-oneflow-user-email` string, email

## Request body

- union
  - object — Create an internal contract link.
    - `linked_contract` integer, required
    - `type` 'amends' | 'amended_by' | 'sub_contract' | 'main_contract' | 'replaced_by' | 'replaces' | 'relates_to', required — One of the [link types](contract#links).
  - object — Create an external contract link.
    - `type` 'external', required — Can only be `external` of the [link types](contract#links).
    - `external_link` union, required — Can choose the link format as either `https` or `http`.
      - string, https_url
      - string, http_url
    - `external_title` string, required

## Response `200`

Returns the created contract link.

- union
  - object — Internal contract link.
    - `id` integer, required
    - `linked_contract` integer, required
    - `type` 'amends' | 'amended_by' | 'sub_contract' | 'main_contract' | 'replaced_by' | 'replaces' | 'relates_to', required — One of the [link types](contract#links).
  - object — External contract link.
    - `id` integer, required
    - `type` 'external', required — Can only be `external` of the [link types](contract#links).
    - `external_link` string, required
    - `external_title` string, required

## Other responses

- `400` — Invalid format or content of the request.
- `401` — The API token or the user email is invalid.
- `403` — The request is not authorized by the server.
- `404` — A required entity is missing.

---

[API](https://skmtc.net/oneflow/apis/public-api-for-oneflow.md) · [All operations](https://skmtc.net/oneflow/apis/public-api-for-oneflow/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/oneflow/public-api-for-oneflow/versions/0e73a45dec15/schema)
