With doc.cheap’s passport OCR API, a Node.js server can send a Base64-encoded image to POST https://api.doc.cheap/v1/scans using built-in fetch and receive scan JSON synchronously. For a reliable integration, treat HTTP success and OCR recognition as separate outcomes, reuse the same idempotency key and request body when retrying one scan, and store the response’s meta.billed value with that scan.
What this integration does—and what it does not
The implementation described here follows doc.cheap’s provider-specific API contract, not a universal OCR standard. The vendor tutorial by Teoh Chin Heng, published September 24, 2026 and updated September 26, 2026, uses Node.js 18+ and its built-in fetch; it does not require an SDK. The API accepts JSON containing a Base64-encoded image and returns structured results in the response to the same request. See the doc.cheap tutorial and doc.cheap API documentation for the provider’s current contract.
As an Amazon Associate I earn from qualifying purchases.
OCR extracts information and reports recognition-related results. The tutorial says authenticity.overall is not_checked. Do not present a successful scan, extracted fields, or an MRZ check as proof that a passport is genuine or that its holder’s identity has been verified.
Recommended Free Tools
Send a passport image with Node.js fetch
Read the image on the server, Base64-encode its bytes, and send JSON to the scans endpoint. Keep the API credential on the server; do not expose it in browser code or send it to a client. The exact authentication header and full payload fields should follow doc.cheap’s current API documentation.
#1 Best Overall
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
import { readFile } from 'node:fs/promises';
const image = await readFile('./passport.jpg');
const payload = {
image: image.toString('base64'),
// Add any other fields required by the current API contract.
};
const body = JSON.stringify(payload);
const response = await fetch('https://api.doc.cheap/v1/scans', {
method: 'POST',
headers: {
'content-type': 'application/json',
// Add the provider's documented authorization header.
},
body,
});
const result = await response.json();
This example shows the image-to-JSON shape, not a complete authentication or production retry implementation. Add the required credential securely, enforce an application-level timeout, and handle responses that are not valid JSON. Serialize the payload once if you will retry: reusing the resulting string helps ensure that each retry has the identical request body.
Check HTTP success before interpreting recognition
Node’s fetch does not reject just because the server returns an HTTP 4xx or 5xx response. Parse the response where possible, check response.ok, and handle transport/API errors before branching on the scan result. A blurry, unreadable, or unsupported image can still produce HTTP 200; HTTP success therefore does not mean that the document was recognized.
The tutorial lists these successful-HTTP recognition statuses and the corresponding response to take:
Rank #2
- Scan documents in seconds: Rapid color or B&W scanning up to 600 DPI and quick startup times of half a second
- Easy One-Button Scanning: Save images with just one touch of the button and equipped with intelligent image processing (cropping, rotation, de-skew) to enable scanning without adjusting settings
- Coverless Scanning: Scan without repetitive opening and closing of the cover
- Scan anywhere, no A/C outlet required: USB power option for portability
- Integrated TWAIN and ISIS driver: Connectivity for compatibility with hundreds of scanning software solutions
meta.status |
Meaning or next step in the vendor tutorial |
|---|---|
recognized |
A document was recognized. Process the returned scan fields according to your application’s requirements. |
no_document_found |
Ask for a better-framed image so the document is in view. |
unreadable |
Ask for improved lighting, focus, or camera angle. |
unsupported_document |
Stop retrying this image as an OCR request; the document type is unsupported. |
rejected |
The tutorial advises retrying a service-side rejection once. |
For HTTP failures, inspect the documented error code rather than retrying every failure. Invalid input, size-limit, authentication, or credit errors need correction; repeating the same request in a loop will not fix them. Confirm current error codes and payload requirements in the API documentation.
Retry one logical scan with one idempotency key
A client timeout is ambiguous: the server may have completed the scan even though your application did not receive its response. For one logical scan, generate one idempotency key, serialize the request once, and reuse both the key and identical body on retry attempts. Do not generate a new key just because an attempt timed out; that could turn a retry into a separate scan.
- Prepare the request. Read and encode the image, build the payload, and serialize it once.
- Assign an identity. Create one unique key for this logical scan, for example with Node’s
crypto.randomUUID(). - Send and retry carefully. Include the same idempotency key on retry attempts and resend the unchanged body. Apply a timeout and retry only errors the provider documents as transient.
- Stop on permanent errors. Correct input, image-size, authentication, or credit problems instead of automatically resubmitting them.
According to the vendor tutorial, reusing a key with a different request body returns 409 idempotency_conflict. Idempotency also has limits: the tutorial says that with retain_hours: 0, a 24-hour replay-unavailable period applies, after which reuse may become a new scan. Retention settings can affect whether an earlier response remains replayable. Check the provider’s current documentation and treat key reuse as protection within the documented behavior—not as a guarantee of unlimited deduplication.
Rank #3
- Multiple Document Reading And Imaging Capability – Imaging In 24-Bit Color - 400 DPI
- Rugged Design, No Moving Parts, Internally Sealed Optical Chamber To Prevent Dust Ingress
- Complete Access To OCR Data And Images Captured Via Software Development Kit (SDK)
- Enables Images To Be Accessed As BMP, PNG Or JPEG Format
- Auto-Triggering Of Document Capture – Presence Of Document Is Automatically Detected
The tutorial says sandbox requests accept the idempotency header but do not use it for charging behavior. Do not infer live billing or live replay behavior from sandbox results.
Store the billed flag with the scan record
meta.billed is a per-response field. Save it alongside the scan result and the application’s identifier for that logical scan, rather than trying to infer cost later from whether the HTTP request succeeded. The vendor tutorial explains that a sandbox response may report whether a corresponding live request would be billed; sandbox use itself is not charged. A sandbox billed: true value is a simulation, not a charge.
For production records, keep the provider’s response metadata distinct from your own payment or accounting records. The billed flag reports what the API says about that response; it is not, by itself, a receipt or a substitute for checking the account’s billing records.
Rank #4
- FREE 5"" x 7"" ID Scanning Notice Included – Every Minor Decliner scanner includes a durable vinyl decal to display at your entrance or point of sale. Alerts customers that IDs are scanned and verified to help deter underage sales, fake IDs, and fraud.
- Unlimited Standard ID Scanning — Always Free - Instantly verifies age and expiration on every scan and automatically creates a compliance log - Eliminates math mistakes and protects your business during inspections.
- STOP FAKE IDs — REAL DETECTION, NOT GUESSWORK: Optional fake ID detection powered by Forensic Barcode Scanning — the industry gold standard. Analyzes encrypted barcode data against a live security database with 90%+ detection accuracy. Includes 6 free scans. After that, simply purchase scan credits. You only pay when you choose to run a fake check. Unlimited fake scans are not available.
- Fast & Easy Operation – Scans U.S. driver’s licenses and state IDs in under 2 seconds. No training required. Designed for high-volume environments.
- Portable, Battery-Powered Design – Built for long shifts per charge with a swappable battery. Fast charging in under 90 minutes for minimal downtime.
Protect passport images and understand the provider terms
Passport images contain sensitive personal information. Do not log the image, Base64 request body, or credentials. The tutorial describes uploads as held in memory rather than written to durable storage, while scan results may be retained; it also says processing occurs in the EU and mentions configurable result retention. These are vendor-published statements, not an independent security audit. Confirm current retention, data handling, and regional processing terms before using real documents in production.
The tutorial describes a return_portrait: false option for cases where the portrait crop is not needed. Use it where appropriate under the current API contract, and test with a synthetic specimen rather than a real passport during development.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Know the current limits and pricing are provider-specific
The following figures are doc.cheap terms reported in its 2026 tutorial and documentation, not general OCR-service benchmarks. Limits and prices can change, so verify the current terms before relying on them.
| Item | Doc.cheap figure reported in 2026 | Qualification |
|---|---|---|
| Unauthenticated/free access | 10 free recognized documents per IP address in total; up to 10 requests per hour | Reported by the tutorial published September 24, 2026 and updated September 26, 2026. |
| Account allowance | 100 free documents each month | Reported for doc.cheap in 2026. |
| Live price | $0.01 per billed live document | Reported for doc.cheap in 2026; applies to billed live documents, not sandbox use. |
| Registered-key rate limit | 60 requests per minute | Reported by the tutorial in 2026. |
These figures describe the vendor’s reported product terms; they do not establish that every scan is billed or that all accounts have identical terms. The sandbox’s billed field simulates whether a corresponding live request would be billed, while sandbox use itself is free.
When direct fetch is not the preferred interface
If you prefer an SDK, StructOCR documents a Node.js SDK with scanPassport() and Base64 conversion, as well as a JSON/Base64 REST API. That documentation establishes an alternative input interface, but not equivalent pricing, idempotency, billed-flag, or retention behavior. Compare those specific contract details before choosing a provider; the available documentation does not support a like-for-like comparison on them.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




