API Documentation

Integrate GleanDoc document extraction into your applications.

Authentication

All API requests require an API key. Pass it in the Authorization header:

Authorization: Bearer gd_your_api_key_here

Get your API key from the dashboard →

Extract Document

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"])

Response Format

{
  "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
}

List Documents

GET /api/v1/documents?limit=20&offset=0

Returns:
{
  "documents": [...],
  "total": 42,
  "limit": 20,
  "offset": 0
}

Get Document

GET /api/v1/documents/{document_id}

Returns the full extracted data for a specific document.

Pricing

API usage is included in all paid plans. Pay-as-you-go: $0.04/document.

View full pricing →

Get Your Free API Key →