Restore source (deprecated)
POST/v2/agents/{agentId}/sources/{sourceId}/restore
Deprecated endpoint that brings back a deleted source of an agent. Add the content again with the create source endpoints instead.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
Warning: This endpoint is deprecated. To bring content back, add it again with Create source or Create file source. New code should not call this endpoint.
Brings back a source that was removed with Delete source. It keeps working for existing scripts, but the replacements above let you choose exactly which content the agent learns.
Request
POST /v2/agents/{agentId}/sources/{sourceId}/restore
Path parameters:
| Name | Type | Required | Description |
|---|---|---|---|
agentId |
string | Yes | The ID of the agent, starting with agt_. |
sourceId |
string | Yes | The ID of the deleted source, starting with src_. |
The call has no query parameters and no body. The source returns with its original ID, type and title, and is queued for training again. The Sources API overview lists the statuses it goes through.
Example request
curl -X POST https://api.askocto.co/v2/agents/agt_8f3k2m/sources/src_4n7c2w/restore \
-H "Authorization: Bearer $OCTO_API_KEY"
const response = await fetch(
"https://api.askocto.co/v2/agents/agt_8f3k2m/sources/src_4n7c2w/restore",
{
method: "POST",
headers: { Authorization: `Bearer ${process.env.OCTO_API_KEY}` },
},
)
const source = await response.json()
console.log(source.id, source.status)
Example response
A successful call returns 200 OK with the restored source.
{
"id": "src_4n7c2w",
"type": "file",
"title": "Returns policy",
"status": "queued",
"characters": 0,
"failureReason": null,
"createdAt": "2026-03-19T15:02:00Z"
}
Response fields
The response is a source object, described under Get source. status is queued, and characters stays 0 until training has read the content again. The agent uses the source once it is ready.
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized |
The API key is missing, malformed or deleted. |
| 404 | not_found |
The agent does not exist, or no deleted source has this ID. |
| 409 | conflict |
The source is not deleted, so there is nothing to restore. |
| 429 | rate_limited |
Too many requests. Wait for the number of seconds in the Retry-After header. |