Docs
API ReferenceReferenceKnowledgebases

Add a source document

POST
/knowledgebases/{knowledgebaseId}/sources

Add a document to a knowledgebase through the same ingestion path as a builder upload, so every agent that uses the knowledgebase sees it on its next run. Send JSON with exactly one of contentMarkdown, contentText (inline, up to 1 MB) or url (a public http(s) page, fetched server-side), or multipart/form-data with a file part (PDF, CSV, TXT, MD; up to the 4.5 MB request limit, or give a url for larger documents). Indexing runs in the background: the answer is 202 with status: processing; poll GET …/sources/{sourceId} until ready. When the organization reviews agent writes the status is pending_review until a person approves it. The plan may cap sources per knowledgebase (plan_limit). Requires the knowledge:write scope. Idempotency-Key guards a retry.

AuthorizationBearer <token>

An organization API key, created from a Portal's Webhooks page (Provisioning API card). The secret is shown once at creation and stored only as a hash. Keys are organization-wide and carry scopes (end_users:read, end_users:write). Rate limit: 120 requests per minute per key (sliding 60-second window).

In: header

Path Parameters

knowledgebaseId*string
Formatuuid

Request Body

TypeScript Definitions

Use the request body type in TypeScript.

Exactly one of contentMarkdown, contentText or url. For a file, send multipart/form-data with a file part (and an optional name) instead.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/knowledgebases/497f6eca-6276-4993-bfeb-53cbbbba6f08/sources" \  -H "Content-Type: application/json" \  -d '{    "name": "string"  }'
{  "status": "processing",  "source": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "type": "string",    "status": "string",    "searchable": true,    "disabled": true,    "url": "string",    "updatedAt": "2019-08-24T14:15:22Z",    "createdAt": "2019-08-24T14:15:22Z",    "sizeBytes": 0,    "errorMessage": "string",    "createdVia": "string"  },  "reviewPath": "string"}