extract_document_json
Extract strict, structured JSON matching any custom JSON schema or field template from a PDF or image (PNG, JPG, WEBP, TIFF). Ideal for developer pipelines, ERP/accounting ingestion, and custom document fields. Works on the free tier (2 free docs/day) or with a Smart OCR API key (10 free credits at https://smartocr.dev).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"schema": "<schema>"
},
"name": "extract_document_json"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | Target JSON schema or key-value object template describing the fields to extract (e.g., {"vendorName": "string", "invoiceNumber": "string", "invoiceDate": "string", "totalAmount": "number", "lineItems": [{"description": "string", "quantity": "number", "amount": "number"}]}). | |
| api_key | No | Optional Smart OCR API key from https://smartocr.dev (can also be sent via x-api-key header). If omitted, uses the free tier (2 free docs/day). | |
| file_url | No | Public HTTP/HTTPS URL to a PDF, PNG, JPG, WEBP, or TIFF document to extract. | |
| file_name | No | Optional filename with extension (e.g., "invoice.pdf"). | |
| file_base64 | No | Base64-encoded document content (raw base64 or data:...;base64,... URI). Provide either file_url or file_base64. |