Skip to content

REST API for automated extraction

Connect idpura to n8n, Make, Zapier or any HTTP client. Send documents, receive structured data.

Quick start

  1. Generate your API key

    Go to your account → API section → Create key. The key is shown only once — store it safely.

  2. Send your first request

    Upload documents and receive a job_id to poll for the result.

    curl -X POST https://api.idpura.com/v1/ai-extract \
      -H "X-API-Key: ipd_your_api_key" \
      -F "files=@invoice.pdf" \
      -F 'template=[{"field":"vat_id","type":"string"},{"field":"total","type":"currency"}]' \
      -F "output_format=json"
    
    # Response:
    # { "job_id": "abc-123", "status": "processing", "total_pages": 3, "credits_used": 9 }
  3. Download the result

    Poll the job status and download when ready.

    # 1. Poll status
    curl https://api.idpura.com/v1/jobs/abc-123 \
      -H "X-API-Key: ipd_your_api_key"
    
    # 2. Download result (when status=done)
    curl https://api.idpura.com/v1/jobs/abc-123/result?format=json \
      -H "X-API-Key: ipd_your_api_key"

Endpoints

All endpoints require the X-API-Key header.

Method Path Description Credits
POST /v1/ai-extract Extract fields with AI using your template (PDF, DOCX, images) 3 cr/page
POST /v1/extract Extract text and tables from PDF/DOCX without AI 1 cr/page
POST /v1/section Compare and section 3+ documents of the same type 1–3 cr/page
GET /v1/jobs/{id} Check job status (processing, done, error) 0
GET /v1/jobs/{id}/result Download result as json, xlsx or csv 0

Integration examples

cURL
curl -X POST https://api.idpura.com/v1/ai-extract \
  -H "X-API-Key: ipd_your_api_key" \
  -F "files=@contract.pdf" \
  -F "files=@contract2.pdf" \
  -F 'template=[
    {"field":"full_name","type":"string","description":"Full name"},
    {"field":"sign_date","type":"date"},
    {"field":"amount","type":"currency"}
  ]' \
  -F "language_hint=en" \
  -F "output_format=json"
Python
import requests, json, time

API_KEY = "ipd_your_api_key"
BASE    = "https://api.idpura.com"
headers = {"X-API-Key": API_KEY}

template = [
    {"field": "vat_id", "type": "string"},
    {"field": "total",  "type": "currency"},
    {"field": "date",   "type": "date"},
]

with open("invoice.pdf", "rb") as f:
    resp = requests.post(
        f"{BASE}/v1/ai-extract",
        headers=headers,
        files={"files": f},
        data={"template": json.dumps(template), "output_format": "json"},
    )
job = resp.json()
job_id = job["job_id"]

while True:
    status = requests.get(f"{BASE}/v1/jobs/{job_id}", headers=headers).json()
    if status["status"] == "done":
        break
    if status["status"] == "error":
        raise Exception(status.get("error_message"))
    time.sleep(3)

result = requests.get(
    f"{BASE}/v1/jobs/{job_id}/result",
    headers=headers,
    params={"format": "json"},
)
print(result.json())
n8n
# n8n flow in 4 nodes:

# 1. HTTP Request (POST /v1/ai-extract)
#    - Method: POST
#    - URL: https://api.idpura.com/v1/ai-extract
#    - Auth header: X-API-Key = {{ $vars.IDPURA_API_KEY }}
#    - Body: multipart/form-data
#      files: (Binary field with your document)
#      template: [{"field":"vat_id","type":"string"},{"field":"total","type":"currency"}]
#      output_format: json

# 2. Wait (1-5 seconds depending on batch size)

# 3. HTTP Request (GET /v1/jobs/{id})
#    - URL: https://api.idpura.com/v1/jobs/{{ $json.job_id }}
#    - Repeat with IF node until status = done

# 4. HTTP Request (GET /v1/jobs/{id}/result?format=json)
#    - Use data in next nodes (Spreadsheet, Database, etc.)

Cost per tool

Credits are deducted when the job is submitted, not when you download the result.

Tool Cost Notes
AI Extractor (/v1/ai-extract) 3 cr/page Includes scanned PDFs and images
Extractor (/v1/extract) 1 cr/page Digital PDFs and DOCX
Section (/v1/section without AI) 1 cr/page Minimum 3 documents
Section (/v1/section with AI) 3 cr/page use_ai=true

Rate limiting

100 requests/hour per API key. When the limit is exceeded, you receive a 429 with the Retry-After header indicating how many seconds to wait.

  • X-RateLimit-Limit Requests allowed per window (100)
  • X-RateLimit-Remaining Requests remaining in the current window
  • X-RateLimit-Reset Unix timestamp when the counter resets

Error codes

Code Meaning
400 Invalid request — check the parameters sent
401 Missing or invalid API key
402 Insufficient credits — top up your balance
403 No access to this job (belongs to another user)
404 Job expired or not found (TTL: 24h)
409 Job not yet finished — check status first
429 Rate limit exceeded — use the Retry-After header