Suparse
API Documentation

Get Document Result

Retrieves extracted data and validation status for a previously uploaded document, providing details on its processing outcome.

GET/api/v1/documents/{document_id}/result

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

NameTypeRequiredDescription
document_idstring (UUID)YesThe unique identifier (UUID) of the document.

Headers

NameTypeRequiredDescription
X-API-KeystringYesYour 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

200

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

202

Document processing is ongoing.

{
  "document_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
  "status": "processing",
  "message": "Processing is ongoing."
}
 

Response Example

401

Authentication failed due to an invalid or missing API key.

{
  "detail": "Invalid API key."
}
 

Response Example

403

Not authorized to access this document.

{
  "detail": "Not authorized to access this document"
}
 

Response Example

404

Document not found, or the result is not available due to a processing error (e.g., incompatible file content).

{
  "detail": "Document not found"
}