Skip to navigation

API · Context · Create a context document

View as Markdown

Create a new context document and link it to the brand kit.

Two creation modes:

  1. Link existing: Provide document_id to link an existing KnowledgeDoc.
  2. Inline creation: Provide doc_type and name (plus optional description, data, content) to create a new KnowledgeDoc and link it automatically.

Singleton constraint: For predefined types (brand_voice, icps, usps, etc.), only one document per type per brandkit is allowed. Attempting to create a duplicate will return a 400 error.

The canonical_key is auto-set from doc_type if it matches a predefined type.

Authentication

AuthorizationApi-Key

Header authentication of the form Api-Key <token>

OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

brand_idstringRequiredformat: "uuid"
Brand kit UUID

Request

This endpoint expects an object.
document_idstringOptionalformat: "uuid"

Link an existing KnowledgeDoc by ID (mutually exclusive with inline fields)

doc_typestringOptional

Document type key for inline creation (e.g. brand_voice, style_guide)

namestringOptional<=200 characters
Document name for inline creation
descriptionstringOptional

Document description (optional, defaults to empty)

datamap from strings to anyOptional

Structured JSON data (optional, defaults to empty object)

contentstringOptional

Markdown content (optional, defaults to empty)

Response

Context document created

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error