Quickstart
Get started with the DocLD API in three steps: upload a document, extract data, and ask questions.
Prerequisites
- Create a DocLD account at docld.com
- Get your API key — Go to Settings → API Keys and create a key
- Set your key as an environment variable:
export DOCLD_API_KEY="docld_..."Step 1 — Upload a document
Upload a file and DocLD will automatically parse, chunk, and index it.
curl https://docld.com/api/v1/documents \
-H "Authorization: Bearer $DOCLD_API_KEY" \
-F file=@invoice.pdf{
"id": "f47ac10b-...",
"object": "document",
"name": "invoice.pdf",
"status": "pending",
"created": 1710000000
}Processing takes a few seconds. Poll the document to check status:
curl https://docld.com/api/v1/documents/f47ac10b-... \
-H "Authorization: Bearer $DOCLD_API_KEY"When status is "completed", the document is ready.
Step 2 — Extract structured data
Pull specific fields from the document:
curl https://docld.com/api/v1/extractions \
-H "Authorization: Bearer $DOCLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"document_id": "f47ac10b-...",
"fields": [
{"name": "vendor", "type": "string"},
{"name": "total", "type": "number"},
{"name": "date", "type": "string"}
]
}'{
"id": "e1a2b3c4-...",
"object": "extraction",
"data": {
"vendor": "Acme Corp",
"total": 1500.00,
"date": "2026-01-15"
},
"confidence": 0.95
}For reusable extraction templates, create a schema first.
Step 3 — Ask questions
Create a collection, add your document, then ask questions:
# Create a collection
curl https://docld.com/api/v1/collections \
-H "Authorization: Bearer $DOCLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Invoices"}'
# Add the document to the collection
curl https://docld.com/api/v1/collections/COLLECTION_ID/documents \
-H "Authorization: Bearer $DOCLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"document_id": "f47ac10b-..."}'
# Ask a question
curl https://docld.com/api/v1/chat/completions \
-H "Authorization: Bearer $DOCLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "What is the total on the invoice?",
"collection_id": "COLLECTION_ID"
}'{
"id": "chatcmpl_abc123",
"object": "chat.completion",
"message": "The total on the invoice is $1,500.00.",
"citations": [
{
"document_id": "f47ac10b-...",
"page": 1,
"text": "Total: $1,500.00"
}
]
}Next Steps
- API Reference — Full endpoint documentation
- Authentication — API keys and rate limits
- Search — Semantic search across documents
- SDKs — JavaScript and Python client libraries
- Document Parsing — Supported formats and OCR
Last updated on