Document AI API reference.
Quickstart, authentication, endpoint reference, and async patterns for OCR, Aadhaar Masking, Extraction Basic + Pro, and Document Analysis.
Quickstart
From signup to first API call in 5 minutes. Pick a language SDK or use REST directly.
1. Get an API key
Go to abscode.com/signup. No credit card required. You'll receive free trial credit and an API key immediately.
2. Install the SDK
pip install abscode
3. Make your first call
from abscode import DocumentAI client = DocumentAI(api_key="abs_sk_...") result = client.ocr.extract( file="path/to/document.pdf" ) print(result.text) print(result.confidence)
Authentication
All API calls require an API key passed in the Authorization header. Keys are issued in the portal and can be rotated at any time.
Key format
API keys start with abs_sk_ (live) or abs_test_ (sandbox). Never expose live keys in client-side code, use a server-side proxy for browser and mobile contexts.
curl -X POST https://api.abscode.com/v1/ocr/extract \ -H "Authorization: Bearer abs_sk_..." \ -F "file=@document.pdf"
Rate limits
Per-account rate limits prevent runaway costs and protect fair-use for all customers. Scale with your top-up pack.
| Pack | Requests/sec | Concurrent | Burst |
|---|---|---|---|
| Free trial | 2 req/sec | 4 | 10 |
| Mini Pack + | 10 req/sec | 20 | 50 |
| Starter Pack + | 30 req/sec | 60 | 150 |
| Growth Pack + | 60 req/sec | 120 | 300 |
| Scale Pack | 200 req/sec | 400 | 1000 |
| Enterprise | Custom | Custom | Custom |
Rate-limit headers on every response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.
Error codes
All errors return a JSON body with code, message, and request_id.
| HTTP | Code | Meaning |
|---|---|---|
| 400 | invalid_request | Bad parameter, malformed file, unsupported format |
| 401 | invalid_api_key | Missing or revoked key |
| 402 | insufficient_credit | Wallet credit exhausted, top up to continue |
| 413 | file_too_large | File above the per-call size limit |
| 429 | rate_limited | Slow down, see Retry-After header |
| 500 | server_error | Transient, retry with exponential backoff |
OCR Full Text · POST /v1/ocr/extract
Pricing: flat per-page
Extract every word from PDFs, TIFFs, scanned images, and photos. Returns raw text, per-page confidence, and an optional searchable PDF overlay.
Request
| Param | Type | Notes |
|---|---|---|
file | multipart | PDF, TIFF, JPG, PNG (required) |
languages | string[] | e.g. ["en", "hi", "ta"], defaults to auto-detect |
output_searchable_pdf | boolean | If true, returns URL to PDF with text overlay |
async | boolean | If true, returns a job_id instead of inline result |
Example
result = client.ocr.extract( file="document.pdf", languages=["en", "hi"], output_searchable_pdf=True ) print(result.text) print(result.searchable_pdf_url)
Aadhaar Masking · POST /v1/aadhaar-masking/redact
Pricing: flat per-page
Availability: India only.
UIDAI-compliant automatic Aadhaar number redaction. Detects 12-digit Aadhaar patterns and QR code regions across documents. Output preserves the original document layout.
Request
| Param | Type | Notes |
|---|---|---|
file | multipart | PDF, TIFF, JPG, PNG (required) |
async | boolean | For large multi-page KYC bundles |
result = client.aadhaar_masking.redact( file="customer_kyc_pack.pdf" ) print(result.masked_pdf_url) print(result.redactions_count)
Extraction Basic · POST /v1/extraction/basic
Pricing: flat per-page
Pre-trained extraction for invoices, bank statements, receipts, KYC forms, contracts, payslips, lab reports, and ID documents. Returns named fields with bounding boxes.
Request
| Param | Type | Notes |
|---|---|---|
file | multipart | PDF, TIFF, JPG, PNG (required) |
document_type | string | e.g. invoice, bank_statement, receipt, kyc, payslip |
schema | object | Optional override of the default field schema |
result = client.extraction.basic( file="invoice.pdf", document_type="invoice" ) print(result.fields) # {'invoice_number': 'INV-2026-001', 'total': 12450.00...}
Extraction Pro · POST /v1/extraction/pro
Pricing: flat per-page
Everything in Extraction Basic, plus per-field confidence scores, format validation (GSTIN, IFSC, PAN, Aadhaar VID, IBAN), and cross-field guardrails (invoice total reconciles, bank statement balances, date plausibility).
{
"invoice_number": { "value": "INV-2026-0017", "confidence": 0.99 },
"vendor_gstin": { "value": "27AAAAA0000A1Z5", "confidence": 0.94,
"validation": "passed", "check_digit": "verified" },
"total_amount": { "value": 12450.00, "confidence": 0.97,
"reconciles_with_line_items": true },
"guardrails": { "all_passed": true, "warnings": [] }
}Document Analysis · POST /v1/analysis/run
Pricing: Custom, contact sales for scoping
Rule-based intelligent document review, NDA gap analysis, contract compliance, regulatory filing validation, policy adherence checks. Rules are codified per use case during onboarding, then exposed as an endpoint scoped to your account.
How it works
Discovery call → rule configuration on your sample document set → sandbox endpoint → production integration → quarterly rule tuning. Most engagements ship within 4–6 weeks. Learn more →
Jobs API (async)
For multi-page documents, batches, or any workload where synchronous response time matters less than throughput, use the async pattern:
# 1. Create job job = client.jobs.create(api="extraction.basic") # 2. Upload one or more documents client.jobs.upload(job.id, file="batch_001.pdf") # 3. Poll or receive webhook status = client.jobs.get(job.id)
Webhooks
Register a callback URL in the portal. We POST job.completed events with a signed payload (HMAC-SHA256). Retry policy: exponential backoff for 24 hours.
{
"event": "job.completed",
"job_id": "job_01HZ...",
"api": "extraction.basic",
"result_url": "https://api.abscode.com/v1/jobs/job_01HZ.../result",
"timestamp": "2026-06-08T05:21:11Z"
}Server SDKs
| SDK | Latest | Package |
|---|---|---|
| Python | 1.0.0 | abscode |
| Node.js / TypeScript | 1.0.0 | @abscode/sdk |
| Java | 1.0.0 | com.abscode:sdk |
| .NET | 1.0.0 | Abscode.Sdk |
| Go | 1.0.0 | github.com/abscode/go-sdk |
This is a docs landing page
Full documentation will include interactive API explorers, request/response schemas, embedded sandbox per endpoint, OpenAPI / Swagger spec, and per-use-case tutorial guides. This page shows the structure and entry points.