Skip to content

List document chunks

GET
/v1/knowledge-bases/{kb_id}/documents/{doc_id}/chunks

List the chunks generated from a document. Useful for debugging and understanding how a document was segmented. Chunks are returned in order of chunk_index.

The embedding vector is excluded from the response to keep payloads small. Uses cursor-based pagination with chunk_index as the cursor value.

kb_id
required
string
/^kb_/
Example
kb_a1b2c3d4e5

Knowledge base ID

doc_id
required
string
/^doc_/
Example
doc_f6g7h8i9j0

Document ID

cursor
string

Pagination cursor from a previous response’s meta.cursor field

limit
integer
>= 1

Maximum number of items to return per page

Chunks retrieved

object
data
required
Array<object>
object
id
required

Chunk ID (prefixed with chk_)

string
Example
chk_k1l2m3n4o5
document_id
required

Parent document ID

string
Example
doc_f6g7h8i9j0
kb_id
required

Parent knowledge base ID

string
Example
kb_a1b2c3d4e5
text
required

The chunk text content

string
Example
Machine learning is a subset of artificial intelligence...
chunk_index
required

Position of this chunk within the document (0-indexed)

integer
0
start_page

Starting page number (null for text-only documents)

integer
nullable
Example
1
end_page

Ending page number

integer
nullable
Example
1
section_heading

Section heading this chunk belongs to

string
nullable
Example
Introduction
token_count
required

Estimated token count for this chunk

integer
Example
245
metadata
required

Chunk-level metadata

object
key
additional properties
any
Example
{}
created_at
required
string format: date-time
Example
2026-02-10T12:00:00.000Z
meta
required
object
cursor
required

Cursor to pass for the next page. Null if no more results.

string
nullable
Example
eyJpZCI6ImtiX2FiYzEyMyJ9
has_more
required

Whether more results are available

boolean
Example
true

Authentication failed or missing

object
error
required
object
code
required

Machine-readable error code

string
Allowed values: VALIDATION_ERROR AUTHENTICATION_ERROR NOT_FOUND CONFLICT RATE_LIMIT_EXCEEDED USAGE_LIMIT_EXCEEDED EXTERNAL_SERVICE_ERROR INTERNAL_ERROR
Example
VALIDATION_ERROR
message
required

Human-readable error message

string
Example
Invalid request body
details

Additional error details (e.g., validation issues)

object
key
additional properties
any
Example
{
"error": {
"code": "AUTHENTICATION_ERROR",
"message": "Invalid or missing API key"
}
}

Resource not found

object
error
required
object
code
required

Machine-readable error code

string
Allowed values: VALIDATION_ERROR AUTHENTICATION_ERROR NOT_FOUND CONFLICT RATE_LIMIT_EXCEEDED USAGE_LIMIT_EXCEEDED EXTERNAL_SERVICE_ERROR INTERNAL_ERROR
Example
VALIDATION_ERROR
message
required

Human-readable error message

string
Example
Invalid request body
details

Additional error details (e.g., validation issues)

object
key
additional properties
any
Example
{
"error": {
"code": "NOT_FOUND",
"message": "KnowledgeBase not found: kb_nonexistent"
}
}

Rate limit exceeded

object
error
required
object
code
required

Machine-readable error code

string
Allowed values: VALIDATION_ERROR AUTHENTICATION_ERROR NOT_FOUND CONFLICT RATE_LIMIT_EXCEEDED USAGE_LIMIT_EXCEEDED EXTERNAL_SERVICE_ERROR INTERNAL_ERROR
Example
VALIDATION_ERROR
message
required

Human-readable error message

string
Example
Invalid request body
details

Additional error details (e.g., validation issues)

object
key
additional properties
any
Example
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded"
}
}