Update source
PATCH/v2/agents/{agentId}/sources/{sourceId}
Change the title, address, text or question and answer of a source by sending only the fields that change, then retrain it.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
Changes a source and queues it for training again. Call it to correct a text source, fix a Q&A answer after a policy change, point a website source at a new address or rename any source.
To replace the file of a file source, use Update file source. You can still rename a file source here.
Request
PATCH /v2/agents/{agentId}/sources/{sourceId}
Path parameters:
| Name | Type | Required | Description |
|---|---|---|---|
agentId |
string | Yes | The ID of the agent, starting with agt_. |
sourceId |
string | Yes | The ID of the source, starting with src_. |
Body fields. Send only the ones you want to change, and at least one:
| Name | Type | Applies to | Description |
|---|---|---|---|
title |
string | Every type | A new name. |
url |
string | website |
A new page or sitemap address. |
content |
string | text |
The full new text. It replaces the old text. |
question |
string | qa |
A new question. |
answer |
string | qa |
A new answer. |
A field that does not apply to the type of the source is rejected. The type of a source never changes.
Example request
curl -X PATCH https://api.askocto.co/v2/agents/agt_8f3k2m/sources/src_7q2w5e \
-H "Authorization: Bearer $OCTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"answer": "Yes, to most countries. Rates show at checkout."}'
const response = await fetch(
"https://api.askocto.co/v2/agents/agt_8f3k2m/sources/src_7q2w5e",
{
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.OCTO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ answer: "Yes, to most countries. Rates show at checkout." }),
},
)
const source = await response.json()
console.log(source.status)
Example response
A successful call returns 200 OK with the updated source. The status is queued because training runs again.
{
"id": "src_7q2w5e",
"type": "qa",
"title": "Do you ship abroad?",
"status": "queued",
"question": "Do you ship abroad?",
"answer": "Yes, to most countries. Rates show at checkout.",
"characters": 71,
"failureReason": null,
"createdAt": "2026-03-10T08:20:00Z"
}
Response fields
The response is a source object, described under Get source. The agent keeps using the earlier version of the source until the new training run is ready. Poll Get source to see when that happens.
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request |
The body is empty, a field has the wrong type, or a field does not apply to the type of the source. |
| 401 | unauthorized |
The API key is missing, malformed or deleted. |
| 404 | not_found |
The agent or the source does not exist in your workspace. |
| 409 | conflict |
The source is in the status training. Wait until it is ready or failed, then send the change again. |
| 429 | rate_limited |
Too many requests. Wait for the number of seconds in the Retry-After header. |