---
title: "Set a context document's links"
method: PUT
path: "/api/v1/context/{slug}/links"
tags: ["Context"]
---

# Set a context document's links

`PUT /api/v1/context/{slug}/links`

## Request

- Base URL: `https://app.khotan.com`
- URL: `https://app.khotan.com/api/v1/context/{slug}/links`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Replaces the document's complete link set with the given projects and resources. Links not listed are removed. Every new target must be live in the organization, or nothing changes. A link whose target was deleted since is kept unless you leave it out. A document can have at most 200 links. Unknown or deleted slugs respond 404.

## Path parameters

- `slug` string, required

## Request body

- object
  - `links` object[], required: The document's complete link set. Links not listed are removed.
    - `type` 'project' | 'deployment' | 'pipeline' | 'postgres' | 'redis' | 'turso' | 'r2', required
    - `id` string, required

## Response `200`

The document's links after the change.

- object
  - `links` object[], required
    - `type` 'project' | 'deployment' | 'pipeline' | 'postgres' | 'redis' | 'turso' | 'r2', required: The kind of project or resource the document links to.
    - `id` string, required: The linked project or resource id.
    - `name` string, required: The target's current name, or "Deleted" when it no longer exists.
    - `removed` boolean, required: True when the target was deleted. Replace or remove the link.

## Other responses

- `400`: The request was malformed or failed validation.
- `401`: Authentication is missing or invalid.
- `404`: The resource was not found.
- `429`: Too many requests; retry after the indicated delay.

---

[API](https://skmtc.dev/khotan/apis/khotan-api.md) - [All operations](https://skmtc.dev/khotan/apis/khotan-api/llms.txt) - [OpenAPI document](https://skmtc.dev/khotan/apis/khotan-api/revisions/90b512a53e42?raw)
