Skip to main content

Get Document Status

Check the processing status of a document.

GET /v1/documents/:id/status

Path Parameters

ParameterTypeDescription
idstringDocument ID

Example Request

curl https://api.inherent.systems/v1/documents/doc_abc123/status \
-H "Authorization: Bearer $INHERENT_API_KEY"

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

StatusDescription
pendingQueued for processing
processingCurrently being processed
completedSuccessfully processed
failedProcessing failed

Processing Stages

StageDescription
parsingExtracting text from document
chunkingSplitting into chunks
embeddingGenerating vector embeddings
indexingAdding 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

CodeDescription
404Document not found