Suparse
API Documentation

Upload Document endpoint

Uploads a document (PDF, JPEG, or PNG) for automated processing, queuing it for extraction and validation based on its type.

POST/api/v1/documents/{doc_type}

Overview

The Upload Document endpoint is used to submit files to the document processing system. Upon successful upload, the document is queued for asynchronous processing, and a unique document_id is returned. This endpoint supports various document types, including invoices, receipts, and bank statements, which influences how the document is processed and the data extracted.

Ensure your account has sufficient credits before uploading. File size is limited to 20MB and PDF documents are limited to 200 pages. Please refer to the error responses for details.

Request

Path Parameters

NameTypeRequiredDescription
doc_typestringYesThe type of document to be uploaded. Valid values are 'invoice', 'receipt', 'bank_statement'.

Headers

NameTypeRequiredDescription
X-API-KeystringYesYour API key for authentication. You can generate the API key in the customer portal.

Request Body

Binary file content (PDF, JPEG, or PNG) as `multipart/form-data`. The field name for the file must be `file`.
 

Code Examples

curl -X POST "https://api.yourapp.com/api/v1/documents/invoice" \
  -H "X-API-Key: pk_abcd1234_secretsecretsecretsecretsecret" \
  -H "Content-Type: multipart/form-data" \
  -F "file=@/path/to/your/invoice.pdf"
 

Response Example

202

Document successfully accepted for processing.

{
  "document_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
  "status": "queued"
}
 

Response Example

400

Invalid file type, no file uploaded, or invalid document type.

{
  "detail": "Invalid file type"
}
 

Response Example

401

Authentication failed.

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

Response Example

403

Insufficient credits.

{
  "detail": "Insufficient credits to process new documents. Please review your account balance."
}
 

Response Example

429

Rate limit exceeded.

{
  "error": "Rate limit exceeded: 1000 per 1 minute"
}