The Speak AI API exposes 14 knowledge base endpoints under the base URL https://api.speakai.co/v1. Every request needs the x-speakai-key and x-access-token headers described in Authentication.
What can you do with the knowledge base endpoints?
Speak AI groups these 14 endpoints under the knowledge base resource. Each entry below links to the full reference for that endpoint further down this page.
Collections
Documents
Owner mapping
Collections
List Knowledge Base Collections
/knowledge-basesList Collections
Lists every collection in your company, newest first. Each item is enriched with documentCount and a rolled-up status the single-collection Get endpoint does not return.
curl -X GET 'https://api.speakai.co/v1/knowledge-bases' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object[] |
data – 8 more fields
| Field | Type | Description |
|---|---|---|
knowledgeBaseId |
string | Server-generated. Immutable. The identifier used everywhere for this collection. |
name |
string | Up to 200 characters. |
description |
string | Up to 1000 characters. |
documents |
object | |
documents.embeddingStatus |
string | One of: pending, processing, completed, failed . |
documents.lastIndexedAt |
string (date-time) | |
createdAt |
string (date-time) | |
updatedAt |
string (date-time) | |
documentCount |
number | Only present in the list response, not on a single collection fetched by id. |
status |
string | Rolled up from this collection’s documents. Only present in the list response. Distinct from documents.embeddingStatus, which is a stored field on the collection itself. One of: empty, processing, ready, failed . |
Create Knowledge Base Collection
/knowledge-basesCreate Collection
Requires the OWNER or ADMIN role. Creates an empty document collection. Add documents to it with the manual-document endpoint, then attach it to a folder or agent with the map endpoint so something actually uses it.
Request body
Fields marked required are the ones the server rejects the request without. Anything conditional, where a field becomes required only alongside another, is described under Request rules above rather than marked here.
| Field | Type | Description |
|---|---|---|
name |
string, required | Up to 200 characters. Required. |
description |
string | Up to 1000 characters. Optional. |
curl -X POST 'https://api.speakai.co/v1/knowledge-bases' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000' \
-H 'Content-Type: application/json' \
-d '{}'201 Created
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object |
data – 6 more fields
| Field | Type | Description |
|---|---|---|
knowledgeBaseId |
string | Server-generated. Immutable. The identifier used everywhere for this collection. |
name |
string | Up to 200 characters. |
description |
string | Up to 1000 characters. |
documents |
object | |
documents.embeddingStatus |
string | One of: pending, processing, completed, failed . |
documents.lastIndexedAt |
string (date-time) | |
createdAt |
string (date-time) | |
updatedAt |
string (date-time) |
400 Bad Request
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string |
403 Forbidden
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: You do not have permission to manage knowledge bases . |
Get Knowledge Base Collection
/knowledge-bases/{kbId}Get Collection
Fetches one collection by id, company-scoped. Does not include documentCount or status – those are only on the list response.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
curl -X GET 'https://api.speakai.co/v1/knowledge-bases/KB_ID' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object |
data – 6 more fields
| Field | Type | Description |
|---|---|---|
knowledgeBaseId |
string | Server-generated. Immutable. The identifier used everywhere for this collection. |
name |
string | Up to 200 characters. |
description |
string | Up to 1000 characters. |
documents |
object | |
documents.embeddingStatus |
string | One of: pending, processing, completed, failed . |
documents.lastIndexedAt |
string (date-time) | |
createdAt |
string (date-time) | |
updatedAt |
string (date-time) |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Knowledge base not found . |
Update Knowledge Base Collection
/knowledge-bases/{kbId}Update Collection
Requires the OWNER or ADMIN role. Partial update: send only the fields to change. At least one of name or description is required.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
Request body
Fields marked required are the ones the server rejects the request without. Anything conditional, where a field becomes required only alongside another, is described under Request rules above rather than marked here.
| Field | Type | Description |
|---|---|---|
name |
string | Up to 200 characters. |
description |
string | Up to 1000 characters. |
curl -X PATCH 'https://api.speakai.co/v1/knowledge-bases/KB_ID' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000' \
-H 'Content-Type: application/json' \
-d '{}'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object |
data – 6 more fields
| Field | Type | Description |
|---|---|---|
knowledgeBaseId |
string | Server-generated. Immutable. The identifier used everywhere for this collection. |
name |
string | Up to 200 characters. |
description |
string | Up to 1000 characters. |
documents |
object | |
documents.embeddingStatus |
string | One of: pending, processing, completed, failed . |
documents.lastIndexedAt |
string (date-time) | |
createdAt |
string (date-time) | |
updatedAt |
string (date-time) |
400 Bad Request
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string |
403 Forbidden
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: You do not have permission to manage knowledge bases . |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Knowledge base not found . |
Delete Knowledge Base Collection
/knowledge-bases/{kbId}Delete Collection
Requires the OWNER or ADMIN role. Deletes the collection, every document in it, their embeddings, and every mapping row pointing at it. An automation step that still names this collection is not touched – it starts failing to retrieve rather than being silently unlinked.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
curl -X DELETE 'https://api.speakai.co/v1/knowledge-bases/KB_ID' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object | |
data.knowledgeBaseId |
string | |
data.deleted |
boolean | One of: true . |
403 Forbidden
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: You do not have permission to manage knowledge bases . |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Knowledge base not found . |
Documents
List Knowledge Base Documents
/knowledge-bases/{kbId}/documentsList Documents
Lists every document in the collection, newest first. Each item’s full text is not included – fetch it separately from Get Document Text.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
curl -X GET 'https://api.speakai.co/v1/knowledge-bases/KB_ID/documents' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object[] |
data – 14 more fields
| Field | Type | Description |
|---|---|---|
documentId |
string | Server-generated. Immutable. |
knowledgeBaseId |
string | |
source |
string | This endpoint set only creates manual documents; upload and website documents come from endpoints not covered here. One of: upload, website, manual . |
title |
string | |
description |
string | |
fileName |
string | Set only for an uploaded file. |
mimeType |
string | |
sizeBytes |
number | |
sourceUrl |
string | Set only for a website document. |
pageUrl |
string | Set only for a website document. |
status |
string | One of: uploaded, parsing, parsed, embedding, ready, failed . |
error |
string | |
parse |
object | |
parse.engine |
string | |
parse.pages |
number | |
parse.costUsd |
number | |
parse.parsedAt |
string (date-time) | |
createdAt |
string (date-time) |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Knowledge base not found . |
Update Knowledge Base Document
/knowledge-bases/{kbId}/documents/{docId}Update Document
Requires the OWNER or ADMIN role. Renames the document’s title and/or description – the only fields this endpoint can change, at any status. A title change also propagates to that document’s stored chunk metadata so retrieval citations pick it up immediately.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
docId |
path | string | Yes | The document’s documentId. |
Request body
Fields marked required are the ones the server rejects the request without. Anything conditional, where a field becomes required only alongside another, is described under Request rules above rather than marked here.
| Field | Type | Description |
|---|---|---|
title |
string | Cannot be sent as an empty string. |
description |
string |
curl -X PATCH 'https://api.speakai.co/v1/knowledge-bases/KB_ID/documents/DOC_ID' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000' \
-H 'Content-Type: application/json' \
-d '{}'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object |
data – 14 more fields
| Field | Type | Description |
|---|---|---|
documentId |
string | Server-generated. Immutable. |
knowledgeBaseId |
string | |
source |
string | This endpoint set only creates manual documents; upload and website documents come from endpoints not covered here. One of: upload, website, manual . |
title |
string | |
description |
string | |
fileName |
string | Set only for an uploaded file. |
mimeType |
string | |
sizeBytes |
number | |
sourceUrl |
string | Set only for a website document. |
pageUrl |
string | Set only for a website document. |
status |
string | One of: uploaded, parsing, parsed, embedding, ready, failed . |
error |
string | |
parse |
object | |
parse.engine |
string | |
parse.pages |
number | |
parse.costUsd |
number | |
parse.parsedAt |
string (date-time) | |
createdAt |
string (date-time) |
400 Bad Request
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string |
403 Forbidden
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: You do not have permission to manage knowledge bases . |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Document not found . |
Delete Knowledge Base Document
/knowledge-bases/{kbId}/documents/{docId}Delete Document
Requires the OWNER or ADMIN role. Deletes the document and its embeddings. Looked up by documentId and your company alone – the kbId in the path is not cross-checked against the document’s own collection, so this succeeds even if docId actually belongs to a different one of your collections.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
docId |
path | string | Yes | The document’s documentId. |
curl -X DELETE 'https://api.speakai.co/v1/knowledge-bases/KB_ID/documents/DOC_ID' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object | |
data.documentId |
string | |
data.deleted |
boolean | One of: true . |
403 Forbidden
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: You do not have permission to manage knowledge bases . |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Document not found . |
Get Knowledge Base Document Text
/knowledge-bases/{kbId}/documents/{docId}/textGet Document Text
Fetches the extracted text of one document, company-scoped. A document that has not finished parsing yet is not an error: available is false, text is an empty string, and status shows the document’s current state.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
docId |
path | string | Yes | The document’s documentId. |
curl -X GET 'https://api.speakai.co/v1/knowledge-bases/KB_ID/documents/DOC_ID/text' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object | |
data.documentId |
string | |
data.status |
string | One of: uploaded, parsing, parsed, embedding, ready, failed . |
data.available |
boolean | True once text.length > 0. |
data.text |
string | |
data.length |
number | Character count, not bytes. |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Document not found . |
Add Knowledge Base Text Document
/knowledge-bases/{kbId}/documents/manualAdd a Text Document
Requires the OWNER or ADMIN role. Adds a document with text you supply directly – the only way this endpoint set creates a document (uploading a file or crawling a website use endpoints not covered here). Kicks off embedding immediately; status starts at uploaded and moves toward ready on its own.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
Request body
Fields marked required are the ones the server rejects the request without. Anything conditional, where a field becomes required only alongside another, is described under Request rules above rather than marked here.
| Field | Type | Description |
|---|---|---|
title |
string, required | Up to 200 characters. Required. |
text |
string, required | Required, non-empty. Size-capped server-side; an oversized submission is a 400 asking you to split it into smaller entries. |
curl -X POST 'https://api.speakai.co/v1/knowledge-bases/KB_ID/documents/manual' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000' \
-H 'Content-Type: application/json' \
-d '{}'201 Created
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object |
data – 14 more fields
| Field | Type | Description |
|---|---|---|
documentId |
string | Server-generated. Immutable. |
knowledgeBaseId |
string | |
source |
string | This endpoint set only creates manual documents; upload and website documents come from endpoints not covered here. One of: upload, website, manual . |
title |
string | |
description |
string | |
fileName |
string | Set only for an uploaded file. |
mimeType |
string | |
sizeBytes |
number | |
sourceUrl |
string | Set only for a website document. |
pageUrl |
string | Set only for a website document. |
status |
string | One of: uploaded, parsing, parsed, embedding, ready, failed . |
error |
string | |
parse |
object | |
parse.engine |
string | |
parse.pages |
number | |
parse.costUsd |
number | |
parse.parsedAt |
string (date-time) | |
createdAt |
string (date-time) |
400 Bad Request
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string |
403 Forbidden
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: You do not have permission to manage knowledge bases . |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Knowledge base not found . |
Owner mapping
List Knowledge Base Collection Owners
/knowledge-bases/{kbId}/ownersList Collection Owners
Everything this collection is attached to: folder and agent mappings from the map endpoint, plus every automation whose AI step names this collection directly (automations are never in the mapping table – their link is read live from the automation’s own steps, so it can’t go stale).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
curl -X GET 'https://api.speakai.co/v1/knowledge-bases/KB_ID/owners' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object[] | |
data[].knowledgeBaseId |
string | |
data[].ownerType |
string | One of: folder, agent, automation . |
data[].ownerId |
string | |
data[].ownerName |
string | Only present when ownerType is automation – the automation’s name, looked up live from its own record, not stored on a mapping row. |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Knowledge base not found . |
Map Knowledge Base Collection
/knowledge-bases/{kbId}/mapAttach a Collection
Requires the OWNER or ADMIN role. Attaches this collection to a folder or agent, so retrieval actually uses it – a collection with no mapping is created but inert. Idempotent: mapping the same (collection, owner) pair again returns the existing row rather than erroring. ownerType cannot be automation here – an automation’s collection is set on its own AI step, not through this endpoint; see Get Collection Owners for how that link is surfaced instead.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
Request body
Fields marked required are the ones the server rejects the request without. Anything conditional, where a field becomes required only alongside another, is described under Request rules above rather than marked here.
| Field | Type | Description |
|---|---|---|
ownerType |
string, required | One of: folder, agent . |
ownerId |
string, required |
curl -X POST 'https://api.speakai.co/v1/knowledge-bases/KB_ID/map' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000' \
-H 'Content-Type: application/json' \
-d '{}'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object | |
data.knowledgeBaseId |
string | |
data.ownerType |
string | Never automation here: an automation’s collection lives on its own AI step, not a mapping row – see GET …/owners for how an automation link is surfaced instead. One of: folder, agent . |
data.ownerId |
string | |
data.createdAt |
string (date-time) |
400 Bad Request
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string |
403 Forbidden
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: You do not have permission to manage knowledge bases . |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Knowledge base not found . |
Unmap Knowledge Base Collection
/knowledge-bases/{kbId}/mapDetach a Collection
Requires the OWNER or ADMIN role. Removes one mapping row. ownerType and ownerId are sent as query parameters on this DELETE, not a request body.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kbId |
path | string | Yes | The collection’s knowledgeBaseId. |
ownerType |
query | string | Yes | |
ownerId |
query | string | Yes |
curl -X DELETE 'https://api.speakai.co/v1/knowledge-bases/KB_ID/map' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object | |
data.knowledgeBaseId |
string | |
data.ownerType |
string | |
data.ownerId |
string | |
data.unmapped |
boolean | One of: true . |
403 Forbidden
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: You do not have permission to manage knowledge bases . |
404 Not Found
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: failed . |
message |
string | One of: Mapping not found . |
List Collections for an Owner
/knowledge-bases/owners/{ownerType}/{ownerId}/collectionsList an Owner’s Collections
Reverse lookup: every collection mapped to a given folder or agent. Only covers real mapping rows, so an automation’s collection (which is never mapped, only referenced from its own AI step) will not appear here even though it shows up in that collection’s own Get Collection Owners response.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ownerType |
path | string | Yes | |
ownerId |
path | string | Yes | The folder or agent id. |
curl -X GET 'https://api.speakai.co/v1/knowledge-bases/owners/OWNER_TYPE/OWNER_ID/collections' \
-H 'x-speakai-key: sk_test_speak_0000000000000000' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiJ9.test-access-token.0000000000'200 OK
Response body, application/json.
| Field | Type | Description |
|---|---|---|
status |
string | One of: success . |
data |
object[] |
data – 6 more fields
| Field | Type | Description |
|---|---|---|
knowledgeBaseId |
string | Server-generated. Immutable. The identifier used everywhere for this collection. |
name |
string | Up to 200 characters. |
description |
string | Up to 1000 characters. |
documents |
object | |
documents.embeddingStatus |
string | One of: pending, processing, completed, failed . |
documents.lastIndexedAt |
string (date-time) | |
createdAt |
string (date-time) | |
updatedAt |
string (date-time) |
Related pages
- API reference for the base URL, authentication, and the error format.
- Authenticate with the Speak AI API using access tokens
- Upload audio and video to Speak AI and read insights
- Create and update live transcription sessions
- Analyze text notes with the Speak AI text endpoints
Get an API key on the Speak AI developer page.