Skip to main content

Documents API

Manage indexed documents programmatically.

List Documents

Endpoint

GET /v1/documents

Query Parameters

ParameterTypeDescription
collectionstringFilter by collection
sourcestringFilter by connector
statusstringFilter by status
pagenumberPage number
limitnumberItems per page

Response

{
"data": [
{
"id": "doc_abc123",
"title": "Getting Started Guide",
"status": "indexed",
"collection": "Documentation",
"source": "Confluence",
"createdAt": "2024-01-15T10:00:00Z",
"metadata": {
"author": "John Doe",
"lastModified": "2024-01-14T15:30:00Z"
}
}
],
"meta": {
"page": 1,
"limit": 20,
"total": 1234
}
}

Get Document

Endpoint

GET /v1/documents/{id}

Response

{
"data": {
"id": "doc_abc123",
"title": "Getting Started Guide",
"content": "Full document content...",
"status": "indexed",
"collection": "Documentation",
"source": "Confluence",
"metadata": {
"author": "John Doe",
"url": "https://...",
"pages": 5
},
"semanticUnits": [
{
"id": "su_xyz",
"content": "Section content...",
"position": 1
}
]
}
}

Delete Document

Endpoint

DELETE /v1/documents/{id}

Response

{
"data": {
"id": "doc_abc123",
"deleted": true
}
}

Document Status

StatusDescription
pendingWaiting for processing
processingCurrently being indexed
indexedSuccessfully indexed
failedIndexing failed
deletedRemoved from index

Example Usage

List Documents

const docs = await client.documents.list({
collection: 'col_abc123',
status: 'indexed',
limit: 50
});

Get Document

const doc = await client.documents.get('doc_xyz789');
console.log(doc.title, doc.content);

Delete Document

await client.documents.delete('doc_xyz789');

Next Steps