API reference
Form to JSON API
Filled form photo, scan or PDF to JSON: your fields or every field and checkbox. Handwriting OK.
- Host
form-to-json-handwritten-printed-form-ocr.p.rapidapi.com- Base path
/v1/form-ocr- Auth
X-RapidAPI-Key,X-RapidAPI-Host- For agents
openapi.json·form-ocr.md
Overview and pricing · Tutorial: Form to JSON API · RapidAPI playground (opens in a new tab) ↗ · Apify actor (opens in a new tab) ↗
Form Extraction
A form image or PDF to JSON: your fields, or every field found.
Extract Form from URL
POST /v1/form-ocr/extract
Read a filled-in form from its URL into JSON. A photo, scan or PDF of a filled-in form (typed or handwritten) as JSON. With `fields`: one typed value per field you name, checked against the page's own text. Without: every field (label and value), checkbox, option group, table and signature box. 1 credit per page (PDF: up to 10 pages).
| Parameter | In | Type | Description |
|---|---|---|---|
url required |
body | string |
Direct link to a form: an image (PNG, JPEG, WEBP, HEIC, GIF, BMP, TIFF) or a PDF, up to 20 MB. |
fields |
body | object[] |
The values you want, each with a name, a type and an optional short description of where it is on the form. Leave empty to get every field of the form (labels, values, checkboxes, tables, signatures). |
pages |
body | string |
PDF only: pages to read, e.g. '1-2' or '1,3'. All when empty. |
curl -X POST "https://form-to-json-handwritten-printed-form-ocr.p.rapidapi.com/v1/form-ocr/extract" \
-H "X-RapidAPI-Key: YOUR_API_KEY" \
-H "X-RapidAPI-Host: form-to-json-handwritten-printed-form-ocr.p.rapidapi.com" \
-H "Content-Type: application/json" \
-d '{
"url": "https://upload.wikimedia.org/wikipedia/commons/a/aa/World_War_I_Draft_Registration_Card_for_Louis_Armstrong_1918.gif",
"fields": [
{
"name": "full_name",
"type": "string"
},
{
"name": "date_of_birth",
"type": "date"
},
{
"name": "race",
"type": "string"
},
{
"name": "employer",
"type": "string"
},
{
"name": "signed",
"type": "boolean",
"description": "is it signed"
}
]
}'
import requests
url = "https://form-to-json-handwritten-printed-form-ocr.p.rapidapi.com/v1/form-ocr/extract"
payload = {
"url": "https://upload.wikimedia.org/wikipedia/commons/a/aa/World_War_I_Draft_Registration_Card_for_Louis_Armstrong_1918.gif",
"fields": [
{
"name": "full_name",
"type": "string"
},
{
"name": "date_of_birth",
"type": "date"
},
{
"name": "race",
"type": "string"
},
{
"name": "employer",
"type": "string"
},
{
"name": "signed",
"type": "boolean",
"description": "is it signed"
}
]
}
headers = {
"X-RapidAPI-Key": "YOUR_API_KEY",
"X-RapidAPI-Host": "form-to-json-handwritten-printed-form-ocr.p.rapidapi.com",
}
r = requests.post(url, json=payload, headers=headers)
print(r.json())
const res = await fetch("https://form-to-json-handwritten-printed-form-ocr.p.rapidapi.com/v1/form-ocr/extract", {
method: "POST",
headers: {
"X-RapidAPI-Key": "YOUR_API_KEY",
"X-RapidAPI-Host": "form-to-json-handwritten-printed-form-ocr.p.rapidapi.com",
"Content-Type": "application/json",
},
body: JSON.stringify({
"url": "https://upload.wikimedia.org/wikipedia/commons/a/aa/World_War_I_Draft_Registration_Card_for_Louis_Armstrong_1918.gif",
"fields": [
{
"name": "full_name",
"type": "string"
},
{
"name": "date_of_birth",
"type": "date"
},
{
"name": "race",
"type": "string"
},
{
"name": "employer",
"type": "string"
},
{
"name": "signed",
"type": "boolean",
"description": "is it signed"
}
]
}),
});
console.log(await res.json());
Extract Uploaded Form
POST /v1/form-ocr/extract/upload
Read an uploaded filled-in form into JSON. Same as /extract, for a file sent as multipart/form-data (field `file`; `fields` as a JSON array string).
| Parameter | In | Type | Description |
|---|---|---|---|
file required |
form | file |
Form image or PDF, up to 20 MB. |
fields |
form | string |
The values you want, each with a name, a type and an optional short description of where it is on the form. Leave empty to get every field of the form (labels, values, checkboxes, tables, signatures). Sent as a JSON array. |
pages |
form | string |
PDF only: pages to read, e.g. '1-2' or '1,3'. All when empty. |
curl -X POST "https://form-to-json-handwritten-printed-form-ocr.p.rapidapi.com/v1/form-ocr/extract/upload" \
-H "X-RapidAPI-Key: YOUR_API_KEY" \
-H "X-RapidAPI-Host: form-to-json-handwritten-printed-form-ocr.p.rapidapi.com" \
-F "file=@./my-file"
import requests
url = "https://form-to-json-handwritten-printed-form-ocr.p.rapidapi.com/v1/form-ocr/extract/upload"
headers = {
"X-RapidAPI-Key": "YOUR_API_KEY",
"X-RapidAPI-Host": "form-to-json-handwritten-printed-form-ocr.p.rapidapi.com",
}
with open("my-file", "rb") as f:
r = requests.post(url, headers=headers, files={"file": f})
print(r.json())
import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("file", new Blob([await readFile("my-file")]), "my-file");
const res = await fetch("https://form-to-json-handwritten-printed-form-ocr.p.rapidapi.com/v1/form-ocr/extract/upload", {
method: "POST",
headers: {
"X-RapidAPI-Key": "YOUR_API_KEY",
"X-RapidAPI-Host": "form-to-json-handwritten-printed-form-ocr.p.rapidapi.com",
},
body: form,
});
console.log(await res.json());
Response
{
"source": "https://upload.wikimedia.org/wikipedia/commons/a/aa/World_War_I_Draft_Registration_Card_for_Louis_Armstrong_1918.gif",
"mime_type": "image/jpeg",
"mode": "fields",
"page_count": 1,
"pages_read": [1],
"title": "REGISTRATION CARD",
"languages": ["en"],
"handwriting": true,
"data": {
"full_name": "Lewis Armstrong",
"date_of_birth": "1900-07-04",
"race": "Negro",
"employer": "Peter Lala",
"signed": true
},
"fields": [
{ "name": "full_name", "type": "string", "value": "Lewis Armstrong", "page": 1, "handwritten": true, "confidence": "high" },
{ "name": "date_of_birth", "label": "Date of Birth", "type": "date", "value": "1900-07-04", "page": 1, "handwritten": true, "confidence": "high" },
{ "name": "race", "label": "Negro", "type": "string", "value": "Negro", "page": 1, "handwritten": true, "confidence": "high" },
{ "name": "employer", "label": "EMPLOYER'S NAME", "type": "string", "value": "Peter Lala", "page": 1, "handwritten": true, "confidence": "high" },
{ "name": "signed", "label": "REGISTRANT'S SIGNATURE OR MARK", "type": "boolean", "value": true, "page": 1, "handwritten": true, "confidence": "high" }
],
"filled": 5,
"empty": 0,
"text": "REGISTRATION CARD\n\nSERIAL NUMBER\t928\tORDER NUMBER\t4177\n\n1. Lewis Armstrong\n(First name) (Middle name) (Last name)\n2. PERMANENT HOME ADDRESS: 1233 Perdido St. N.O. La.\n...",
"truncated": false,
"credits": 1
}
From a real response on Louis Armstrong's 1918 draft registration card (U.S. National Archives, public domain), text shortened. data is ready to store; fields adds the printed label, the page, handwriting and legibility of each value.
Why developers pick this API
- 🛡️ No invented values: a value that is not on the form is
null, never a guess. Text values are matched against an independent transcription of the page, so a field description cannot make the model write something else. - 🧾 Full text included: in fields mode you also get the whole form as text, for search or audit, at no extra cost.
- 💸 Priced per page, not per field: about $0.0104 a page on PRO, where Google Document AI's Form Parser costs $0.03, AWS Textract forms $0.05 and other form APIs on RapidAPI $0.02 to $0.15. Failed calls (4xx, 5xx) use 0 credits.
- 🧰 One call, any form: no template to train, no zones to draw. A new form layout works on the first call.
Auto mode: every field
Send no fields and the API lists everything the form asks for, filled or blank:
{
"mode": "auto",
"title": "REGISTRATION CARD",
"data": {
"serial_number": "928",
"name_first_name": "Lewis",
"name_middle_name": null,
"name_last_name": "Armstrong.",
"permanent_home_address_street": "Perdido St.",
"date_of_birth_month": "July",
"race_white": false,
"race_negro": true,
"present_occupation": "Musician",
"employers_name": "Peter Lala.",
"nearest_relative_name": "Mary Armstrong, mother",
"...": "..."
},
"fields": [
{ "name": "name_first_name", "label": "Name - First name", "type": "text", "value": "Lewis", "page": 1, "handwritten": true, "confidence": "high" },
{ "name": "race_negro", "label": "RACE - Negro", "type": "checkbox", "value": true, "page": 1, "handwritten": true, "confidence": "high" },
{ "...": "..." }
],
"tables": [],
"signatures": [{ "label": "(Registrant's signature or mark)", "signed": true, "page": 1 }],
"filled": 25,
"empty": 13,
"credits": 1
}
From a real response on the same card, shortened. Auto values are strings as written (checkboxes are true/false, option groups give the chosen option); keys come from the printed labels and stay unique. Tables come back as headers and rows.
How it works
- Download (or upload) of the file; GIF, BMP, TIFF and very large images become JPEG; PDF pages are cut one by one.
- Read at high resolution by a vision AI model, told to copy values exactly as written, never to infer or translate, and to mark unreadable words
[illegible]. - Check (fields mode): a second reading, which never sees your field list, transcribes each page; every text value and label must be found in it (small handwriting differences allowed) or it is dropped. Values typed into fillable PDFs count as on the page.
- Type the values: numbers without currency or separators, dates as
YYYY-MM-DDread in the form's own day/month order, checkboxes astrue/false.
Privacy
Forms are downloaded, read and discarded: neither the file nor its content is stored by the API, and nothing is logged. The AI sub-processor may keep requests temporarily for abuse monitoring.
Errors
{ "error": { "status": 400, "code": "too_many_pages", "message": "At most 10 pages per call: choose them with 'pages'." } }
| Status | code |
Meaning |
|---|---|---|
| 400 | invalid_request |
Fix the input: field names (letters, digits, _), types, 40 fields at most. |
| 400 | invalid_url, site_unreachable, site_blocked, file_too_large |
The file could not be downloaded (down, protected, over 20 MB). |
| 400 | unsupported_file, pdf_encrypted |
Not an image or a PDF, or a password-protected PDF. |
| 400 | too_many_pages, invalid_pages, plan_limit |
More than 10 pages, a bad pages range, or more than 1 page on the free plan. |
| 429 | daily_limit_reached |
Daily safety limit of your plan; resets at 00:00 UTC. |
| 503 | ai_error, capacity_exhausted |
Temporary failure. Retry. Not billed. |
Limits
Very faded or cramped handwriting can be misread, like it would by a person: check uncertain and confidence and keep a human in the loop for those values. Dense tables of more than a few hundred cells may be cut (truncated: true). PDFs: 10 pages per call; password-protected PDFs are refused.
Use it from an AI agent
Add this MCP server and the Form OCR to JSON - Handwritten & Printed Forms actor becomes a tool your agent can call. Works in Claude, Cursor, VS Code and any MCP client; billed per event through Apify.
https://mcp.apify.com?tools=helenisapi/form-ocr-to-json-handwritten-printed-forms
Prefer plain HTTP? Give your agent the OpenAPI document or the Markdown reference.