API Documentation

Everything you need to start extracting structured data.

Authentication

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

Authorization: Bearer dm_your_api_key_here

Extract Data

POST /api/v1/extract/

Submit a document for extraction. By default, the request blocks until the result is ready (up to 30 seconds). Set "wait": false for async mode.

Request Body

{
  "document_text": "Your raw document text...",
  "template": {
    "field_name": null,
    "list_field": [],
    "nested": { "name": null, "email": null }
  },
  "wait": true,
  "schema_type": "invoice",
  "generation_config": {
    "temperature": 0.1,
    "max_tokens": 512
  }
}
document_text

Required. Raw text to extract from (max 50k chars).

template

Required. JSON object defining the structure you want. Use null for values, [] for lists.

wait

Optional, default true. Set false for async mode.

schema_type

Optional. Label for analytics (e.g. "invoice", "email").

generation_config

Optional. Override model parameters.

Response (sync mode)

{
  "job_id": "550e8400-e29b-41d4-...",
  "status": "success",
  "extracted_data": {
    "field_name": "extracted value",
    "list_field": ["item1", "item2"]
  },
  "metadata": {
    "latency_ms": 570,
    "credits_charged": 1
  }
}

Poll for Result (Async)

GET /api/v1/extract/{job_id}/

When using async mode (wait: false), poll this endpoint to check if the result is ready.

Quick Start (curl)

Sync extraction
curl -X POST https://your-domain.com/api/v1/extract/ \
  -H "Authorization: Bearer dm_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "document_text": "Invoice #2847\nDate: 2026-01-15\nTotal: €1,249.00",
    "template": {
      "invoice_number": null,
      "date": null,
      "total_amount": null
    }
  }'

Error Codes

401

Invalid or missing API key.

402

Insufficient credits. Purchase more at /api/v1/billing/purchase/.

503

GPU server unavailable. Try again shortly.

504

Job timed out. Use async mode for large documents.