Context

Update a context document

Updates the document's title, kind, content, description, tags, properties, and/or folder when expectedRevision matches the current revision. Properties replace the whole object; omit them to keep the current ones. Links are set separately. On mismatch, responds 409 revision_conflict with the current revision and updatedAt. The slug is immutable; title changes never re-slug. Limit violations respond 422 with the limit name, maximum, and submitted value.

patch/api/v1/context/{slug}

Request

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

Path parameters

slugstring required

Request body

expectedRevisioninteger required

Required compare-and-swap token; a stale value returns 409 with the current revision and updatedAt.

titlestring
kind'instructions' | 'knowledge' | 'record'

"instructions" = procedures to follow (SOPs, runbooks); "knowledge" = reference material (specs, policies); "record" = accounts of events (meeting notes, transcripts, interviews).

contentstring

Canonical raw markdown (max 256 KB, enforced by the domain layer).

descriptionstring nullable

Pass null to clear the description.

tagsstring[]

Flat tag list; express hierarchy with naming conventions like "ops/runbook/deploy".

propertiesobject

Structured facts beside the markdown: any JSON object.

folderIdstring nullable

Move the document; null moves it to the organization root.

changeSummarystring nullable

Optional note recorded on the revision history entry.

Response

The updated document record.

slugstring required
titlestring required
descriptionstring nullable required

One-line purpose statement for selection without fetching.

kind'instructions' | 'knowledge' | 'record' required
tagsstring[] required
revisioninteger required
contentSizeinteger required

Raw markdown size in bytes.

folderIdstring nullable required

Folder placement; null at the organization root.

pathstring nullable required

Human-readable folder path; null at the organization root.

updatedAtstring required
staffOnlyboolean required

Visible only to the operator's team. The organization's own members and keys never see it.

contentstring required

The canonical raw markdown.

propertiesobject required

Structured facts beside the markdown: any JSON object.

createdAtstring required
createdByType'agent' | 'api' | 'user' required
updatedByType'agent' | 'api' | 'user' required

Changes

No recorded changes to this operation across all 1 revision of this API.