One extraction contract
Natural language or descriptor schemas with exact keys, types, and field-specific rules.
One private, GPU-powered endpoint for PDFs and images. Supply the document path, extraction instructions, document type, and output format—receive production-ready JSON, text, or HTML.
{
"source_document_path": "inputs/invoice.pdf",
"document_type": "invoice",
"response_type": "json",
"instructions": "Extract invoice_number,
supplier_name and grand_total."
}
Natural language or descriptor schemas with exact keys, types, and field-specific rules.
Invoices, IDs, policies, certificates, contracts, receipts, forms, tables, and more.
Files and model inference remain on your GPU server. No third-party OCR service.
QUICK START
The path API reads from approved server directories, configured through OCR_API_SOURCE_ROOTS.
mkdir -p inputs
cp invoice.pdf inputs/Use a user token from the admin panel. The master token also works for administrative testing.
SERVICE_TOKEN="your-user-token"The call remains open while OCR runs. Use a client timeout suitable for multi-page documents.
curl -X POST http://127.0.0.1:7860/api/v1/extract-path \
-H "Authorization: Bearer $SERVICE_TOKEN" \
-H "Content-Type: application/json" \
-d @request.jsonAUTHENTICATION
Create users and tokens at the admin panel. Generated user credentials are shown once, stored only as hashes, and can be expired or revoked immediately.
Authorization: Bearer uocr_your_token
Content-Type: application/jsonAPI REFERENCE
/api/v1/extract-pathSubmit a document already available to the OCR server. The response is synchronous and contains the extracted content plus job metadata and protected artifact URLs.
source_document_pathrequiredstringAbsolute path under an approved root, or a path relative to the project directory.
instructionsoptionalstringNatural-language requirements or a JSON/JavaScript-like descriptor schema. No application character limit.
document_typedefault: autostringAuthoritative context such as invoice, insurance_policy, aadhaar, certificate, or a custom value.
response_typedefault: jsonenumOne of json, text, or html.
modedefault: gundamenumgundam uses detailed crops; base reduces memory usage.
max_output_tokensdefault: 4096integerOutput budget from 1,024 to 32,768 tokens.
expected_valuesoptionalobjectYour own key-value JSON for this document. Supplying it returns a field-by-field comparison against our model output and stores the pair for supervised review. Requires response_type: json.
reference_idoptionalstringYour record identifier, stored with the comparison so you can correlate it later.
LIVE PLAYGROUND
/api/v1/extract-pathRun the request to inspect the live response.
The extraction may take several seconds or minutes depending on document size and GPU state.
RESPONSE OBJECT
model_outputobject · stringThe AI OCR result as key-value JSON. Same value as content.
comparisonobject · nullField-by-field result against expected_values: match_rate, per-field status, and a suggested_verdict. Null when you send no expected values.
review_idnumber · nullIdentifier of the stored review record awaiting accept or reject in the admin panel.
contentobject · stringParsed JSON output, or extracted text/HTML for other response types.
content_textstringSerialized output ready to store, display, or forward.
job_idstringUnique identifier for this extraction job.
duration_secondsnumberTotal OCR and post-processing duration.
preview_urlstringBearer-protected snapshot of the source document.
raw_urlstringBearer-protected raw OCR output for diagnostics.
download_urlstringBearer-protected final result download.
page_countintegerNumber of pages processed from the document.
ERRORS
detail.ADMIN API
Create a user, issue their scoped bearer credential, and revoke access from one protected workflow.
/api/admin/summaryInspect users, active credentials, and service activity.+/api/admin/usersBrowse every user with token and activity metadata.+/api/admin/usersCreate a service user with basic identity details.+/api/admin/users/{user_id}Update profile details or suspend service access.+/api/admin/users/{user_id}/tokensGenerate a new bearer token, optionally with expiry.+/api/admin/tokens/{token_id}Revoke a credential without deleting its owner.+PRODUCTION SECURITY
Place the service behind Nginx, Caddy, Cloudflare Tunnel, or another trusted TLS reverse proxy.
Set OCR_API_SOURCE_ROOTS to dedicated document directories and avoid broad filesystem access.
Keep the master token and SQLite database out of source control. Rotate credentials when access changes.
Add rate limiting, monitoring, backups, job retention, quotas, and audit logs appropriate to your service.