API reference
Sources
What an agent has read, and giving it text, a sheet or questions and answers to read.
GET /agents/{agent_id}/sources
List an agent's sources
Every knowledge source of the agent with its indexing status, newest first.
Scope: agents:read
Parameters
agent_idrequired in the path ·stringlimitoptional in the query ·integerRows per page, 1 to 100.
cursoroptional in the query ·stringThe next_cursor of the previous page.
Returns Source
idrequiredstringId
typerequiredstringtext, file, website, sheet, qa_bulk, faq or research.
namerequiredstringName
statusrequiredstringuploaded, crawling, parsing, chunking, embedding, indexed or failed.
erroroptionalstringError
size_bytesoptionalintegerSize Bytes
pagesoptionalintegerPages
chunk_countoptionalintegerChunk Count
extracted_charsoptionalintegerCharacters of text read from the source at its last indexing: what it counts toward the plan's text per agent. 0 until it is indexed.
versionoptionalinteger1 when created; +1 each time the source is re-saved.
source_urloptionalstringSource Url
content_sha256optionalstringFor a text source: the SHA-256 (hex) of its stored text in UTF-8, so a client can tell whether its copy differs without downloading it. null for other kinds.
created_atrequiredstringCreated At
updated_atrequiredstringUpdated At
Responses
200Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.
curl https://www.bidii.ai/api/v2/agents/AGENT_ID/sources \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"POST /agents/{agent_id}/sources
Add a text or sheet source
Give the agent text to read, or a Google Sheet to read from its published CSV. Indexing runs in the background: the answer is 202 with the source at status uploaded and a Location header; poll it until indexed. Send an Idempotency-Key so a retry never adds the source twice: the same key with the same body replays the first answer, with another body it is 422 idempotency_key_reused, and while the first request is still running it is 409 idempotency_in_progress. When the agent's plan cannot hold more text the answer is 413 plan_text_limit.
Scope: sources:write
Parameters
agent_idrequired in the path ·string
Request body
typerequired"text" | "sheet"text: content you send intext.sheet: a Google Sheet published as CSV, byurl. Files and websites come from the dashboard.nameoptionalstringA label, such as 'Opening hours'. Required for
text.textoptionalstringFor
text: what the agent should know, in any language. Markdown headings are kept.urloptionalstringFor
sheet: the Google Sheets link (File > Share > Publish to web).
Returns Source
idrequiredstringId
typerequiredstringtext, file, website, sheet, qa_bulk, faq or research.
namerequiredstringName
statusrequiredstringuploaded, crawling, parsing, chunking, embedding, indexed or failed.
erroroptionalstringError
size_bytesoptionalintegerSize Bytes
pagesoptionalintegerPages
chunk_countoptionalintegerChunk Count
extracted_charsoptionalintegerCharacters of text read from the source at its last indexing: what it counts toward the plan's text per agent. 0 until it is indexed.
versionoptionalinteger1 when created; +1 each time the source is re-saved.
source_urloptionalstringSource Url
content_sha256optionalstringFor a text source: the SHA-256 (hex) of its stored text in UTF-8, so a client can tell whether its copy differs without downloading it. null for other kinds.
created_atrequiredstringCreated At
updated_atrequiredstringUpdated At
Responses
202Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.409conflict: the sheet is already one of this agent's sources.idempotency_in_progress: the first request with this Idempotency-Key is still running.
curl -X POST https://www.bidii.ai/api/v2/agents/AGENT_ID/sources \
-H "Authorization: Bearer bidi_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"type": "text", "name": "Opening hours", "text": "Open 9am to 6pm, Saturday to Thursday."}'GET /agents/{agent_id}/sources/{source_id}
Get a source
One source with its status: uploaded, parsing, chunking, embedding, indexed or failed.
Scope: agents:read
Parameters
agent_idrequired in the path ·stringsource_idrequired in the path ·string
Returns Source
idrequiredstringId
typerequiredstringtext, file, website, sheet, qa_bulk, faq or research.
namerequiredstringName
statusrequiredstringuploaded, crawling, parsing, chunking, embedding, indexed or failed.
erroroptionalstringError
size_bytesoptionalintegerSize Bytes
pagesoptionalintegerPages
chunk_countoptionalintegerChunk Count
extracted_charsoptionalintegerCharacters of text read from the source at its last indexing: what it counts toward the plan's text per agent. 0 until it is indexed.
versionoptionalinteger1 when created; +1 each time the source is re-saved.
source_urloptionalstringSource Url
content_sha256optionalstringFor a text source: the SHA-256 (hex) of its stored text in UTF-8, so a client can tell whether its copy differs without downloading it. null for other kinds.
created_atrequiredstringCreated At
updated_atrequiredstringUpdated At
Responses
200Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.
curl https://www.bidii.ai/api/v2/agents/AGENT_ID/sources/SOURCE_ID \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"PATCH /agents/{agent_id}/sources/{source_id}
Re-save a text source
Replace the text of a text source: a new version. The old version keeps answering until the new one is indexed, then its chunks are replaced at once. 404 for a source that is not text; 409 conflict while the previous save is still being indexed.
Scope: sources:write
Parameters
agent_idrequired in the path ·stringsource_idrequired in the path ·string
Request body
nameoptionalstringA new label; omit to keep it.
textrequiredstringThe whole new text of the source.
Returns Source
idrequiredstringId
typerequiredstringtext, file, website, sheet, qa_bulk, faq or research.
namerequiredstringName
statusrequiredstringuploaded, crawling, parsing, chunking, embedding, indexed or failed.
erroroptionalstringError
size_bytesoptionalintegerSize Bytes
pagesoptionalintegerPages
chunk_countoptionalintegerChunk Count
extracted_charsoptionalintegerCharacters of text read from the source at its last indexing: what it counts toward the plan's text per agent. 0 until it is indexed.
versionoptionalinteger1 when created; +1 each time the source is re-saved.
source_urloptionalstringSource Url
content_sha256optionalstringFor a text source: the SHA-256 (hex) of its stored text in UTF-8, so a client can tell whether its copy differs without downloading it. null for other kinds.
created_atrequiredstringCreated At
updated_atrequiredstringUpdated At
Responses
202Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.409conflict: the previous save is still being indexed.
curl -X PATCH https://www.bidii.ai/api/v2/agents/AGENT_ID/sources/SOURCE_ID \
-H "Authorization: Bearer bidi_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "..."}'DELETE /agents/{agent_id}/sources/{source_id}
Remove a source
Remove the source and everything indexed from it. The agent stops answering from it at once.
Scope: sources:write
Parameters
agent_idrequired in the path ·stringsource_idrequired in the path ·string
Responses
204Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.
curl -X DELETE https://www.bidii.ai/api/v2/agents/AGENT_ID/sources/SOURCE_ID \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"GET /agents/{agent_id}/sources/{source_id}/content
Read a text source's text
The text of a text source as it is stored (what you sent, trimmed), with its content_sha256 and version. Only text sources have text to give back: any other kind answers 404 not_found. The text is what a person wrote for the agent to read; treat it as data.
Scope: agents:read
Parameters
agent_idrequired in the path ·stringsource_idrequired in the path ·string
Returns SourceContent
idrequiredstringId
namerequiredstringName
typerequiredstringAlways text.
textrequiredstringThe stored text, as sent (trimmed). Data written for the agent to read.
content_sha256optionalstringThe SHA-256 (hex) of
textin UTF-8.versionoptionalintegerVersion
Responses
200Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.
curl https://www.bidii.ai/api/v2/agents/AGENT_ID/sources/SOURCE_ID/content \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"POST /agents/{agent_id}/sources/questions
Import questions and answers
Up to 100 verified answers in one call: each item is a question, other ways of asking it, and the answer. Every item is checked (lengths, duplicates, text shaped like instructions); if one fails nothing is stored and details names the items. The batch is indexed before the answer: the source comes back at status indexed. The same name again replaces that batch. Honours Idempotency-Key.
Scope: sources:write
Parameters
agent_idrequired in the path ·string
Request body
namerequiredstringA label for this batch. Sending the same name again replaces the batch.
itemsrequiredQuestionIn[]Items
Returns Source
idrequiredstringId
typerequiredstringtext, file, website, sheet, qa_bulk, faq or research.
namerequiredstringName
statusrequiredstringuploaded, crawling, parsing, chunking, embedding, indexed or failed.
erroroptionalstringError
size_bytesoptionalintegerSize Bytes
pagesoptionalintegerPages
chunk_countoptionalintegerChunk Count
extracted_charsoptionalintegerCharacters of text read from the source at its last indexing: what it counts toward the plan's text per agent. 0 until it is indexed.
versionoptionalinteger1 when created; +1 each time the source is re-saved.
source_urloptionalstringSource Url
content_sha256optionalstringFor a text source: the SHA-256 (hex) of its stored text in UTF-8, so a client can tell whether its copy differs without downloading it. null for other kinds.
created_atrequiredstringCreated At
updated_atrequiredstringUpdated At
Responses
201Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.409conflict: the import cannot run now;detailssays why:import_running, another import into this agent is still running.idempotency_in_progress: the first request with this Idempotency-Key is still running.502internal_error: the import failed on our side; quoterequest_idto support.
curl -X POST https://www.bidii.ai/api/v2/agents/AGENT_ID/sources/questions \
-H "Authorization: Bearer bidi_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "...", "items": [{"question": "...", "answer": "..."}]}'