{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key is invalid or has been revoked.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}
{
"error": {
"type": "permission_error",
"code": "insufficient_permission",
"message": "This API key doesn't have create access to knowledge_base.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}
{
"error": {
"type": "not_found_error",
"code": "resource_not_found",
"message": "No agent with this ID exists, or this API key can't access it.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}
{
"error": {
"type": "invalid_request_error",
"code": "source_already_exists",
"message": "This agent's knowledge base already has this URL, as source 0d1f6a3e-5b2c-4e8f-9a7d-3c6b1e2f4a5d.",
"param": "link.url",
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}
Adds a link, text, FAQ, or uploaded document to an agent’s knowledge base. To add a document, first upload the file as described in Create a document upload. The source trains in the background. Retrieve it to check its status. To add many sources at once, use Add knowledge base sources in bulk.
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key is invalid or has been revoked.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}
{
"error": {
"type": "permission_error",
"code": "insufficient_permission",
"message": "This API key doesn't have create access to knowledge_base.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}
{
"error": {
"type": "not_found_error",
"code": "resource_not_found",
"message": "No agent with this ID exists, or this API key can't access it.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}
{
"error": {
"type": "invalid_request_error",
"code": "source_already_exists",
"message": "This agent's knowledge base already has this URL, as source 0d1f6a3e-5b2c-4e8f-9a7d-3c6b1e2f4a5d.",
"param": "link.url",
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}
A unique key that makes the request safe to retry, such as a V4 UUID. 1 to 255 printable ASCII characters.
Required string length: 1 - 255
Body
application/json
A type, and the object with the same name.
agent_id
string
required
Maximum string length: 64
type
enum<string>
required
The types you can add a source as. link is a web page, fetched when the source trains. text and faq are content you send. document is a file you upload first with Create a document upload. Zoho Desk, Zendesk, Notion, and SharePoint sources are added in the dashboard.
Available options:
link,
text,
faq,
document
link
object
requirediftype=link
Required if type is link, and not allowed otherwise.
Show child attributes
text
object
requirediftype=text
Required if type is text, and not allowed otherwise.
Show child attributes
faq
object
requirediftype=faq
Required if type is faq, and not allowed otherwise.
Show child attributes
document
object
requirediftype=document
Required if type is document, and not allowed otherwise.
Show child attributes
Response
The new source, with status: pending. A document is checked against the limit of 5 million characters per document and the characters left when it trains, and fails if it has too many.
object
any
required
id
string
required
Example:
"0d1f6a3e-5b2c-4e8f-9a7d-3c6b1e2f4a5d"
agent
object
required
The agent this belongs to.
Show child attributes
type
enum<string>
required
link is a web page, fetched when the source trains. text and faq are content you send. document is a file you upload first with Create a document upload. zoho, zendesk, notion, and sharepoint are Zoho Desk articles, Zendesk articles, Notion pages, and SharePoint files, added in the dashboard through a connection. The API can list, resync, and delete them, and change their auto_sync, but can't add them or change their content.
Available options:
link,
text,
faq,
document,
zoho,
zendesk,
notion,
sharepoint
status
enum<string>
required
pending sources are waiting to train, processing sources are training, processed sources are used in replies, and failed sources couldn't be trained. For failed sources, error says why.
Available options:
pending,
processing,
processed,
failed
error
string | null
required
Why training failed, if status is failed.
characters
integer | null
required
The number of the plan's knowledge base characters the source uses. For links, documents, and connected sources, known once the source is trained.
resync_pending
boolean
required
Whether the source is queued to retrain after a resync, edit, or auto-sync.
last_synced_at
string<date-time> | null
required
Time at which the source was last trained.
created_at
string<date-time> | null
required
updated_at
string<date-time> | null
required
link
object
Only for link sources.
Show child attributes
text
object
Only for text sources.
Show child attributes
faq
object
Only for faq sources.
Show child attributes
document
object
Only for document sources.
Show child attributes
zoho
object
Only for zoho sources.
Show child attributes
zendesk
object
Only for zendesk sources.
Show child attributes
notion
object
Only for notion sources.
Show child attributes
sharepoint
object
Only for sharepoint sources.
Show child attributes
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Chatling Documentation","colors":{"primary":"#0D9373","light":"#07C983","dark":"#0D9373"},"logo":{"light":"https://mintcdn.com/chatling-21192973/28-2rxbvH5ywRTMu/logo/chatling-logo.svg?fit=max\u0026auto=format\u0026n=28-2rxbvH5ywRTMu\u0026q=85\u0026s=b2dff50e5e554f9a1821ad6c4e86b8cd","dark":"https://mintcdn.com/chatling-21192973/28-2rxbvH5ywRTMu/logo/chatling-logo-white.svg?fit=max\u0026auto=format\u0026n=28-2rxbvH5ywRTMu\u0026q=85\u0026s=7139297f08e04dea3d5f04e8ff00e18b"},"favicon":"https://mintcdn.com/chatling-21192973/28-2rxbvH5ywRTMu/favicon.svg?fit=max\u0026auto=format\u0026n=28-2rxbvH5ywRTMu\u0026q=85\u0026s=f0289a5a055de1338da1c4cd5d297893","api":{"playground":{"display":"simple"},"mdx":{"auth":{"method":"bearer"},"server":"https://api.chatling.ai/v3"}},"navbar":{"links":[{"href":"https://app.chatling.ai","label":"Dashboard"}]},"footer":{"socials":{"x":"https://twitter.com/chatlingai","linkedin":"https://www.linkedin.com/company/chatlingai"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"chatling-21192973","hasAudioNarration":false,"actualSubdomain":"chatling-21192973","customDomains":["docs.chatling.ai"],"gitSource":{"type":"github","owner":"ahm750","repo":"documentation","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6b0cf4ae9508b2d5f2b65fff","clientVersion":"0.0.4347","searchFilterCounts":[{"language":"default","tag":"Documentation","count":160},{"language":"default","tag":"API Reference","count":92},{"language":"default","tag":"Reference","count":87},{"language":"default","tag":"Chatbot","count":60},{"language":"default","tag":"Builder","count":50},{"language":"default","tag":"Blocks","count":35},{"language":"default","tag":"AI Agent","count":23},{"language":"default","tag":"Web Widget","count":23},{"language":"default","tag":"Conversations","count":15},{"language":"default","tag":"Live Chat","count":13}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"api-reference/v3/knowledge-base/create-knowledge-base-source","slug":"/api-reference/v3/knowledge-base/create-knowledge-base-source","pageMetadata":{"title":"Add a knowledge base source","description":"Adds a link, text, FAQ, or uploaded document to an agent's knowledge base. To add a document, first upload the file as described in [Create a document upload](/api-reference/v3/knowledge-base/create-knowledge-base-upload). The source trains in the background. Retrieve it to check its `status`. To add many sources at once, use [Add knowledge base sources in bulk](/api-reference/v3/knowledge-base/create-knowledge-base-sources).","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /knowledge-base/sources","href":"/api-reference/v3/knowledge-base/create-knowledge-base-source","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n a: \"a\",\n code: \"code\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_components.p, {\n children: [\"Adds a link, text, FAQ, or uploaded document to an agent’s knowledge base. To add a document, first upload the file as described in \", _jsx(_components.a, {\n href: \"/api-reference/v3/knowledge-base/create-knowledge-base-upload\",\n children: \"Create a document upload\"\n }), \". The source trains in the background. Retrieve it to check its \", _jsx(_components.code, {\n children: \"status\"\n }), \". To add many sources at once, use \", _jsx(_components.a, {\n href: \"/api-reference/v3/knowledge-base/create-knowledge-base-sources\",\n children: \"Add knowledge base sources in bulk\"\n }), \".\"]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Add a knowledge base source","description":"Adds a link, text, FAQ, or uploaded document to an agent's knowledge base. To add a document, first upload the file as described in [Create a document upload](/api-reference/v3/knowledge-base/create-knowledge-base-upload). The source trains in the background. Retrieve it to check its `status`. To add many sources at once, use [Add knowledge base sources in bulk](/api-reference/v3/knowledge-base/create-knowledge-base-sources).","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /knowledge-base/sources","href":"/api-reference/v3/knowledge-base/create-knowledge-base-source","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"operationId":"createKnowledgeBaseSource","tags":["Knowledge base"],"summary":"Add a knowledge base source","description":"Adds a link, text, FAQ, or uploaded document to an agent's knowledge base. To add a document, first upload the file as described in [Create a document upload](/api-reference/v3/knowledge-base/create-knowledge-base-upload). The source trains in the background. Retrieve it to check its `status`. To add many sources at once, use [Add knowledge base sources in bulk](/api-reference/v3/knowledge-base/create-knowledge-base-sources).","x-chatling-permission":{"group":"knowledge_base","access":"create"},"x-chatling-project-wide":false,"x-chatling-agent-types":["ai_agent","chatbot"],"parameters":["f3b41ffb-95e1-4e14-9a04-d293a49d9521"],"requestBody":"c69c14e6-7361-4833-a7f4-4e7f63723c72","responses":{"201":"64272aec-add8-476f-8d53-685211eb274a","400":"dbd648ef-ef3d-4fcd-9eeb-74acabeeb65c","401":"9850d44a-665e-4747-a0fb-266f55ab5ca2","403":"a2396bde-e9a9-4617-8073-3cc5fa7baea0","404":"c37639fa-46f4-456b-8ba1-37fcd15d1676","409":"a2d3dc0a-62e9-476b-b24b-fb72585d67a1","422":"42ca0c0d-e0af-4fd8-a209-6b37f74bd073","429":"47943f1b-050b-4c6c-a29c-ecfa755fad5f"},"method":"post","type":"path","servers":["16086fde-3c32-456e-b395-21dafcd77092"],"security":["8529c987-60c7-4138-9cff-c6fa1c1f2729"],"path":"/knowledge-base/sources","baseUrlOptions":["https://api.chatling.ai/v3"],"title":"Add a knowledge base source","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"f3b41ffb-95e1-4e14-9a04-d293a49d9521":{"name":"Idempotency-Key","in":"header","description":"A unique key that makes the request safe to retry, such as a V4 UUID. 1 to 255 printable ASCII characters.","schema":{"type":"string","minLength":1,"maxLength":255,"description":"A unique key that makes the request safe to retry, such as a V4 UUID. 1 to 255 printable ASCII characters.","uniqueKey":"","typeLabel":"string"}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"A `type`, and the object with the same name.","required":["agent_id","type"],"conditionallyRequiredProperties":{"link":[{"when":[[{"property":"type","values":["link"]}]]}],"text":[{"when":[[{"property":"type","values":["text"]}]]}],"faq":[{"when":[[{"property":"type","values":["faq"]}]]}],"document":[{"when":[[{"property":"type","values":["document"]}]]}]},"properties":{"agent_id":{"type":"string","maxLength":64,"isRequired":true,"uniqueKey":"agent_id","typeLabel":"string"},"type":{"type":"string","enum":["link","text","faq","document"],"description":"The types you can add a source as. `link` is a web page, fetched when the source trains. `text` and `faq` are content you send. `document` is a file you upload first with [Create a document upload](/api-reference/v3/knowledge-base/create-knowledge-base-upload). Zoho Desk, Zendesk, Notion, and SharePoint sources are added in the dashboard.","isRequired":true,"uniqueKey":"type","typeLabel":"enum\u003cstring>"},"link":{"type":"object","required":["url"],"additionalProperties":false,"properties":{"url":{"type":"string","format":"uri","maxLength":2083,"description":"A public `http` or `https` page. URLs on private or internal networks aren't allowed, and neither are URLs already in the knowledge base.","isRequired":true,"uniqueKey":"link.url","typeLabel":"string\u003curi>"},"auto_sync":{"type":"string","enum":["never","daily","weekly","monthly"],"description":"How often the source is fetched and retrained. Each option except `never` must be on the plan. Auto-syncs use resync credits.","default":"never","uniqueKey":"link.auto_sync","typeLabel":"enum\u003cstring>"},"exclude_classes":{"type":"array","maxItems":100,"items":{"type":"string","maxLength":100,"uniqueKey":"link.exclude_classes.items.[INDEX]","typeLabel":"string"},"description":"HTML classes whose elements are excluded from the page, such as cookie banners.","uniqueKey":"link.exclude_classes","typeLabel":"string[]"},"exclude_ids":{"type":"array","maxItems":100,"items":{"type":"string","maxLength":100,"uniqueKey":"link.exclude_ids.items.[INDEX]","typeLabel":"string"},"description":"HTML IDs whose elements are excluded from the page.","uniqueKey":"link.exclude_ids","typeLabel":"string[]"}},"description":"Required if `type` is `link`, and not allowed otherwise.","conditionalRequirements":[{"when":[[{"property":"type","values":["link"]}]]}],"uniqueKey":"link","typeLabel":"object"},"text":{"type":"object","required":["content"],"additionalProperties":false,"properties":{"content":{"type":"string","maxLength":1000000,"description":"Markdown (GitHub-flavored, with tables). Up to 100,000 characters of text, not counting formatting. Single line breaks are kept.","isRequired":true,"uniqueKey":"text.content","typeLabel":"string"}},"description":"Required if `type` is `text`, and not allowed otherwise.","conditionalRequirements":[{"when":[[{"property":"type","values":["text"]}]]}],"uniqueKey":"text","typeLabel":"object"},"faq":{"type":"object","required":["question","answer"],"additionalProperties":false,"properties":{"question":{"type":"string","maxLength":8000,"description":"Plain text. HTML tags are removed.","isRequired":true,"uniqueKey":"faq.question","typeLabel":"string"},"answer":{"type":"string","maxLength":1000000,"description":"Markdown (GitHub-flavored, with tables).","isRequired":true,"uniqueKey":"faq.answer","typeLabel":"string"}},"description":"Required if `type` is `faq`, and not allowed otherwise.","conditionalRequirements":[{"when":[[{"property":"type","values":["faq"]}]]}],"uniqueKey":"faq","typeLabel":"object"},"document":{"type":"object","required":["upload_id"],"additionalProperties":false,"properties":{"upload_id":{"type":"string","maxLength":64,"description":"ID of an upload for this agent whose file was uploaded, as described in [Create a document upload](/api-reference/v3/knowledge-base/create-knowledge-base-upload). Each upload adds one source, within 24 hours of its creation.","example":"9b2e7c41-8d3a-4f6e-a1b5-2c7d9e0f3a64","isRequired":true,"uniqueKey":"document.upload_id","typeLabel":"string"}},"description":"Required if `type` is `document`, and not allowed otherwise.","conditionalRequirements":[{"when":[[{"property":"type","values":["document"]}]]}],"uniqueKey":"document","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"","typeLabel":"object"},"examples":{"link":{"title":"link","summary":"A web page","value":{"agent_id":"3132353852","type":"link","link":{"url":"https://example.com/pricing","auto_sync":"weekly"}}},"text":{"title":"text","summary":"Text","value":{"agent_id":"3132353852","type":"text","text":{"content":"## Support\n\nOur support team answers within **one business day**."}}},"faq":{"title":"faq","summary":"An FAQ","value":{"agent_id":"3132353852","type":"faq","faq":{"question":"Do you ship internationally?","answer":"Yes, to over **40 countries**."}}},"document":{"title":"document","summary":"An uploaded document","value":{"agent_id":"3132353852","type":"document","document":{"upload_id":"9b2e7c41-8d3a-4f6e-a1b5-2c7d9e0f3a64"}}}},"exampleType":"examples"}},"exampleType":"examples"},"responses":{"64272aec-add8-476f-8d53-685211eb274a":{"description":"The new source, with `status: pending`. A document is checked against the limit of 5 million characters per document and the characters left when it trains, and fails if it has too many.","content":{"application/json":{"schema":{"type":"object","required":["object","id","agent","type","status","error","characters","resync_pending","last_synced_at","created_at","updated_at"],"properties":{"object":{"const":"knowledge_base_source","isRequired":true,"uniqueKey":"object","typeLabel":"any"},"id":{"type":"string","example":"0d1f6a3e-5b2c-4e8f-9a7d-3c6b1e2f4a5d","isRequired":true,"uniqueKey":"id","typeLabel":"string"},"agent":{"type":"object","description":"The agent this belongs to.","required":["id","type","name"],"properties":{"id":{"type":"string","description":"ID of the agent, as passed in `agent_id`.","example":"3132353852","isRequired":true,"uniqueKey":"agent.id","typeLabel":"string"},"type":{"type":"string","enum":["ai_agent","chatbot"],"description":"`ai_agent` for an AI agent, at `/agents`, or `chatbot` for a flow-builder chatbot, at `/chatbots`.","isRequired":true,"uniqueKey":"agent.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","example":"Support agent","isRequired":true,"uniqueKey":"agent.name","typeLabel":"string"}},"isRequired":true,"uniqueKey":"agent","typeLabel":"object"},"type":{"type":"string","enum":["link","text","faq","document","zoho","zendesk","notion","sharepoint"],"description":"`link` is a web page, fetched when the source trains. `text` and `faq` are content you send. `document` is a file you upload first with [Create a document upload](/api-reference/v3/knowledge-base/create-knowledge-base-upload). `zoho`, `zendesk`, `notion`, and `sharepoint` are Zoho Desk articles, Zendesk articles, Notion pages, and SharePoint files, added in the dashboard through a connection. The API can list, resync, and delete them, and change their `auto_sync`, but can't add them or change their content.","isRequired":true,"uniqueKey":"type","typeLabel":"enum\u003cstring>"},"status":{"type":"string","enum":["pending","processing","processed","failed"],"description":"`pending` sources are waiting to train, `processing` sources are training, `processed` sources are used in replies, and `failed` sources couldn't be trained. For `failed` sources, `error` says why.","isRequired":true,"uniqueKey":"status","typeLabel":"enum\u003cstring>"},"error":{"oneOf":[{"type":"string","description":"Why training failed, if `status` is `failed`.","isRequired":true,"uniqueKey":"error.oneOf.0","typeLabel":"string"},{"type":"null","description":"Why training failed, if `status` is `failed`.","isRequired":true,"uniqueKey":"error.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error","typeLabel":"string | null"},"characters":{"oneOf":[{"type":"integer","description":"The number of the plan's knowledge base characters the source uses. For links, documents, and connected sources, known once the source is trained.","isRequired":true,"uniqueKey":"characters.oneOf.0","typeLabel":"integer"},{"type":"null","description":"The number of the plan's knowledge base characters the source uses. For links, documents, and connected sources, known once the source is trained.","isRequired":true,"uniqueKey":"characters.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"characters","typeLabel":"integer | null"},"resync_pending":{"type":"boolean","description":"Whether the source is queued to retrain after a resync, edit, or auto-sync.","isRequired":true,"uniqueKey":"resync_pending","typeLabel":"boolean"},"last_synced_at":{"oneOf":[{"type":"string","format":"date-time","description":"Time at which the source was last trained.","isRequired":true,"uniqueKey":"last_synced_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","description":"Time at which the source was last trained.","isRequired":true,"uniqueKey":"last_synced_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"last_synced_at","typeLabel":"string\u003cdate-time> | null"},"created_at":{"oneOf":[{"type":"string","format":"date-time","isRequired":true,"uniqueKey":"created_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","isRequired":true,"uniqueKey":"created_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"created_at","typeLabel":"string\u003cdate-time> | null"},"updated_at":{"oneOf":[{"type":"string","format":"date-time","isRequired":true,"uniqueKey":"updated_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","isRequired":true,"uniqueKey":"updated_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"updated_at","typeLabel":"string\u003cdate-time> | null"},"link":{"type":"object","required":["url","title","auto_sync","next_sync_at","exclude_classes","exclude_ids"],"properties":{"url":{"type":"string","format":"uri","example":"https://example.com/pricing","isRequired":true,"uniqueKey":"link.url","typeLabel":"string\u003curi>"},"title":{"oneOf":[{"type":"string","description":"The page's title, once fetched.","example":"Pricing","isRequired":true,"uniqueKey":"link.title.oneOf.0","typeLabel":"string"},{"type":"null","description":"The page's title, once fetched.","example":"Pricing","isRequired":true,"uniqueKey":"link.title.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"link.title","typeLabel":"string | null"},"auto_sync":{"type":"string","enum":["never","daily","weekly","monthly"],"description":"How often the source is fetched and retrained. Each option except `never` must be on the plan. Auto-syncs use resync credits.","isRequired":true,"uniqueKey":"link.auto_sync","typeLabel":"enum\u003cstring>"},"next_sync_at":{"oneOf":[{"type":"string","format":"date-time","description":"Time at which the page next syncs automatically, if scheduled.","isRequired":true,"uniqueKey":"link.next_sync_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","description":"Time at which the page next syncs automatically, if scheduled.","isRequired":true,"uniqueKey":"link.next_sync_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"link.next_sync_at","typeLabel":"string\u003cdate-time> | null"},"exclude_classes":{"type":"array","items":{"type":"string","uniqueKey":"link.exclude_classes.items.[INDEX]","typeLabel":"string"},"description":"HTML classes whose elements are excluded from the page.","isRequired":true,"uniqueKey":"link.exclude_classes","typeLabel":"string[]"},"exclude_ids":{"type":"array","items":{"type":"string","uniqueKey":"link.exclude_ids.items.[INDEX]","typeLabel":"string"},"description":"HTML IDs whose elements are excluded from the page.","isRequired":true,"uniqueKey":"link.exclude_ids","typeLabel":"string[]"},"content":{"oneOf":[{"type":"string","description":"The page as training read it, in Markdown. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"# Pricing\n\nThe Pro plan is $20 a month.","uniqueKey":"link.content.oneOf.0","typeLabel":"string"},{"type":"null","description":"The page as training read it, in Markdown. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"# Pricing\n\nThe Pro plan is $20 a month.","uniqueKey":"link.content.oneOf.1","typeLabel":"null"}],"uniqueKey":"link.content","typeLabel":"string | null"}},"description":"Only for `link` sources.","uniqueKey":"link","typeLabel":"object"},"text":{"type":"object","required":["preview"],"properties":{"preview":{"type":"string","description":"The start of the text, without formatting, up to 200 characters.","isRequired":true,"uniqueKey":"text.preview","typeLabel":"string"},"content":{"type":"string","description":"The text, in Markdown. Not included in lists unless `include` has `content`.","uniqueKey":"text.content","typeLabel":"string"}},"description":"Only for `text` sources.","uniqueKey":"text","typeLabel":"object"},"faq":{"type":"object","required":["question","answer"],"properties":{"question":{"type":"string","example":"Do you ship internationally?","isRequired":true,"uniqueKey":"faq.question","typeLabel":"string"},"answer":{"type":"string","description":"In Markdown.","example":"Yes, to over **40 countries**.","isRequired":true,"uniqueKey":"faq.answer","typeLabel":"string"}},"description":"Only for `faq` sources.","uniqueKey":"faq","typeLabel":"object"},"document":{"type":"object","required":["filename","size","content_type"],"properties":{"filename":{"type":"string","example":"Handbook.pdf","isRequired":true,"uniqueKey":"document.filename","typeLabel":"string"},"size":{"oneOf":[{"type":"integer","description":"The size in bytes.","example":482133,"isRequired":true,"uniqueKey":"document.size.oneOf.0","typeLabel":"integer"},{"type":"null","description":"The size in bytes.","example":482133,"isRequired":true,"uniqueKey":"document.size.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"document.size","typeLabel":"integer | null"},"content_type":{"oneOf":[{"type":"string","example":"application/pdf","isRequired":true,"uniqueKey":"document.content_type.oneOf.0","typeLabel":"string"},{"type":"null","example":"application/pdf","isRequired":true,"uniqueKey":"document.content_type.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"document.content_type","typeLabel":"string | null"},"content":{"oneOf":[{"type":"string","description":"The text training extracted from the file, as plain text. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"Employee handbook\n\n1. Working hours\nOur office is open 9 to 5.","uniqueKey":"document.content.oneOf.0","typeLabel":"string"},{"type":"null","description":"The text training extracted from the file, as plain text. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"Employee handbook\n\n1. Working hours\nOur office is open 9 to 5.","uniqueKey":"document.content.oneOf.1","typeLabel":"null"}],"uniqueKey":"document.content","typeLabel":"string | null"}},"description":"Only for `document` sources.","uniqueKey":"document","typeLabel":"object"},"zoho":{"type":"object","description":"Only for `zoho` sources.","required":["title","url","auto_sync","next_sync_at"],"properties":{"title":{"oneOf":[{"type":"string","example":"Returns policy","isRequired":true,"uniqueKey":"zoho.title.oneOf.0","typeLabel":"string"},{"type":"null","example":"Returns policy","isRequired":true,"uniqueKey":"zoho.title.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"zoho.title","typeLabel":"string | null"},"url":{"oneOf":[{"type":"string","description":"Where the article or page is published, if known.","example":"https://support.example.com/hc/articles/360001","isRequired":true,"uniqueKey":"zoho.url.oneOf.0","typeLabel":"string"},{"type":"null","description":"Where the article or page is published, if known.","example":"https://support.example.com/hc/articles/360001","isRequired":true,"uniqueKey":"zoho.url.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"zoho.url","typeLabel":"string | null"},"auto_sync":{"type":"string","enum":["never","daily","weekly","monthly"],"description":"How often the source is fetched and retrained. Each option except `never` must be on the plan. Auto-syncs use resync credits.","isRequired":true,"uniqueKey":"zoho.auto_sync","typeLabel":"enum\u003cstring>"},"next_sync_at":{"oneOf":[{"type":"string","format":"date-time","description":"Time at which the source next syncs automatically, if scheduled.","isRequired":true,"uniqueKey":"zoho.next_sync_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","description":"Time at which the source next syncs automatically, if scheduled.","isRequired":true,"uniqueKey":"zoho.next_sync_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"zoho.next_sync_at","typeLabel":"string\u003cdate-time> | null"},"content":{"oneOf":[{"type":"string","description":"What training read. For Notion pages, the page in Markdown. Zoho Desk and Zendesk articles aren't kept after training, so theirs is always `null`. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"# Team handbook\n\nWelcome to the team.","uniqueKey":"zoho.content.oneOf.0","typeLabel":"string"},{"type":"null","description":"What training read. For Notion pages, the page in Markdown. Zoho Desk and Zendesk articles aren't kept after training, so theirs is always `null`. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"# Team handbook\n\nWelcome to the team.","uniqueKey":"zoho.content.oneOf.1","typeLabel":"null"}],"uniqueKey":"zoho.content","typeLabel":"string | null"}},"uniqueKey":"zoho","typeLabel":"object"},"zendesk":{"type":"object","description":"Only for `zendesk` sources.","required":["title","url","auto_sync","next_sync_at"],"properties":{"title":{"oneOf":[{"type":"string","example":"Returns policy","isRequired":true,"uniqueKey":"zendesk.title.oneOf.0","typeLabel":"string"},{"type":"null","example":"Returns policy","isRequired":true,"uniqueKey":"zendesk.title.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"zendesk.title","typeLabel":"string | null"},"url":{"oneOf":[{"type":"string","description":"Where the article or page is published, if known.","example":"https://support.example.com/hc/articles/360001","isRequired":true,"uniqueKey":"zendesk.url.oneOf.0","typeLabel":"string"},{"type":"null","description":"Where the article or page is published, if known.","example":"https://support.example.com/hc/articles/360001","isRequired":true,"uniqueKey":"zendesk.url.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"zendesk.url","typeLabel":"string | null"},"auto_sync":{"type":"string","enum":["never","daily","weekly","monthly"],"description":"How often the source is fetched and retrained. Each option except `never` must be on the plan. Auto-syncs use resync credits.","isRequired":true,"uniqueKey":"zendesk.auto_sync","typeLabel":"enum\u003cstring>"},"next_sync_at":{"oneOf":[{"type":"string","format":"date-time","description":"Time at which the source next syncs automatically, if scheduled.","isRequired":true,"uniqueKey":"zendesk.next_sync_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","description":"Time at which the source next syncs automatically, if scheduled.","isRequired":true,"uniqueKey":"zendesk.next_sync_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"zendesk.next_sync_at","typeLabel":"string\u003cdate-time> | null"},"content":{"oneOf":[{"type":"string","description":"What training read. For Notion pages, the page in Markdown. Zoho Desk and Zendesk articles aren't kept after training, so theirs is always `null`. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"# Team handbook\n\nWelcome to the team.","uniqueKey":"zendesk.content.oneOf.0","typeLabel":"string"},{"type":"null","description":"What training read. For Notion pages, the page in Markdown. Zoho Desk and Zendesk articles aren't kept after training, so theirs is always `null`. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"# Team handbook\n\nWelcome to the team.","uniqueKey":"zendesk.content.oneOf.1","typeLabel":"null"}],"uniqueKey":"zendesk.content","typeLabel":"string | null"}},"uniqueKey":"zendesk","typeLabel":"object"},"notion":{"type":"object","description":"Only for `notion` sources.","required":["title","url","auto_sync","next_sync_at"],"properties":{"title":{"oneOf":[{"type":"string","example":"Returns policy","isRequired":true,"uniqueKey":"notion.title.oneOf.0","typeLabel":"string"},{"type":"null","example":"Returns policy","isRequired":true,"uniqueKey":"notion.title.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"notion.title","typeLabel":"string | null"},"url":{"oneOf":[{"type":"string","description":"Where the article or page is published, if known.","example":"https://support.example.com/hc/articles/360001","isRequired":true,"uniqueKey":"notion.url.oneOf.0","typeLabel":"string"},{"type":"null","description":"Where the article or page is published, if known.","example":"https://support.example.com/hc/articles/360001","isRequired":true,"uniqueKey":"notion.url.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"notion.url","typeLabel":"string | null"},"auto_sync":{"type":"string","enum":["never","daily","weekly","monthly"],"description":"How often the source is fetched and retrained. Each option except `never` must be on the plan. Auto-syncs use resync credits.","isRequired":true,"uniqueKey":"notion.auto_sync","typeLabel":"enum\u003cstring>"},"next_sync_at":{"oneOf":[{"type":"string","format":"date-time","description":"Time at which the source next syncs automatically, if scheduled.","isRequired":true,"uniqueKey":"notion.next_sync_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","description":"Time at which the source next syncs automatically, if scheduled.","isRequired":true,"uniqueKey":"notion.next_sync_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"notion.next_sync_at","typeLabel":"string\u003cdate-time> | null"},"content":{"oneOf":[{"type":"string","description":"What training read. For Notion pages, the page in Markdown. Zoho Desk and Zendesk articles aren't kept after training, so theirs is always `null`. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"# Team handbook\n\nWelcome to the team.","uniqueKey":"notion.content.oneOf.0","typeLabel":"string"},{"type":"null","description":"What training read. For Notion pages, the page in Markdown. Zoho Desk and Zendesk articles aren't kept after training, so theirs is always `null`. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"# Team handbook\n\nWelcome to the team.","uniqueKey":"notion.content.oneOf.1","typeLabel":"null"}],"uniqueKey":"notion.content","typeLabel":"string | null"}},"uniqueKey":"notion","typeLabel":"object"},"sharepoint":{"type":"object","description":"Only for `sharepoint` sources.","required":["filename","path","url","size","content_type","auto_sync","next_sync_at"],"properties":{"filename":{"type":"string","example":"Onboarding.docx","isRequired":true,"uniqueKey":"sharepoint.filename","typeLabel":"string"},"path":{"oneOf":[{"type":"string","description":"The file's folder in its drive.","example":"/Shared Documents/HR","isRequired":true,"uniqueKey":"sharepoint.path.oneOf.0","typeLabel":"string"},{"type":"null","description":"The file's folder in its drive.","example":"/Shared Documents/HR","isRequired":true,"uniqueKey":"sharepoint.path.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"sharepoint.path","typeLabel":"string | null"},"url":{"oneOf":[{"type":"string","description":"The file's URL in SharePoint.","example":"https://example.sharepoint.com/sites/hr/Shared%20Documents/HR/Onboarding.docx","isRequired":true,"uniqueKey":"sharepoint.url.oneOf.0","typeLabel":"string"},{"type":"null","description":"The file's URL in SharePoint.","example":"https://example.sharepoint.com/sites/hr/Shared%20Documents/HR/Onboarding.docx","isRequired":true,"uniqueKey":"sharepoint.url.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"sharepoint.url","typeLabel":"string | null"},"size":{"oneOf":[{"type":"integer","description":"The size in bytes.","example":58211,"isRequired":true,"uniqueKey":"sharepoint.size.oneOf.0","typeLabel":"integer"},{"type":"null","description":"The size in bytes.","example":58211,"isRequired":true,"uniqueKey":"sharepoint.size.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"sharepoint.size","typeLabel":"integer | null"},"content_type":{"oneOf":[{"type":"string","example":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","isRequired":true,"uniqueKey":"sharepoint.content_type.oneOf.0","typeLabel":"string"},{"type":"null","example":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","isRequired":true,"uniqueKey":"sharepoint.content_type.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"sharepoint.content_type","typeLabel":"string | null"},"auto_sync":{"type":"string","enum":["never","daily","weekly","monthly"],"description":"How often the source is fetched and retrained. Each option except `never` must be on the plan. Auto-syncs use resync credits.","isRequired":true,"uniqueKey":"sharepoint.auto_sync","typeLabel":"enum\u003cstring>"},"next_sync_at":{"oneOf":[{"type":"string","format":"date-time","description":"Time at which the file next syncs automatically, if scheduled.","isRequired":true,"uniqueKey":"sharepoint.next_sync_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","description":"Time at which the file next syncs automatically, if scheduled.","isRequired":true,"uniqueKey":"sharepoint.next_sync_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"sharepoint.next_sync_at","typeLabel":"string\u003cdate-time> | null"},"content":{"oneOf":[{"type":"string","description":"The text training extracted from the file, as plain text. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"Onboarding\n\nYour first week.","uniqueKey":"sharepoint.content.oneOf.0","typeLabel":"string"},{"type":"null","description":"The text training extracted from the file, as plain text. `null` until the source is trained, and briefly while it retrains. Only returned when retrieving a source, not in lists.","example":"Onboarding\n\nYour first week.","uniqueKey":"sharepoint.content.oneOf.1","typeLabel":"null"}],"uniqueKey":"sharepoint.content","typeLabel":"string | null"}},"uniqueKey":"sharepoint","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"object":"knowledge_base_source","id":"0d1f6a3e-5b2c-4e8f-9a7d-3c6b1e2f4a5d","agent":{"id":"3132353852","type":"ai_agent","name":"Support agent"},"type":"link","status":"pending","error":"\u003cstring>","characters":123,"resync_pending":true,"last_synced_at":"2023-11-07T05:31:56Z","created_at":"2023-11-07T05:31:56Z","updated_at":"2023-11-07T05:31:56Z","link":{"url":"https://example.com/pricing","title":"Pricing","auto_sync":"never","next_sync_at":"2023-11-07T05:31:56Z","exclude_classes":["\u003cstring>"],"exclude_ids":["\u003cstring>"],"content":"# Pricing\n\nThe Pro plan is $20 a month."},"text":{"preview":"\u003cstring>","content":"\u003cstring>"},"faq":{"question":"Do you ship internationally?","answer":"Yes, to over **40 countries**."},"document":{"filename":"Handbook.pdf","size":482133,"content_type":"application/pdf","content":"Employee handbook\n\n1. Working hours\nOur office is open 9 to 5."},"zoho":{"title":"Returns policy","url":"https://support.example.com/hc/articles/360001","auto_sync":"never","next_sync_at":"2023-11-07T05:31:56Z","content":"# Team handbook\n\nWelcome to the team."},"zendesk":{"title":"Returns policy","url":"https://support.example.com/hc/articles/360001","auto_sync":"never","next_sync_at":"2023-11-07T05:31:56Z","content":"# Team handbook\n\nWelcome to the team."},"notion":{"title":"Returns policy","url":"https://support.example.com/hc/articles/360001","auto_sync":"never","next_sync_at":"2023-11-07T05:31:56Z","content":"# Team handbook\n\nWelcome to the team."},"sharepoint":{"filename":"Onboarding.docx","path":"/Shared Documents/HR","url":"https://example.sharepoint.com/sites/hr/Shared%20Documents/HR/Onboarding.docx","size":58211,"content_type":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","auto_sync":"never","next_sync_at":"2023-11-07T05:31:56Z","content":"Onboarding\n\nYour first week."}}}},"exampleType":"generated"}},"exampleType":"generated"},"dbd648ef-ef3d-4fcd-9eeb-74acabeeb65c":{"description":"- `invalid_json`: The body isn't a JSON object or array.\n- `invalid_idempotency_key`: The `Idempotency-Key` header is invalid.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","code","message","param","request_id"],"properties":{"type":{"type":"string","enum":["authentication_error","permission_error","not_found_error","invalid_request_error","idempotency_error","rate_limit_error","api_error"],"description":"The type of error returned.","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"type":"string","description":"A short string identifying the error. Codes are stable, so handle errors by `code`. New codes may be added.","examples":["validation_failed","insufficient_permission","resource_not_found"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message with more details about the error. The wording can change, so don't parse it.","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.param","typeLabel":"string | null"},"request_id":{"type":"string","description":"The ID of the request, also returned in the `X-Request-Id` header. Include it when you contact support.","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"errors":{"type":"array","description":"For `validation_failed` only: every invalid parameter. The top-level `param` and `message` match the first entry.","items":{"type":"object","required":["param","message"],"properties":{"param":{"type":"string","description":"The invalid parameter, in dot notation for nested fields.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].param","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message about the problem. The wording can change.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].message","typeLabel":"string"}},"uniqueKey":"error.errors.items.[INDEX]","typeLabel":"object"},"uniqueKey":"error.errors","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"validation_failed","message":"\u003cstring>","param":"\u003cstring>","request_id":"\u003cstring>","errors":[{"param":"\u003cstring>","message":"\u003cstring>"}]}}}},"exampleType":"generated"}},"exampleType":"generated"},"9850d44a-665e-4747-a0fb-266f55ab5ca2":{"description":"`missing_api_key`, `invalid_api_key`, or `api_key_expired`.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","code","message","param","request_id"],"properties":{"type":{"type":"string","enum":["authentication_error","permission_error","not_found_error","invalid_request_error","idempotency_error","rate_limit_error","api_error"],"description":"The type of error returned.","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"type":"string","description":"A short string identifying the error. Codes are stable, so handle errors by `code`. New codes may be added.","examples":["validation_failed","insufficient_permission","resource_not_found"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message with more details about the error. The wording can change, so don't parse it.","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.param","typeLabel":"string | null"},"request_id":{"type":"string","description":"The ID of the request, also returned in the `X-Request-Id` header. Include it when you contact support.","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"errors":{"type":"array","description":"For `validation_failed` only: every invalid parameter. The top-level `param` and `message` match the first entry.","items":{"type":"object","required":["param","message"],"properties":{"param":{"type":"string","description":"The invalid parameter, in dot notation for nested fields.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].param","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message about the problem. The wording can change.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].message","typeLabel":"string"}},"uniqueKey":"error.errors.items.[INDEX]","typeLabel":"object"},"uniqueKey":"error.errors","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"error":{"type":"authentication_error","code":"invalid_api_key","message":"The API key is invalid or has been revoked.","param":null,"request_id":"req_8Fq2kLm9TzX4vB7nC1dR5sYw"}},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"invalid_api_key","message":"The API key is invalid or has been revoked.","param":null,"request_id":"req_8Fq2kLm9TzX4vB7nC1dR5sYw"}}}},"exampleType":"examples"}},"exampleType":"examples"},"a2396bde-e9a9-4617-8073-3cc5fa7baea0":{"description":"`insufficient_permission`, `agent_suspended`, `project_suspended`, `plan_feature_unavailable`, or `knowledge_base_limit_reached`. `plan_feature_unavailable` means the plan doesn't include API access or the chosen auto-sync, and `param` names the field. `knowledge_base_limit_reached` means the sources have more characters than the plan has left. A URL or document only needs some characters left, because its size is known once it trains.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","code","message","param","request_id"],"properties":{"type":{"type":"string","enum":["authentication_error","permission_error","not_found_error","invalid_request_error","idempotency_error","rate_limit_error","api_error"],"description":"The type of error returned.","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"type":"string","description":"A short string identifying the error. Codes are stable, so handle errors by `code`. New codes may be added.","examples":["validation_failed","insufficient_permission","resource_not_found"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message with more details about the error. The wording can change, so don't parse it.","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.param","typeLabel":"string | null"},"request_id":{"type":"string","description":"The ID of the request, also returned in the `X-Request-Id` header. Include it when you contact support.","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"errors":{"type":"array","description":"For `validation_failed` only: every invalid parameter. The top-level `param` and `message` match the first entry.","items":{"type":"object","required":["param","message"],"properties":{"param":{"type":"string","description":"The invalid parameter, in dot notation for nested fields.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].param","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message about the problem. The wording can change.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].message","typeLabel":"string"}},"uniqueKey":"error.errors.items.[INDEX]","typeLabel":"object"},"uniqueKey":"error.errors","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"error":{"type":"permission_error","code":"insufficient_permission","message":"This API key doesn't have create access to knowledge_base.","param":null,"request_id":"req_8Fq2kLm9TzX4vB7nC1dR5sYw"}},"examples":{"Example":{"title":"Example","value":{"error":{"type":"permission_error","code":"insufficient_permission","message":"This API key doesn't have create access to knowledge_base.","param":null,"request_id":"req_8Fq2kLm9TzX4vB7nC1dR5sYw"}}}},"exampleType":"examples"}},"exampleType":"examples"},"c37639fa-46f4-456b-8ba1-37fcd15d1676":{"description":"`resource_not_found`: No agent with this ID exists in the project, or the key can't access it.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","code","message","param","request_id"],"properties":{"type":{"type":"string","enum":["authentication_error","permission_error","not_found_error","invalid_request_error","idempotency_error","rate_limit_error","api_error"],"description":"The type of error returned.","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"type":"string","description":"A short string identifying the error. Codes are stable, so handle errors by `code`. New codes may be added.","examples":["validation_failed","insufficient_permission","resource_not_found"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message with more details about the error. The wording can change, so don't parse it.","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.param","typeLabel":"string | null"},"request_id":{"type":"string","description":"The ID of the request, also returned in the `X-Request-Id` header. Include it when you contact support.","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"errors":{"type":"array","description":"For `validation_failed` only: every invalid parameter. The top-level `param` and `message` match the first entry.","items":{"type":"object","required":["param","message"],"properties":{"param":{"type":"string","description":"The invalid parameter, in dot notation for nested fields.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].param","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message about the problem. The wording can change.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].message","typeLabel":"string"}},"uniqueKey":"error.errors.items.[INDEX]","typeLabel":"object"},"uniqueKey":"error.errors","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"error":{"type":"not_found_error","code":"resource_not_found","message":"No agent with this ID exists, or this API key can't access it.","param":null,"request_id":"req_8Fq2kLm9TzX4vB7nC1dR5sYw"}},"examples":{"Example":{"title":"Example","value":{"error":{"type":"not_found_error","code":"resource_not_found","message":"No agent with this ID exists, or this API key can't access it.","param":null,"request_id":"req_8Fq2kLm9TzX4vB7nC1dR5sYw"}}}},"exampleType":"examples"}},"exampleType":"examples"},"a2d3dc0a-62e9-476b-b24b-fb72585d67a1":{"description":"- `knowledge_base_linked`: The agent uses another agent's knowledge base and has no sources of its own.\n- `source_already_exists`: The knowledge base already has this URL. The message includes the existing source.\n- `upload_already_used`: A source was already added from this upload.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","code","message","param","request_id"],"properties":{"type":{"type":"string","enum":["authentication_error","permission_error","not_found_error","invalid_request_error","idempotency_error","rate_limit_error","api_error"],"description":"The type of error returned.","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"type":"string","description":"A short string identifying the error. Codes are stable, so handle errors by `code`. New codes may be added.","examples":["validation_failed","insufficient_permission","resource_not_found"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message with more details about the error. The wording can change, so don't parse it.","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.param","typeLabel":"string | null"},"request_id":{"type":"string","description":"The ID of the request, also returned in the `X-Request-Id` header. Include it when you contact support.","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"errors":{"type":"array","description":"For `validation_failed` only: every invalid parameter. The top-level `param` and `message` match the first entry.","items":{"type":"object","required":["param","message"],"properties":{"param":{"type":"string","description":"The invalid parameter, in dot notation for nested fields.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].param","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message about the problem. The wording can change.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].message","typeLabel":"string"}},"uniqueKey":"error.errors.items.[INDEX]","typeLabel":"object"},"uniqueKey":"error.errors","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"error":{"type":"invalid_request_error","code":"source_already_exists","message":"This agent's knowledge base already has this URL, as source 0d1f6a3e-5b2c-4e8f-9a7d-3c6b1e2f4a5d.","param":"link.url","request_id":"req_8Fq2kLm9TzX4vB7nC1dR5sYw"}},"examples":{"Example":{"title":"Example","value":{"error":{"type":"invalid_request_error","code":"source_already_exists","message":"This agent's knowledge base already has this URL, as source 0d1f6a3e-5b2c-4e8f-9a7d-3c6b1e2f4a5d.","param":"link.url","request_id":"req_8Fq2kLm9TzX4vB7nC1dR5sYw"}}}},"exampleType":"examples"}},"exampleType":"examples"},"42ca0c0d-e0af-4fd8-a209-6b37f74bd073":{"description":"`validation_failed`, or `idempotency_key_reused` if the `Idempotency-Key` was already used for a different request.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","code","message","param","request_id"],"properties":{"type":{"type":"string","enum":["authentication_error","permission_error","not_found_error","invalid_request_error","idempotency_error","rate_limit_error","api_error"],"description":"The type of error returned.","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"type":"string","description":"A short string identifying the error. Codes are stable, so handle errors by `code`. New codes may be added.","examples":["validation_failed","insufficient_permission","resource_not_found"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message with more details about the error. The wording can change, so don't parse it.","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.param","typeLabel":"string | null"},"request_id":{"type":"string","description":"The ID of the request, also returned in the `X-Request-Id` header. Include it when you contact support.","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"errors":{"type":"array","description":"For `validation_failed` only: every invalid parameter. The top-level `param` and `message` match the first entry.","items":{"type":"object","required":["param","message"],"properties":{"param":{"type":"string","description":"The invalid parameter, in dot notation for nested fields.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].param","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message about the problem. The wording can change.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].message","typeLabel":"string"}},"uniqueKey":"error.errors.items.[INDEX]","typeLabel":"object"},"uniqueKey":"error.errors","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"validation_failed","message":"\u003cstring>","param":"\u003cstring>","request_id":"\u003cstring>","errors":[{"param":"\u003cstring>","message":"\u003cstring>"}]}}}},"exampleType":"generated"}},"exampleType":"generated"},"47943f1b-050b-4c6c-a29c-ecfa755fad5f":{"description":"`rate_limit_exceeded`.","headers":{"Retry-After":{"description":"The number of seconds to wait before retrying.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","code","message","param","request_id"],"properties":{"type":{"type":"string","enum":["authentication_error","permission_error","not_found_error","invalid_request_error","idempotency_error","rate_limit_error","api_error"],"description":"The type of error returned.","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"type":"string","description":"A short string identifying the error. Codes are stable, so handle errors by `code`. New codes may be added.","examples":["validation_failed","insufficient_permission","resource_not_found"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message with more details about the error. The wording can change, so don't parse it.","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"If the error is parameter-specific, the parameter related to the error, in dot notation for nested fields, such as `member_ids.1`. For `validation_failed`, the first entry of `errors`.","isRequired":true,"uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.param","typeLabel":"string | null"},"request_id":{"type":"string","description":"The ID of the request, also returned in the `X-Request-Id` header. Include it when you contact support.","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"errors":{"type":"array","description":"For `validation_failed` only: every invalid parameter. The top-level `param` and `message` match the first entry.","items":{"type":"object","required":["param","message"],"properties":{"param":{"type":"string","description":"The invalid parameter, in dot notation for nested fields.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].param","typeLabel":"string"},"message":{"type":"string","description":"A human-readable message about the problem. The wording can change.","isRequired":true,"uniqueKey":"error.errors.items.[INDEX].message","typeLabel":"string"}},"uniqueKey":"error.errors.items.[INDEX]","typeLabel":"object"},"uniqueKey":"error.errors","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"authentication_error","code":"validation_failed","message":"\u003cstring>","param":"\u003cstring>","request_id":"\u003cstring>","errors":[{"param":"\u003cstring>","message":"\u003cstring>"}]}}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"8529c987-60c7-4138-9cff-c6fa1c1f2729":{"apiKey":{"type":"http","scheme":"bearer","description":"A project API key, created in the dashboard.","scopes":[],"schemeName":"apiKey"}}},"servers":{"16086fde-3c32-456e-b395-21dafcd77092":{"url":"https://api.chatling.ai/v3"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","description":"A project API key, created in the dashboard.","scopes":[],"schemeName":"apiKey"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"A project API key, created in the dashboard.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"apiKey","name":"Authorization"}],"title":"apiKey"}]},"originalFileLocation":"api-reference/v3/openapi.json"},"subdomain":"chatling-21192973","siteName":"Chatling Documentation","title":"Add a knowledge base source - Chatling Documentation","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-30T03:59:48.407Z","originalFileLocation":"api-reference/v3/knowledge-base/create-knowledge-base-source.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Adds a link, text, FAQ, or uploaded document to an agent\u0026#x27;s knowledge base. To add a document, first upload the file as described in Create a document upload. The source trains in the background. Retrieve it to check its status. To add many sources at once, use Add knowledge base sources in bulk.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Chatling Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/chatling-21192973/I8bfejheDKLkYdJT/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/chatling-21192973/I8bfejheDKLkYdJT/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/chatling-21192973/I8bfejheDKLkYdJT/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/chatling-21192973/I8bfejheDKLkYdJT/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/chatling-21192973/I8bfejheDKLkYdJT/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/chatling-21192973/I8bfejheDKLkYdJT/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/chatling-21192973/I8bfejheDKLkYdJT/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/chatling-21192973/I8bfejheDKLkYdJT/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/chatling-21192973/I8bfejheDKLkYdJT/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Add a knowledge base source - Chatling Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Adds a link, text, FAQ, or uploaded document to an agent\u0026#x27;s knowledge base. To add a document, first upload the file as described in Create a document upload. The source trains in the background. Retrieve it to check its status. To add many sources at once, use Add knowledge base sources in bulk.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Chatling Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.chatling.ai/api-reference/v3/knowledge-base/create-knowledge-base-source\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://chatling-21192973.mintlify.site/_mintlify/api/og/v2?division=Knowledge+base\u0026amp;title=Add+a+knowledge+base+source\u0026amp;description=Adds+a+link%2C+text%2C+FAQ%2C+or+uploaded+document+to+an+agent%27s+knowledge+base.+To+add+a+document%2C+first+upload+the+file+as+described+in+%5BCreate+a+document+upload%5D%28%2F\u0026amp;theme=ab88d30c4ba459aae5018e6e\u0026amp;signature=914dc19214c37bb41504de45388c6123474feb3ef5a6cad860ade223c4186297\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Add a knowledge base source - Chatling Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Adds a link, text, FAQ, or uploaded document to an agent\u0026#x27;s knowledge base. To add a document, first upload the file as described in Create a document upload. The source trains in the background. Retrieve it to check its status. To add many sources at once, use Add knowledge base sources in bulk.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://chatling-21192973.mintlify.site/_mintlify/api/og/v2?division=Knowledge+base\u0026amp;title=Add+a+knowledge+base+source\u0026amp;description=Adds+a+link%2C+text%2C+FAQ%2C+or+uploaded+document+to+an+agent%27s+knowledge+base.+To+add+a+document%2C+first+upload+the+file+as+described+in+%5BCreate+a+document+upload%5D%28%2F\u0026amp;theme=ab88d30c4ba459aae5018e6e\u0026amp;signature=914dc19214c37bb41504de45388c6123474feb3ef5a6cad860ade223c4186297\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/chatling-21192973/I8bfejheDKLkYdJT/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Chatling Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D9373\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.chatling.ai/api-reference/v3/knowledge-base/create-knowledge-base-source\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/v3/knowledge-base/create-knowledge-base-source.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.chatling.ai/#organization\",\"name\":\"Chatling Documentation\",\"url\":\"https://docs.chatling.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/chatling-21192973/28-2rxbvH5ywRTMu/logo/chatling-logo.svg?fit=max\u0026auto=format\u0026n=28-2rxbvH5ywRTMu\u0026q=85\u0026s=b2dff50e5e554f9a1821ad6c4e86b8cd\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.chatling.ai#website\",\"name\":\"Chatling Documentation\",\"url\":\"https://docs.chatling.ai\",\"publisher\":{\"@id\":\"https://docs.chatling.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.chatling.ai/api-reference/v3/knowledge-base/create-knowledge-base-source#webpage\",\"url\":\"https://docs.chatling.ai/api-reference/v3/knowledge-base/create-knowledge-base-source\",\"name\":\"Add a knowledge base source\",\"description\":\"Adds a link, text, FAQ, or uploaded document to an agent's knowledge base. To add a document, first upload the file as described in Create a document upload. The source trains in the background. Retrieve it to check its status. To add many sources at once, use Add knowledge base sources in bulk.\",\"dateModified\":\"2026-11-30T03:59:48.407Z\",\"isPartOf\":{\"@id\":\"https://docs.chatling.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.chatling.ai/api-reference/v3/knowledge-base/create-knowledge-base-source#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.chatling.ai/api-reference/v3/knowledge-base/create-knowledge-base-source#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Reference\",\"item\":\"https://docs.chatling.ai/api-reference/v3/api-key/get-current-api-key\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Knowledge base\",\"item\":\"https://docs.chatling.ai/api-reference/v3/knowledge-base/get-knowledge-base-summary\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Add a knowledge base source\",\"item\":\"https://docs.chatling.ai/api-reference/v3/knowledge-base/create-knowledge-base-source\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.chatling.ai/api-reference/v3/knowledge-base/create-knowledge-base-source#apireference\",\"headline\":\"Add a knowledge base source\",\"name\":\"Add a knowledge base source\",\"description\":\"Adds a link, text, FAQ, or uploaded document to an agent's knowledge base. To add a document, first upload the file as described in Create a document upload. The source trains in the background. Retrieve it to check its status. To add many sources at once, use Add knowledge base sources in bulk.\",\"url\":\"https://docs.chatling.ai/api-reference/v3/knowledge-base/create-knowledge-base-source\",\"mainEntityOfPage\":{\"@id\":\"https://docs.chatling.ai/api-reference/v3/knowledge-base/create-knowledge-base-source#webpage\"},\"dateModified\":\"2026-11-30T03:59:48.407Z\",\"publisher\":{\"@id\":\"https://docs.chatling.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.chatling.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Chatling Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Chatling Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/v3/knowledge-base/create-knowledge-base-source.md","siteName":"Chatling Documentation","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/introduction"}]},{"tab":"API Reference","groups":[{"group":"Get started","pages":[{"title":"Introduction","sidebarTitle":"Introduction","href":"/api-reference/v3/introduction"},{"title":"Authentication","href":"/api-reference/v3/authentication"},{"title":"Errors","href":"/api-reference/v3/errors"},{"title":"Pagination","href":"/api-reference/v3/pagination"},{"title":"MCP server","href":"/api-reference/v3/mcp"}]},{"group":"Reference","pages":[{"group":"API key","pages":[{"title":"Retrieve the current API key","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /me","href":"/api-reference/v3/api-key/get-current-api-key"}]},{"group":"Project","pages":[{"title":"Retrieve the project","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /project","href":"/api-reference/v3/project/get-project"},{"title":"Update the project","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /project","href":"/api-reference/v3/project/update-project"},{"title":"Retrieve usage","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /usage","href":"/api-reference/v3/project/get-usage"}]},{"group":"Members","pages":[{"title":"List members","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /members","href":"/api-reference/v3/members/list-members"}]},{"group":"AI models","pages":[{"title":"List AI models","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /models","href":"/api-reference/v3/ai-models/list-models"}]},{"group":"Agents","pages":[{"title":"List AI agents","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /agents","href":"/api-reference/v3/agents/list-agents"},{"title":"Create an AI agent","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /agents","href":"/api-reference/v3/agents/create-agent"},{"title":"Retrieve an AI agent","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /agents/{agent}","href":"/api-reference/v3/agents/get-agent"},{"title":"Delete an AI agent","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /agents/{agent}","href":"/api-reference/v3/agents/delete-agent"},{"title":"Update an AI agent","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /agents/{agent}","href":"/api-reference/v3/agents/update-agent"},{"title":"Duplicate an AI agent","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /agents/{agent}/duplicate","href":"/api-reference/v3/agents/duplicate-agent"}]},{"group":"Chatbots","pages":[{"title":"List chatbots","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /chatbots","href":"/api-reference/v3/chatbots/list-chatbots"},{"title":"Create a chatbot","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /chatbots","href":"/api-reference/v3/chatbots/create-chatbot"},{"title":"List chatbot templates","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /chatbots/templates","href":"/api-reference/v3/chatbots/list-chatbot-templates"},{"title":"Retrieve a chatbot","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /chatbots/{chatbot}","href":"/api-reference/v3/chatbots/get-chatbot"},{"title":"Delete a chatbot","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /chatbots/{chatbot}","href":"/api-reference/v3/chatbots/delete-chatbot"},{"title":"Update a chatbot","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /chatbots/{chatbot}","href":"/api-reference/v3/chatbots/update-chatbot"},{"title":"Duplicate a chatbot","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /chatbots/{chatbot}/duplicate","href":"/api-reference/v3/chatbots/duplicate-chatbot"}]},{"group":"Analytics","pages":[{"title":"Get the analytics overview","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /analytics/overview","href":"/api-reference/v3/analytics/get-analytics-overview"},{"title":"List countries","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /analytics/countries","href":"/api-reference/v3/analytics/list-analytics-countries"},{"title":"List channels","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /analytics/channels","href":"/api-reference/v3/analytics/list-analytics-channels"},{"title":"List pages","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /analytics/pages","href":"/api-reference/v3/analytics/list-analytics-pages"},{"title":"List topics by conversations","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /analytics/topics","href":"/api-reference/v3/analytics/list-analytics-topics"},{"title":"List busiest hours","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /analytics/hours","href":"/api-reference/v3/analytics/list-analytics-hours"}]},{"group":"Channels","pages":[{"title":"List channels","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /channels","href":"/api-reference/v3/channels/list-channels"},{"title":"Update a channel's settings","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /channels/{channel}","href":"/api-reference/v3/channels/update-channel"}]},{"group":"WhatsApp","pages":[{"title":"List WhatsApp templates","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /whatsapp/templates","href":"/api-reference/v3/whatsapp/list-whatsapp-templates"},{"title":"Refresh WhatsApp templates","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /whatsapp/templates/refresh","href":"/api-reference/v3/whatsapp/refresh-whatsapp-templates"},{"title":"Retrieve a WhatsApp template","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /whatsapp/templates/{template}","href":"/api-reference/v3/whatsapp/get-whatsapp-template"},{"title":"Delete a WhatsApp template","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /whatsapp/templates/{template}","href":"/api-reference/v3/whatsapp/delete-whatsapp-template"},{"title":"Send a WhatsApp template","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /whatsapp/messages","href":"/api-reference/v3/whatsapp/send-whatsapp-template"}]},{"group":"Conversations","pages":[{"title":"List conversations","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /conversations","href":"/api-reference/v3/conversations/list-conversations"},{"title":"Start a conversation","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /conversations","href":"/api-reference/v3/conversations/start-conversation"},{"title":"Retrieve a conversation","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /conversations/{conversation}","href":"/api-reference/v3/conversations/get-conversation"},{"title":"Delete a conversation","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /conversations/{conversation}","href":"/api-reference/v3/conversations/delete-conversation"},{"title":"Update a conversation","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /conversations/{conversation}","href":"/api-reference/v3/conversations/update-conversation"},{"title":"Retrieve a conversation's usage","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /conversations/{conversation}/usage","href":"/api-reference/v3/conversations/get-conversation-usage"},{"title":"List the messages of a conversation","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /conversations/{conversation}/messages","href":"/api-reference/v3/conversations/list-conversation-messages"},{"title":"Send a user message","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /conversations/{conversation}/messages","href":"/api-reference/v3/conversations/send-user-message"},{"title":"Update a message","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /conversations/{conversation}/messages/{message}","href":"/api-reference/v3/conversations/update-message"},{"title":"Send a reply","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /conversations/{conversation}/replies","href":"/api-reference/v3/conversations/send-reply"},{"title":"Add a note","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /conversations/{conversation}/notes","href":"/api-reference/v3/conversations/send-note"},{"title":"End a conversation","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /conversations/{conversation}/end","href":"/api-reference/v3/conversations/end-conversation"},{"title":"Upload an attachment","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /conversations/{conversation}/attachments","href":"/api-reference/v3/conversations/upload-attachment"},{"title":"Delete an attachment","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /conversations/{conversation}/attachments/{attachment}","href":"/api-reference/v3/conversations/delete-attachment"},{"title":"Download a message attachment","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /conversations/{conversation}/messages/{message}/attachments/{attachment}","href":"/api-reference/v3/conversations/download-message-attachment"}]},{"group":"Contacts","pages":[{"title":"List contacts","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /contacts","href":"/api-reference/v3/contacts/list-contacts"},{"title":"Create a contact","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /contacts","href":"/api-reference/v3/contacts/create-contact"},{"title":"Retrieve a contact","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /contacts/{contact}","href":"/api-reference/v3/contacts/get-contact"},{"title":"Delete a contact","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /contacts/{contact}","href":"/api-reference/v3/contacts/delete-contact"},{"title":"Update a contact","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /contacts/{contact}","href":"/api-reference/v3/contacts/update-contact"}]},{"group":"Knowledge base","pages":[{"title":"Get a knowledge base summary","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /knowledge-base/summary","href":"/api-reference/v3/knowledge-base/get-knowledge-base-summary"},{"title":"List knowledge base sources","description":"Returns a list of an agent's sources, newest first, including sources added through a connection. A text source's `content` is only included if `include` has `content`, which limits a page to 10 sources. Other types' trained content is only returned by [Retrieve a knowledge base source](/api-reference/v3/knowledge-base/get-knowledge-base-source).","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /knowledge-base/sources","href":"/api-reference/v3/knowledge-base/list-knowledge-base-sources"},{"title":"Add a knowledge base source","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /knowledge-base/sources","href":"/api-reference/v3/knowledge-base/create-knowledge-base-source"},{"title":"Create a document upload","description":"Adding a document to a knowledge base takes three requests: create an upload with this endpoint, upload the file to the storage URL it returns, then add the document as a source. The file goes straight to storage, so the API's request size limit doesn't apply.\n\n### 1. Create an upload\n\nPass the file's name, with its extension, and its exact size in bytes.\n\n```bash\ncurl https://api.chatling.ai/v3/knowledge-base/uploads \\\n -H \"Authorization: Bearer $CHATLING_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"agent_id\": \"3132353852\", \"filename\": \"Handbook.pdf\", \"size\": 482133}'\n```\n\nThe response includes the upload's `id` and a signed form in `upload`:\n\n```json\n{\n \"object\": \"knowledge_base_upload\",\n \"id\": \"9b2e7c41-8d3a-4f6e-a1b5-2c7d9e0f3a64\",\n \"filename\": \"Handbook.pdf\",\n \"size\": 482133,\n \"content_type\": \"application/pdf\",\n \"upload\": {\n \"method\": \"POST\",\n \"url\": \"https://chatling-documents-data-source.s3.us-east-2.amazonaws.com\",\n \"fields\": {\n \"key\": \"9b2e7c41-8d3a-4f6e-a1b5-2c7d9e0f3a64.pdf\",\n \"Content-Type\": \"application/pdf\",\n \"X-Amz-Credential\": \"…\",\n \"X-Amz-Algorithm\": \"AWS4-HMAC-SHA256\",\n \"X-Amz-Date\": \"20261123T101500Z\",\n \"Policy\": \"…\",\n \"X-Amz-Signature\": \"…\"\n }\n },\n \"expires_at\": \"2026-11-23T10:20:00Z\"\n}\n```\n\n### 2. Upload the file\n\nBefore `expires_at` (5 minutes after you create the upload), send a `multipart/form-data` POST to `upload.url`. Include every field in `upload.fields` unchanged, then the file as the last field, named `file`. Don't send your API key to this URL. A successful upload returns `204 No Content`.\n\n```bash\ncurl -i -X POST \"https://chatling-documents-data-source.s3.us-east-2.amazonaws.com\" \\\n -F \"key=9b2e7c41-8d3a-4f6e-a1b5-2c7d9e0f3a64.pdf\" \\\n -F \"Content-Type=application/pdf\" \\\n -F \"X-Amz-Credential=…\" \\\n -F \"X-Amz-Algorithm=AWS4-HMAC-SHA256\" \\\n -F \"X-Amz-Date=20261123T101500Z\" \\\n -F \"Policy=…\" \\\n -F \"X-Amz-Signature=…\" \\\n -F \"[email protected]\"\n```\n\nIn JavaScript (Node.js 18 or later), where `upload` is the response from step 1:\n\n```javascript\nimport { readFile } from \"node:fs/promises\";\n\nconst form = new FormData();\nfor (const [name, value] of Object.entries(upload.upload.fields)) {\n form.append(name, value);\n}\nconst file = await readFile(\"Handbook.pdf\");\nform.append(\"file\", new Blob([file], { type: upload.content_type }), upload.filename);\n\nconst response = await fetch(upload.upload.url, { method: \"POST\", body: form });\nif (response.status !== 204) {\n throw new Error(await response.text());\n}\n```\n\nIn Python, with `requests`:\n\n```python\nimport requests\n\nwith open(\"Handbook.pdf\", \"rb\") as file:\n response = requests.post(\n upload[\"upload\"][\"url\"],\n data=upload[\"upload\"][\"fields\"],\n files={\"file\": (upload[\"filename\"], file, upload[\"content_type\"])},\n )\nif response.status_code != 204:\n raise RuntimeError(response.text)\n```\n\nStorage returns errors as XML. `EntityTooLarge` or `EntityTooSmall` means the file doesn't match the `size` from step 1. `AccessDenied` with \"Policy expired\" means the upload expired. In either case, create a new upload and try again.\n\n### 3. Add the document\n\nWithin 24 hours of creating the upload, add a source with `type: document` and the upload's `id`:\n\n```bash\ncurl https://api.chatling.ai/v3/knowledge-base/sources \\\n -H \"Authorization: Bearer $CHATLING_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"agent_id\": \"3132353852\", \"type\": \"document\", \"document\": {\"upload_id\": \"9b2e7c41-8d3a-4f6e-a1b5-2c7d9e0f3a64\"}}'\n```\n\nThe source starts as `pending` and trains in the background. [Retrieve it](/api-reference/v3/knowledge-base/get-knowledge-base-source) until its `status` is `processed`, when the agent can use it, or `failed`, with the reason in `error`. To add several documents, create one upload per file, then add them together with [Add knowledge base sources in bulk](/api-reference/v3/knowledge-base/create-knowledge-base-sources).\n\n### Limits\n\n- PDF, TXT, DOC, and DOCX files, up to the plan's document size limit.\n- Up to 5 million characters per document, within the plan's remaining knowledge base characters. Both limits are checked when the document trains, and a document over either limit fails.\n- 30 uploads per minute per project.\n- Each upload adds one source. To add the same file again, create a new upload.\n- Documents can't be updated or resynced. Delete the source and add the new file instead.","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /knowledge-base/uploads","href":"/api-reference/v3/knowledge-base/create-knowledge-base-upload"},{"title":"Add knowledge base sources in bulk","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /knowledge-base/sources/batch","href":"/api-reference/v3/knowledge-base/create-knowledge-base-sources"},{"title":"Retrieve a knowledge base source","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /knowledge-base/sources/{source}","href":"/api-reference/v3/knowledge-base/get-knowledge-base-source"},{"title":"Delete a knowledge base source","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /knowledge-base/sources/{source}","href":"/api-reference/v3/knowledge-base/delete-knowledge-base-source"},{"title":"Update a knowledge base source","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /knowledge-base/sources/{source}","href":"/api-reference/v3/knowledge-base/update-knowledge-base-source"},{"title":"Delete knowledge base sources in bulk","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /knowledge-base/sources/batch-delete","href":"/api-reference/v3/knowledge-base/delete-knowledge-base-sources"},{"title":"Resync a knowledge base source","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /knowledge-base/sources/{source}/resync","href":"/api-reference/v3/knowledge-base/resync-knowledge-base-source"},{"title":"Resync knowledge base sources in bulk","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /knowledge-base/sources/batch-resync","href":"/api-reference/v3/knowledge-base/resync-knowledge-base-sources"}]},{"group":"Labels","pages":[{"title":"List labels","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /labels","href":"/api-reference/v3/labels/list-labels"},{"title":"Create a label","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /labels","href":"/api-reference/v3/labels/create-label"},{"title":"Retrieve a label","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /labels/{label}","href":"/api-reference/v3/labels/get-label"},{"title":"Delete a label","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /labels/{label}","href":"/api-reference/v3/labels/delete-label"},{"title":"Update a label","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /labels/{label}","href":"/api-reference/v3/labels/update-label"}]},{"group":"Teams","pages":[{"title":"List teams","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /teams","href":"/api-reference/v3/teams/list-teams"},{"title":"Create a team","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /teams","href":"/api-reference/v3/teams/create-team"},{"title":"Retrieve a team","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /teams/{team}","href":"/api-reference/v3/teams/get-team"},{"title":"Delete a team","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /teams/{team}","href":"/api-reference/v3/teams/delete-team"},{"title":"Update a team","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /teams/{team}","href":"/api-reference/v3/teams/update-team"},{"title":"Add a team member","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json put /teams/{team}/members/{account}","href":"/api-reference/v3/teams/add-team-member"},{"title":"Remove a team member","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /teams/{team}/members/{account}","href":"/api-reference/v3/teams/remove-team-member"}]},{"group":"Topics","pages":[{"title":"List topics","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /topics","href":"/api-reference/v3/topics/list-topics"}]},{"group":"Variables","pages":[{"title":"List variables","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /variables","href":"/api-reference/v3/variables/list-variables"},{"title":"Create a variable","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json post /variables","href":"/api-reference/v3/variables/create-variable"},{"title":"Retrieve a variable","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /variables/{variable}","href":"/api-reference/v3/variables/get-variable"},{"title":"Delete a variable","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json delete /variables/{variable}","href":"/api-reference/v3/variables/delete-variable"},{"title":"Update a variable","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /variables/{variable}","href":"/api-reference/v3/variables/update-variable"}]},{"group":"Workflows","pages":[{"title":"List workflows","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /workflows","href":"/api-reference/v3/workflows/list-workflows"},{"title":"Retrieve the workflow catalog","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /workflows/catalog","href":"/api-reference/v3/workflows/get-workflow-catalog"},{"title":"Retrieve a workflow","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /workflows/{workflow}","href":"/api-reference/v3/workflows/get-workflow"},{"title":"Update a workflow","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json patch /workflows/{workflow}","href":"/api-reference/v3/workflows/update-workflow"},{"title":"List workflow runs","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /workflows/{workflow}/runs","href":"/api-reference/v3/workflows/list-workflow-runs"},{"title":"Retrieve a workflow run","deprecated":null,"version":null,"openapi":"/api-reference/v3/openapi.json get /workflows/{workflow}/runs/{run}","href":"/api-reference/v3/workflows/get-workflow-run"}]}]}]}]},"basePath":"","title":"Add a knowledge base source - Chatling Documentation","deploymentId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","buildId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-BMn8tSe3.js","snippetPresets-Dl5ZrD9W.js","utils-CddEzDcs.js","style-to-object-BY3JEAdk.js","utils-Dym31Pnf.js","v4-DIgz8zy6.js","addTypeLabelsToSchema-ZiqR8hPK.js","conditional-requirements-CFM0id0Q.js","cloneDeep-D3fPbylz.js","_Uint8Array-BcNtDki0.js","isObject-FP1Yky1u.js","ApiExamples-4Sf3CFhl.js","usePlaygroundInputsStore-Ck91l6q0.js","shallow-DapBSR9G.js","isEqual-Clu_sGzx.js","CodeSnippets-DAVHdSX2.js","CodeSnippet-Be6AcO_D.js","use-playground-group-access-CteWws2O.js","Page-_aL_PM_2.js","api-description-markdown-BPoPkVJQ.js","DynamicMarkdown-QJ7LkRm3.js","SectionHeading-DyxPTJti.js","MethodPill-CGjK-dNY.js","getPastedJson-C4YIGTOJ.js","Check2Icon-B7COpIZE.js","axios-CsQoIw0U.js","Markdown-Bquzb4Gw.js","AssistantPageLink-wSgGy_i5.js","dist-Bg48sGSz.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js"]}