---
title: "Commit a spec revision"
method: POST
path: "/api/v1/projects/{projectId}/spec"
tags: ["Projects"]
---

# Commit a spec revision

`POST /api/v1/projects/{projectId}/spec`

## Request

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

Applies edits to one or more spec nodes as a single project spec revision. Each edit carries the document revision it was based on, and the request carries the project revision the author last saw; either being stale returns 409.

## Path parameters

- `projectId` string, required

## Request body

- object
  - `edits` object[], required
    - `nodeId` string, required
    - `title` string
    - `body` string
    - `expectedBodyRevision` integer, required: Document revision this edit was based on; a mismatch rejects that node's write rather than overwriting a concurrent edit.
  - `changeSummary` string, nullable
  - `expectedRevision` integer, required: Project spec revision the author last saw; a stale value returns 409 with the current revision.
  - `links` object[]
    - `direction` 'cause' | 'effect', required
    - `kind` 'customer_need' | 'linear_issue' | 'manual' | 'materialization_commit' | 'pull_request', required
    - `ref` string, required
    - `url` string, uri, nullable
    - `label` string, nullable

## Response `201`

The committed revision.

- object
  - `id` string, required
  - `revision` number, required
  - `changeSummary` string, nullable, required
  - `actorType` string, required
  - `actorId` string, required
  - `committedAt` string, required
  - `documentCount` number, required

## Other responses

- `401`: Authentication is missing or invalid.
- `403`: The caller is not permitted to perform this action.
- `404`: The resource was not found.
- `409`: Response.
- `422`: Response.
- `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)
