Skip to main content
POST
/
index-document
Index Document
curl --request POST \
  --url https://api.agentbase.sh/index-document \
  --header 'Content-Type: multipart/form-data' \
  --form 'datastore_id=<string>' \
  --form file='@example-file'
{
  "document_id": "<string>",
  "datastore_id": "<string>",
  "filename": "<string>",
  "status": "<string>",
  "indexed_at": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.agentbase.sh/llms.txt

Use this file to discover all available pages before exploring further.

Body Parameters

file
file
required
The document file to upload and index. Supported formats include PDF, TXT, PNG, JPG, and more.
datastore_id
string
required
The ID of the datastore where the document will be indexed. You can get this ID from the Create Datastore endpoint.

Example Request

curl -X POST https://api.agentbase.sh/index-document \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "file=@./Trends_Artificial_Intelligence.pdf" \
  -F "datastore_id=ds_1234567890abcdef"

Response

Returns information about the indexed document.
{
  "document_id": "doc_abcdef1234567890",
  "datastore_id": "ds_1234567890abcdef",
  "filename": "Trends_Artificial_Intelligence.pdf",
  "status": "indexed",
  "indexed_at": "2025-10-01T12:00:00Z"
}

Response Fields

document_id
string
The unique identifier for the indexed document
datastore_id
string
The ID of the datastore containing the document
filename
string
The name of the uploaded file
status
string
The indexing status of the document (e.g., indexed, processing)
indexed_at
string
Timestamp of when the document was successfully indexed