Integrate GleanDoc document extraction into your applications.
All API requests require an API key. Pass it in the Authorization header:
Authorization: Bearer gd_your_api_key_here
Upload a document and get structured data back.
POST /api/v1/extract Content-Type: multipart/form-data Parameters: file - The document file (PDF, PNG, JPG, etc.) document_type - One of: invoices, receipts, bank_statements, tax_forms, purchase_orders, packing_slips, contracts, forms, id_documents, medical_records, insurance_claims, utility_bills, pay_stubs, w2_forms, 1099_forms, custom custom_fields - (Optional) JSON array of field names to extract Example (curl): curl -X POST https://your-gleandoc-url/api/v1/extract \ -H "Authorization: Bearer gd_your_api_key" \ -F "[email protected]" \ -F "document_type=invoices" Example (Python): import requests response = requests.post( "https://your-gleandoc-url/api/v1/extract", headers={"Authorization": "Bearer gd_your_api_key"}, files={"file": open("invoice.pdf", "rb")}, data={"document_type": "invoices"} ) data = response.json() print(data["extracted_data"])
{
"document_id": 123,
"status": "completed",
"document_type": "invoices",
"extracted_data": {
"invoice_number": "INV-2024-001",
"invoice_date": "2024-03-15",
"due_date": "2024-04-15",
"vendor_name": "Acme Corp",
"total": 1250.00,
"currency": "USD",
"line_items": [
{"description": "Consulting services", "quantity": 10, "unit_price": 100, "total": 1000},
{"description": "Software license", "quantity": 1, "unit_price": 250, "total": 250}
]
},
"confidence": 0.95,
"processing_time_ms": 1200
}GET /api/v1/documents?limit=20&offset=0
Returns:
{
"documents": [...],
"total": 42,
"limit": 20,
"offset": 0
}GET /api/v1/documents/{document_id}
Returns the full extracted data for a specific document.