---
title: "API · Context · Create a context document"
method: POST
path: "/api/v1/brandkit/{brand_id}/context-documents"
tags: ["brandContext"]
---

# API · Context · Create a context document

`POST /api/v1/brandkit/{brand_id}/context-documents`

## Request

- Base URL: `https://api.simplified.com`
- URL: `https://api.simplified.com/api/v1/brandkit/{brand_id}/context-documents`
- Auth: API key in header `Authorization`

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.

## Path parameters

- `brand_id` string, uuid, required

## Request body

- ContextDocumentCreateRequest: Create a context document link. Provide either `document_id` to link an existing KnowledgeDoc, or inline fields (`doc_type` + `name`) to create a new one. For predefined types, only one document per type per brandkit is allowed (singleton constraint).
  - `document_id` string, uuid: Link an existing KnowledgeDoc by ID (mutually exclusive with inline fields)
  - `doc_type` string: Document type key for inline creation (e.g. brand_voice, style_guide)
  - `name` string: Document name for inline creation
  - `description` string: Document description (optional, defaults to empty)
  - `data` object: Structured JSON data (optional, defaults to empty object)
  - `content` string: Markdown content (optional, defaults to empty)

## Response `201`

Context document created

- unknown

## Other responses

- `400`: Validation error. Common causes: - Neither `document_id` nor `doc_type` provided - Singleton violation (predefined type already exists for this brandkit)
- `401`: Unauthorized
- `404`: Brand kit not found

---

[API](https://skmtc.dev/simplified/apis/platform.md) - [All operations](https://skmtc.dev/simplified/apis/platform/llms.txt) - [OpenAPI document](https://skmtc.dev/simplified/apis/platform/revisions/0815a1ba1e4e?raw)
