Get Document Status
Check the processing status of a document.
GET /v1/documents/:id/status
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Document ID |
Example Request
- cURL
- Python
- JavaScript
curl https://api.inherent.systems/v1/documents/doc_abc123/status \
-H "Authorization: Bearer $INHERENT_API_KEY"
import requests
response = requests.get(
"https://api.inherent.systems/v1/documents/doc_abc123/status",
headers={"Authorization": f"Bearer {api_key}"}
)
const response = await fetch(
'https://api.inherent.systems/v1/documents/doc_abc123/status',
{
headers: {
'Authorization': `Bearer ${apiKey}`,
},
}
);
Response - Processing
{
"id": "doc_abc123",
"status": "processing",
"progress": {
"stage": "embedding",
"chunks_processed": 15,
"chunks_total": 24
},
"started_at": "2024-01-15T10:30:00Z"
}
Response - Completed
{
"id": "doc_abc123",
"status": "completed",
"version": 1,
"stats": {
"chunks_created": 24,
"tokens_total": 8192,
"processing_time_ms": 3420
},
"started_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:30:03Z"
}
Response - Failed
{
"id": "doc_abc123",
"status": "failed",
"error": {
"code": "embedding_failed",
"message": "Failed to generate embeddings for chunk 15",
"details": "Token limit exceeded"
},
"started_at": "2024-01-15T10:30:00Z",
"failed_at": "2024-01-15T10:30:02Z"
}
Status Values
| Status | Description |
|---|---|
pending | Queued for processing |
processing | Currently being processed |
completed | Successfully processed |
failed | Processing failed |
Processing Stages
| Stage | Description |
|---|---|
parsing | Extracting text from document |
chunking | Splitting into chunks |
embedding | Generating vector embeddings |
indexing | Adding to search index |
Polling Example
import time
import requests
def wait_for_processing(document_id, timeout=60):
start = time.time()
while time.time() - start < timeout:
response = requests.get(
f"https://api.inherent.systems/v1/documents/{document_id}/status",
headers={"Authorization": f"Bearer {api_key}"}
)
status = response.json()
if status["status"] == "completed":
return status
elif status["status"] == "failed":
raise Exception(f"Processing failed: {status['error']['message']}")
time.sleep(1) # Poll every second
raise TimeoutError("Document processing timed out")
Errors
| Code | Description |
|---|---|
404 | Document not found |