Getting Started
Quickstart
Make your first document extraction in under 2 minutes.
1
Get your API key
Sign up for free — you get 100 extractions/month on the free plan with no credit card required. After signing up, head to the API Keys page in your dashboard to generate your first key.
Security:Never expose your API key in client-side code, public repos, or frontend JavaScript. Always call the API from your backend server.
2
Make your first request
Send any document (PDF, PNG, JPG, WEBP) as a multipart/form-data POST request.
terminal
curl -X POST https://api.documentflowai.com/v1/extract \
-H "Authorization: Bearer af_YOUR_API_KEY_HERE" \
-F "[email protected]"3
Get structured JSON back
The API returns clean, structured JSON matching the document type's schema.
response.json
{
"job_id": "extr_a1b2c3d4e5f6",
"status": "success",
"document_type": "invoice",
"document_category": "financial",
"confidence": 0.97,
"vendor": {
"name": "Acme Corporation",
"tax_id": "27AABCU9603R1ZX",
"address": "Mumbai, Maharashtra",
"country": "IN"
},
"document_meta": {
"invoice_number": "INV-2024-0042",
"date": "2024-03-15",
"currency": "INR",
"language": "en"
},
"financial": {
"line_items": [
{
"description": "Cloud Services - March",
"quantity": 1,
"unit_price": 4200.00,
"total": 4200.00,
"tax_rate": 18.0
}
],
"totals": {
"subtotal": 4200.00,
"cgst": 378.00,
"sgst": 378.00,
"grand_total": 4956.00
}
},
"validation": {
"math_valid": true,
"warnings": []
}
}SDK Examples
Python
extract.py
import requests
API_KEY = "af_YOUR_API_KEY_HERE"
BASE_URL = "https://api.documentflowai.com/v1"
with open("invoice.pdf", "rb") as f:
response = requests.post(
f"{BASE_URL}/extract",
headers={"Authorization": f"Bearer {API_KEY}"},
files={"file": f},
)
data = response.json()
print(f"Document type: {data['document_type']}")
print(f"Confidence: {data['confidence']:.0%}")
if data.get("financial"):
print(f"Grand total: {data['financial']['totals']['grand_total']}")Node.js
extract.ts
import fs from "fs";
const API_KEY = "af_YOUR_API_KEY_HERE";
const BASE_URL = "https://api.documentflowai.com/v1";
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("invoice.pdf")]), "invoice.pdf");
const res = await fetch(`${BASE_URL}/extract`, {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}` },
body: form,
});
const data = await res.json();
console.log(data.document_type, data.confidence);Next steps:Read the full Extract endpoint reference for all request parameters, response fields, and advanced options like schema hints and language overrides.