> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.simplified.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.simplified.com/_mcp/server.

# API · Context · Update a context document

PATCH https://api.simplified.com/api/v1/brandkit/{brand_id}/context-documents/{document_link_id}
Content-Type: application/json

Update the content of a linked context document.
Changes are applied to the underlying KnowledgeDoc, and its version
is automatically incremented.


Reference: https://docs.simplified.com/api-reference/platform/brand-context/update-context-document

## Authentication

- `Authorization` header (required) (prefixed with ` Api-Key   `) — Header authentication of the form `Api-Key  <token>`
- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `brand_id` (string, required) — Brand kit UUID
- `document_link_id` (string, required) — Either the context-document link UUID (BrandKitContextDocument ID) OR the underlying KnowledgeDoc UUID — the endpoint resolves both.

### Body (application/json)

This endpoint expects a ContextDocumentUpdateRequest.

- `name` (string, optional)
- `description` (string, optional)
- `data` (map from string to any, optional) — Structured JSON data
- `content` (string, optional) — Markdown content

## Response

### 200

Context document updated

- `any`

## Errors

### 400 Bad Request Error

Validation error

- `any`

### 401 Unauthorized Error

Unauthorized

- `any`

### 404 Not Found Error

Context document link not found

- `any`

## Examples

**Request**

```json
{
  "name": "Updated Brand Voice",
  "content": "# Brand Voice v2\n\nRevised brand voice guidelines..."
}
```

**SDK Code**

```python Brand Context_updateContextDocument_example
import requests

url = "https://api.simplified.com/api/v1/brandkit/brand_id/context-documents/document_link_id"

payload = {
    "name": "Updated Brand Voice",
    "content": "# Brand Voice v2

Revised brand voice guidelines..."
}
headers = {
    "Authorization": "Api-Key  <apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Brand Context_updateContextDocument_example
const url = 'https://api.simplified.com/api/v1/brandkit/brand_id/context-documents/document_link_id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Api-Key  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Updated Brand Voice","content":"# Brand Voice v2\n\nRevised brand voice guidelines..."}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Brand Context_updateContextDocument_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.simplified.com/api/v1/brandkit/brand_id/context-documents/document_link_id"

	payload := strings.NewReader("{\n  \"name\": \"Updated Brand Voice\",\n  \"content\": \"# Brand Voice v2\\n\\nRevised brand voice guidelines...\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Api-Key  <apiKey>")
	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 Brand Context_updateContextDocument_example
require 'uri'
require 'net/http'

url = URI("https://api.simplified.com/api/v1/brandkit/brand_id/context-documents/document_link_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Api-Key  <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Updated Brand Voice\",\n  \"content\": \"# Brand Voice v2\\n\\nRevised brand voice guidelines...\"\n}"

response = http.request(request)
puts response.read_body
```

```java Brand Context_updateContextDocument_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.simplified.com/api/v1/brandkit/brand_id/context-documents/document_link_id")
  .header("Authorization", "Api-Key  <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Updated Brand Voice\",\n  \"content\": \"# Brand Voice v2\\n\\nRevised brand voice guidelines...\"\n}")
  .asString();
```

```php Brand Context_updateContextDocument_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.simplified.com/api/v1/brandkit/brand_id/context-documents/document_link_id', [
  'body' => '{
  "name": "Updated Brand Voice",
  "content": "# Brand Voice v2\\n\\nRevised brand voice guidelines..."
}',
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Brand Context_updateContextDocument_example
using RestSharp;

var client = new RestClient("https://api.simplified.com/api/v1/brandkit/brand_id/context-documents/document_link_id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Updated Brand Voice\",\n  \"content\": \"# Brand Voice v2\\n\\nRevised brand voice guidelines...\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Brand Context_updateContextDocument_example
import Foundation

let headers = [
  "Authorization": "Api-Key  <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Updated Brand Voice",
  "content": "# Brand Voice v2

Revised brand voice guidelines..."
] 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/document_link_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```