Documents
Documents are JSON objects stored in an index. Headband auto-detects schema from the document structure -- no upfront schema definition required. You can send thousands of documents in a single request for bulk ingestion.
/v1/documents?index=productsList documents in an index with pagination.
Supports limit and offset query parameters for pagination. Use server-side only; search keys cannot browse raw source documents.
{
"results": [
{ "id": 1, "title": "MacBook Pro", "price": 1999 },
{ "id": 2, "title": "iPhone 16", "price": 999 }
],
"total": 19547,
"limit": 20,
"offset": 0
}/v1/documents/:id?index=productsGet a single document by its primary key.
Use server-side only; search keys cannot browse raw source documents.
{
"id": 1,
"title": "MacBook Pro",
"price": 1999,
"category": "laptops"
}/v1/documents?index=products&primaryKey=idAdd or replace documents in an index. If a document with the same primary key already exists, it will be replaced.
Supports bulk upload -- send thousands of documents in one request.
[
{ "id": 1, "title": "MacBook Pro", "price": 1999, "category": "laptops" },
{ "id": 2, "title": "iPhone 16", "price": 999, "category": "phones" }
]{
"taskUid": 2,
"indexUid": "products",
"status": "enqueued",
"enqueuedAt": "2025-01-15T09:00:00Z"
}/v1/documents?index=productsDelete documents from an index by IDs or by filter.
// Delete by IDs:
{ "ids": [1, 2] }
// Or delete by filter:
{ "filter": "price > 1000" }{
"taskUid": 3,
"indexUid": "products",
"status": "enqueued"
}Bulk Import
Import large volumes of documents efficiently. The bulk endpoint automatically splits your documents into optimized batches and sends them in parallel, handling payloads of up to 500K documents in a single request.
/v1/bulkImport documents in optimized parallel batches.
{
"index": "products",
"primaryKey": "id",
"documents": [
{ "id": 1, "title": "Widget", "price": 9.99 },
{ "id": 2, "title": "Gadget", "price": 24.99 }
// ... up to 500K documents
]
}{
"tasks": [
{ "taskUid": 10, "indexUid": "products", "status": "enqueued", "batchNumber": 1, "documentsInBatch": 10000 },
{ "taskUid": 11, "indexUid": "products", "status": "enqueued", "batchNumber": 2, "documentsInBatch": 10000 }
],
"totalDocuments": 20000,
"totalBatches": 2,
"batchSize": 10000
}| Parameter | Type | Default | Description |
|---|---|---|---|
batchSize | number | 10000 | Documents per batch (min 100, max 50000). |
Streaming Progress
/v1/bulk/streamImport documents with real-time Server-Sent Events progress. Same request body as /v1/bulk.
Use the streaming endpoint for large imports to get real-time progress feedback. Combine with the Tasks API to poll individual batch status after import.
{
"index": "products",
"primaryKey": "id",
"documents": [
{ "id": 1, "title": "Widget", "price": 9.99 },
{ "id": 2, "title": "Gadget", "price": 24.99 }
// ... up to 500K documents
]
}data: {"event":"batch_complete","batchNumber":1,"taskUid":10,"documentsInBatch":10000}
data: {"event":"batch_complete","batchNumber":2,"taskUid":11,"documentsInBatch":10000}
data: {"event":"complete","totalDocuments":20000,"totalBatches":2}