API Reference
A REST API for extracting structured data from documents. Send a file, get back structured JSON.
Authentication
All requests require an X-API-Key header. Get your key from Settings → API in your Airparser account.
curl https://api.airparser.com/inboxes \
-H "X-API-Key: YOUR_API_KEY"Store your API key securely — treat it like a password.
Parse Documents
Upload any file and get back fully extracted data in a single synchronous request — no webhooks, no polling, no second call. The response contains all extracted fields as structured JSON, ready to use immediately in your workflow.
curl \
-X POST \
https://api.airparser.com/inboxes/<INBOX_ID>/upload-sync \
-F 'file=@./receipt.pdf' \
-H "X-API-Key: <YOUR_API_KEY>"{
"doc_id": "64abc123def456...",
"parsing_in_progress": false,
"status": "parsed",
"name": "invoice.pdf",
"content_type": "application/pdf",
"created_at": "2026-03-10T12:00:00.000Z",
"processed_at": "2026-03-10T12:00:04.321Z",
"json": {
"invoice_number": "INV-001",
"vendor": "Acme Corp",
"total": 1250.00,
"currency": "USD",
"date": "2024-01-15"
}
}Retrieve Extracted Data
Fetch a document by ID to get its extraction status and results. Poll this endpoint or use webhooks to know when processing is complete.
/documents/{document_id}curl https://api.airparser.com/documents/doc_abc123 \
-H "X-API-Key: YOUR_API_KEY"{
"doc_id": "64abc123def456...",
"parsing_in_progress": false,
"status": "parsed",
"name": "invoice.pdf",
"content_type": "application/pdf",
"created_at": "2026-03-10T12:00:00.000Z",
"processed_at": "2026-03-10T12:00:04.321Z",
"json": {
"invoice_number": "INV-001",
"vendor": "Acme Corp",
"total": 1250.00,
"date": "2024-01-15"
}
}Define Extraction Schema
Define what fields to extract. Supports scalar fields, lists (for line items), and enums.
/inboxes/{inbox_id}/schema{
"fields": [
{
"type": "scalar",
"data": {
"name": "invoice_number",
"description": "Invoice reference number",
"type": "string",
"default_value": ""
}
},
{
"type": "list",
"data": {
"name": "items",
"description": "List of items in the invoice",
"attributes": [
{
"name": "description",
"description": "Item description",
"type": "string",
"default_value": ""
},
{
"name": "amount",
"description": "Item amount",
"type": "decimal",
"default_value": "0.00"
}
]
}
},
{
"type": "enum",
"data": {
"name": "payment_status",
"description": "Current payment status",
"values": ["paid", "pending", "overdue"]
}
}
]
}Post-Processing
Run Python code on extracted data before it's sent to integrations. Add business logic, merge fields, format values.
# Merge first and last name into full name
data['fullname'] = data['first_name'] + " " + data['last_name']
# Using f-strings (recommended)
data["fullname"] = f"{data['first_name']} {data['last_name']}"
# Using format() function
data['fullname'] = '{} {}'.format(data['first_name'], data['last_name'])# Only process invoices above certain amount
if float(data.get('total_amount', 0)) > 1000:
data['priority'] = 'high'
else:
data['priority'] = 'normal'
# Add timestamp
import datetime
data['processed_at'] = datetime.datetime.now().isoformat()Explore advanced post-processing techniques and examples:
Webhooks
Airparser sends a POST request to your endpoint when extraction is complete. Respond with 200 to acknowledge.
Setup steps
- 1 Copy your webhook endpoint URL from your server or a service like ngrok.
- 2 Go to Integrations → Webhooks in your Airparser account.
- 3 Click "Create a webhook" and paste your endpoint URL.
- 4 Test the webhook with a sample document to verify the integration.
import json
from flask import Flask, request
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
payload = request.data
data = json.loads(payload)
# Process the parsed data
# data contains all extracted fields
return {'success': True}
if __name__ == '__main__':
app.run(port=4242)Resources
Looking for a non-technical overview? Read What is a Document Extraction API — covers the concept, use cases, and how Airparser's API works without code examples.
Postman collection