> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.simplified.com/api-reference/platform/brand-context/create-context-document/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.simplified.com/_mcp/server. # API · Context · Create a context document POST https://api.simplified.com/api/v1/brandkit/{brand_id}/context-documents Content-Type: application/json 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. Reference: https://docs.simplified.com/api-reference/platform/brand-context/create-context-document ## Authentication - `Authorization` header (required) (prefixed with ` Api-Key `) — Header authentication of the form `Api-Key ` - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `brand_id` (string, required) — Brand kit UUID ### Body (application/json) This endpoint expects a ContextDocumentCreateRequest. - `document_id` (string, optional) — Link an existing KnowledgeDoc by ID (mutually exclusive with inline fields) - `doc_type` (string, optional) — Document type key for inline creation (e.g. brand_voice, style_guide) - `name` (string, optional) — Document name for inline creation - `description` (string, optional) — Document description (optional, defaults to empty) - `data` (map from string to any, optional) — Structured JSON data (optional, defaults to empty object) - `content` (string, optional) — Markdown content (optional, defaults to empty) ## Response ### 201 Context document created - `any` ## Errors ### 400 Bad Request Error Validation error. Common causes: - Neither `document_id` nor `doc_type` provided - Singleton violation (predefined type already exists for this brandkit) - `any` ### 401 Unauthorized Error Unauthorized - `any` ### 404 Not Found Error Brand kit not found - `any` ## Examples ### Create new document inline **Request** ```json { "doc_type": "brand_voice", "name": "Brand Voice & Messaging", "data": { "formality": 60, "tone": "professional" }, "content": "# Brand Voice\n\nOur brand speaks with confidence and warmth..." } ``` **SDK Code** ```python Create new document inline import requests url = "https://api.simplified.com/api/v1/brandkit/brand_id/context-documents" payload = { "doc_type": "brand_voice", "name": "Brand Voice & Messaging", "data": { "formality": 60, "tone": "professional" }, "content": "# Brand Voice Our brand speaks with confidence and warmth..." } headers = { "Authorization": "Api-Key ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Create new document inline const url = 'https://api.simplified.com/api/v1/brandkit/brand_id/context-documents'; const options = { method: 'POST', headers: {Authorization: 'Api-Key ', 'Content-Type': 'application/json'}, body: '{"doc_type":"brand_voice","name":"Brand Voice & Messaging","data":{"formality":60,"tone":"professional"},"content":"# Brand Voice\n\nOur brand speaks with confidence and warmth..."}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Create new document inline package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.simplified.com/api/v1/brandkit/brand_id/context-documents" payload := strings.NewReader("{\n \"doc_type\": \"brand_voice\",\n \"name\": \"Brand Voice & Messaging\",\n \"data\": {\n \"formality\": 60,\n \"tone\": \"professional\"\n },\n \"content\": \"# Brand Voice\\n\\nOur brand speaks with confidence and warmth...\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Api-Key ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Create new document inline require 'uri' require 'net/http' url = URI("https://api.simplified.com/api/v1/brandkit/brand_id/context-documents") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Api-Key ' request["Content-Type"] = 'application/json' request.body = "{\n \"doc_type\": \"brand_voice\",\n \"name\": \"Brand Voice & Messaging\",\n \"data\": {\n \"formality\": 60,\n \"tone\": \"professional\"\n },\n \"content\": \"# Brand Voice\\n\\nOur brand speaks with confidence and warmth...\"\n}" response = http.request(request) puts response.read_body ``` ```java Create new document inline import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.simplified.com/api/v1/brandkit/brand_id/context-documents") .header("Authorization", "Api-Key ") .header("Content-Type", "application/json") .body("{\n \"doc_type\": \"brand_voice\",\n \"name\": \"Brand Voice & Messaging\",\n \"data\": {\n \"formality\": 60,\n \"tone\": \"professional\"\n },\n \"content\": \"# Brand Voice\\n\\nOur brand speaks with confidence and warmth...\"\n}") .asString(); ``` ```php Create new document inline request('POST', 'https://api.simplified.com/api/v1/brandkit/brand_id/context-documents', [ 'body' => '{ "doc_type": "brand_voice", "name": "Brand Voice & Messaging", "data": { "formality": 60, "tone": "professional" }, "content": "# Brand Voice\\n\\nOur brand speaks with confidence and warmth..." }', 'headers' => [ 'Authorization' => 'Api-Key ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Create new document inline using RestSharp; var client = new RestClient("https://api.simplified.com/api/v1/brandkit/brand_id/context-documents"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Api-Key "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"doc_type\": \"brand_voice\",\n \"name\": \"Brand Voice & Messaging\",\n \"data\": {\n \"formality\": 60,\n \"tone\": \"professional\"\n },\n \"content\": \"# Brand Voice\\n\\nOur brand speaks with confidence and warmth...\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Create new document inline import Foundation let headers = [ "Authorization": "Api-Key ", "Content-Type": "application/json" ] let parameters = [ "doc_type": "brand_voice", "name": "Brand Voice & Messaging", "data": [ "formality": 60, "tone": "professional" ], "content": "# Brand Voice Our brand speaks with confidence and warmth..." ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.simplified.com/api/v1/brandkit/brand_id/context-documents")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Link an existing KnowledgeDoc **Request** ```json { "document_id": "d1e2f3a4-b5c6-7890-abcd-000000000001" } ``` **SDK Code** ```python Link an existing KnowledgeDoc import requests url = "https://api.simplified.com/api/v1/brandkit/brand_id/context-documents" payload = { "document_id": "d1e2f3a4-b5c6-7890-abcd-000000000001" } headers = { "Authorization": "Api-Key ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Link an existing KnowledgeDoc const url = 'https://api.simplified.com/api/v1/brandkit/brand_id/context-documents'; const options = { method: 'POST', headers: {Authorization: 'Api-Key ', 'Content-Type': 'application/json'}, body: '{"document_id":"d1e2f3a4-b5c6-7890-abcd-000000000001"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Link an existing KnowledgeDoc package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.simplified.com/api/v1/brandkit/brand_id/context-documents" payload := strings.NewReader("{\n \"document_id\": \"d1e2f3a4-b5c6-7890-abcd-000000000001\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Api-Key ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Link an existing KnowledgeDoc require 'uri' require 'net/http' url = URI("https://api.simplified.com/api/v1/brandkit/brand_id/context-documents") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Api-Key ' request["Content-Type"] = 'application/json' request.body = "{\n \"document_id\": \"d1e2f3a4-b5c6-7890-abcd-000000000001\"\n}" response = http.request(request) puts response.read_body ``` ```java Link an existing KnowledgeDoc import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.simplified.com/api/v1/brandkit/brand_id/context-documents") .header("Authorization", "Api-Key ") .header("Content-Type", "application/json") .body("{\n \"document_id\": \"d1e2f3a4-b5c6-7890-abcd-000000000001\"\n}") .asString(); ``` ```php Link an existing KnowledgeDoc request('POST', 'https://api.simplified.com/api/v1/brandkit/brand_id/context-documents', [ 'body' => '{ "document_id": "d1e2f3a4-b5c6-7890-abcd-000000000001" }', 'headers' => [ 'Authorization' => 'Api-Key ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Link an existing KnowledgeDoc using RestSharp; var client = new RestClient("https://api.simplified.com/api/v1/brandkit/brand_id/context-documents"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Api-Key "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"document_id\": \"d1e2f3a4-b5c6-7890-abcd-000000000001\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Link an existing KnowledgeDoc import Foundation let headers = [ "Authorization": "Api-Key ", "Content-Type": "application/json" ] let parameters = ["document_id": "d1e2f3a4-b5c6-7890-abcd-000000000001"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.simplified.com/api/v1/brandkit/brand_id/context-documents")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```