Get Document Result
Retrieves extracted data and validation status for a previously uploaded document, providing details on its processing outcome.
Overview
The Get Document Result endpoint provides access to the structured data extracted from a document after it has been processed. This includes the extraction_data
(the core extracted information) and validation
results, indicating whether the document passed predefined validation rules.
If the document is still being processed, a 202 Accepted
status will be returned. If processing has completed but no data was extracted, or an error occurred, appropriate error messages will be provided.
Request
Path Parameters
Name | Type | Required | Description |
---|---|---|---|
document_id | string (UUID) | Yes | The unique identifier (UUID) of the document. |
Headers
Name | Type | Required | Description |
---|---|---|---|
X-API-Key | string | Yes | Your API key for authentication. |
Code Examples
curl -X GET "https://api.yourapp.com/api/v1/documents/a1b2c3d4-e5f6-7890-1234-567890abcdef/result" \
-H "X-API-Key: pk_abcd1234_secretsecretsecretsecretsecret"
Response Example
Successful response returning the document's processing result. Note: The structure of `extraction_data` varies based on the document type.
{
"document_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"extraction_data": {
"docType": "Invoice",
"general": {
"InvoiceNumber": "INV-2023-001",
"TotalGrossPrice": 120.50,
"Currency": "USD"
},
"lineItems": [
{
"ProductName": "Product A",
"ProductQuantity": 1,
"ProductUnitPrice": 100.00
}
]
},
"validation": {
"passed": true,
"details": {
"calculation_logic": "sum(lineItems.ProductPrice) vs general.TotalNetPrice"
}
},
"credits_used": 1,
"passed_validation": true
}
Response Example
Document processing is ongoing.
{
"document_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"status": "processing",
"message": "Processing is ongoing."
}
Response Example
Authentication failed due to an invalid or missing API key.
{
"detail": "Invalid API key."
}
Response Example
Not authorized to access this document.
{
"detail": "Not authorized to access this document"
}
Response Example
Document not found, or the result is not available due to a processing error (e.g., incompatible file content).
{
"detail": "Document not found"
}