DocExtract API Documentation
Convert Image files into structured data using AI-powered parsing with Django integration.
Base URL
POST https://docextract.ai/api/v2/docextract/image/
All API requests should be made to this endpoint using the POST method.
Authentication
Include your API key in every request for authentication. Get Your api keys at docextract.ai/manage-api
api_key = "ABCDE*****"
| Field | Location | Required | Description |
|---|---|---|---|
api_key |
Form Data | Required | Unique key issued per organization |
Request Parameters
Content-Type: multipart/form-data
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file |
File | Required | - | The Image file to process |
api_key |
String | Required | - | Organization's API key |
format |
List | Optional | - | List of column headers |
keep_records |
Boolean | Optional | False | Whether to store extracted data in DocExtract also return list of image urls |
output_image_format |
String | Optional | - | if you want base64-Image then use 'base64' |
Example: cURL Request
curl -X POST https://docextract.ai/api/v1/docextract/image/ \ -F "file=@invoice.png" \ -F "api_key=ABCDE*****" \ -F "format="[description, quantity]" \ -F "keep_records=true"\ -F "output_image_format=base64" \
Response Schema
Success Response (200 OK)
Returned upon successful image processing.
{
"status": "Success",
"filename": "sample_receipt.png",
"data": {
"image": "<base64-Image>"
"analysis": dataframe or json
}
"remaining_docs": 297,
"size": 156,
"s3_image_urls": [
//list of image urls
],
"s3_csv_url": csv url,
}
Common Error Responses
Invalid API Key (401 Unauthorized)
Returned when the API key fails server-side validation.
{
"error": "[APIKeyValidationError 401]: Unexpected server error during API key validation."
}
Missing Form Fields (400 Bad Request)
Returned if the file or api_key fields are missing from the request. This can also occur if the file field is present but has no data.
{
"file": ["This field is required."],
"api_key": ["This field is required."]
}
Unsupported File Format (400 Bad Request)
Returned when a file with an unsupported extension (e.g., .txt, .docx) is sent.
{
"status": "error",
"message": "Processing failed: cannot identify image file "
}
Usage Limit Exceeded
Returned when the monthly page limit for the API key has been exceeded.
{
"error": "Monthly page limit exceeded."
}
File Processing Error (500 Internal Server Error)
A server-side error returned when the backend fails to process the file, such as when sending a non-image file (e.g., a PDF) to the /image/ endpoint.
{
"error": "File processing failed"
}
Processing Workflow
- API Key Validation - Verify authentication credentials
- File Reading & Format Check - Validate Image file integrity
- Page Count & Quota Check - Verify available credits
- Concurrent Page Processing - Asynchronous AI parsing
- Data Aggregation - Compile results in JSON/DataFrame format
- S3 Upload - Store results if enabled
Quota Management
| Metric | Description |
|---|---|
credits |
Pages remaining in current billing cycle |
monthly_page_processed |
Total pages processed this month |
storage_used |
Bytes stored in S3 storage |
Security & Encryption
- Unique API keys per organization
- Sanitized file handling and validation
- End-to-end encryption for extracted data
- Built-in quota and abuse protection
Sample Output
{
"image": "<base64-Image>",
"analysis": {
"Invoice Number": "INV-2034",
"Total": "1,250.00",
"Date": "2024-01-15",
"Vendor": "Acme Corp"
}
}