Google Lens OCR API — Image to Text, Batch OCR & PDF avatar

Google Lens OCR API — Image to Text, Batch OCR & PDF

Pricing

from $2.99 / 1,000 ocr images

Go to Apify Store
Google Lens OCR API — Image to Text, Batch OCR & PDF

Google Lens OCR API — Image to Text, Batch OCR & PDF

OCR API powered by Google Lens: image to text, batch OCR up to 50 URLs, PDF pages, base64 input, word/line bounding boxes, translation. Standby REST API or dataset batch mode. Pay per successful OCR. Receipt & document scanning.

Pricing

from $2.99 / 1,000 ocr images

Rating

0.0

(0)

Developer

Andrej Kiva

Andrej Kiva

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Share

Google Lens OCR API — Image to Text, Batch OCR, PDF & Receipt Scanning

Disclaimer: This is an unofficial integration developed independently. It is not affiliated with, sponsored by, or endorsed by Google LLC or any of its subsidiaries.

Google Lens and related names are trademarks of Google LLC. OCR is performed on images supplied by the user via the same public Lens endpoint used by the Chrome browser.

This Actor is provided for informational, automation, and document-processing purposes only. You are solely responsible for ensuring you have the rights to process submitted images and for complying with applicable data protection regulations (GDPR, CCPA, and similar laws).

Turn images and PDFs into structured text with a production-ready OCR API on Apify. Extract plain text, line-level layout, word-level bounding boxes, and optional translation — from a single photo, a batch of up to 50 URLs, or a base64-encoded file without hosting it publicly.

Built for developers and automation teams who need reliable image-to-text, receipt OCR, invoice scanning, document digitization, and PDF page extraction without running headless browsers. Two execution modes: Standby REST API (persistent HTTP server, low cold-start latency) and batch Actor runs (dataset output for pipelines and schedules).

Best for: receipt and invoice OCR pipelines, scanned document extraction, multilingual text capture, n8n/Make/Zapier workflows, RPA bots, catalog digitization, and bulk image-to-text export as JSON or CSV.

When to use this Actor

  • Receipt & invoice OCR — Pull line items, totals, and dates from photos of paper receipts, bills, and shipping labels.
  • Batch image-to-text — Process up to 50 image URLs in one run with parallel workers; ideal for nightly document folders.
  • PDF text extraction — Pass a PDF URL; each rendered page is OCR'd separately (configurable maxPdfPages, 1 page = 1 billable OCR event).
  • Layout-aware extraction — Return normalized and pixel bounding boxes at word, line, or paragraph level for downstream parsing or UI overlays.
  • Private images via base64 — OCR local files without uploading them to a public CDN first.
  • Translation workflows — Extract text and optionally translate output with the translateTo ISO 639-1 language code.
  • Low-latency API integrations — Standby mode exposes GET /ocr, POST /ocr, and GET /health for direct HTTP calls from your app or automation tool.

When not to use this Actor

  • Guaranteed handwriting accuracy — Printed text and clear scans work best; faint, historical, or heavily cursive handwriting may return empty results.
  • Scanned PDFs with embedded text layers — This Actor OCRs page images; native digital PDFs with selectable text may be better handled by a dedicated PDF text parser.
  • Real-time video OCR — Designed for static images and PDF pages, not live camera streams.
  • Authenticated private portals — Only processes URLs and files you can supply directly; no login or session management for gated sites.

OCR Pipeline

Input sources Processing Output
──────────────────── ───────────────────── ──────────────────────
imageUrl (single) ──► Google Lens OCR engine ──► fullText
imageUrls (batch) ──► + optional translation ──► lines / words
imageBase64 ──► + PDF page rendering ──► bounding boxes
PDF URL ──► parallel workers ──► dataset or JSON API

Key Features

  • Dual execution modes — Standby REST API for integrations; batch mode writes structured rows to the Apify dataset.
  • Batch up to 50 images — Parallel processing with configurable concurrency for one-off jobs and scheduled pipelines.
  • PDF support — JPEG, PNG, WebP, BMP, TIFF, HEIC, GIF, and multi-page PDF documents.
  • Four output detail levelsfull, lines, words, or text_only to balance richness vs payload size.
  • Bounding boxes — Normalized center/width/height plus pixel coordinates for words, lines, and paragraphs.
  • Language & region hints — ISO 639-1 language and ISO 3166-1 region codes improve accuracy for locale-specific formats.
  • Base64 input — Raw base64 or data:image/...;base64,... data URIs supported in batch and Standby POST requests.
  • Pay per successful OCR — Charged only when text is extracted successfully; failed or empty results are not billed.
  • Lightweight HTTP stack — No headless browser; uses curl_cffi with residential proxy rotation for stable production runs.

Pricing

PlanPrice per 1,000 OCRs
Free$2.99
Starter$2.49
Scale$1.99
Business$1.49

5 free trial runs — no credit card required.

Failed OCRs (non-empty error field or no extracted text) are not charged.


How to Use

Option 1: REST API (Standby Mode)

Best for developers, microservices, and automation platforms. Enable Standby when starting the Actor; use the Standby URL shown in the Apify Console.

Authentication: Apify API token as Authorization: Bearer YOUR_TOKEN or token=YOUR_TOKEN query parameter.

OCR an image by URL (GET)

curl "{STANDBY_ACTOR_URL}/ocr?imageUrl=YOUR_IMAGE_URL" \
-H "Authorization: Bearer YOUR_TOKEN"

OCR a local image via base64 (POST)

BASE64=$(base64 -i photo.jpg)
curl -X POST "{STANDBY_ACTOR_URL}/ocr" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"imageBase64\": \"$BASE64\", \"outputDetail\": \"lines\"}"

Batch OCR — multiple URLs (POST)

curl -X POST "{STANDBY_ACTOR_URL}/ocr" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"imageUrls": ["IMAGE_URL_1", "IMAGE_URL_2", "IMAGE_URL_3"],
"outputDetail": "lines",
"language": "de"
}'

Python (requests)

import base64
import requests
TOKEN = "your_apify_token"
BASE = "{STANDBY_ACTOR_URL}" # from Apify Console → Standby
HEADERS = {"Authorization": f"Bearer {TOKEN}"}
# From URL
resp = requests.get(f"{BASE}/ocr", headers=HEADERS, params={
"imageUrl": "YOUR_IMAGE_URL",
"outputDetail": "lines",
"language": "en",
})
print(resp.json()["fullText"])
# From base64 file
with open("receipt.jpg", "rb") as f:
img_b64 = base64.b64encode(f.read()).decode()
resp = requests.post(f"{BASE}/ocr", headers=HEADERS, json={
"imageBase64": img_b64,
"outputDetail": "full",
})
for line in resp.json()["lines"]:
print(line["text"])

n8n / Make / Zapier

Add an HTTP Request step targeting {STANDBY_ACTOR_URL}/ocr. Set the Authorization: Bearer YOUR_TOKEN header. Pass imageUrl as a query parameter (GET) or in the JSON body (POST).

Health check

$curl "{STANDBY_ACTOR_URL}/health"

Option 2: Batch Processing (Actor Input)

Best for one-off jobs, scheduled OCR pipelines, and processing entire document collections. Results are written to the default dataset.

Minimal input — single image

{
"imageUrl": "YOUR_IMAGE_URL"
}

Batch input — up to 50 images

{
"imageUrls": [
"IMAGE_URL_1",
"IMAGE_URL_2"
],
"outputDetail": "lines",
"language": "en"
}

PDF input

{
"imageUrl": "YOUR_PDF_URL",
"maxPdfPages": 10,
"outputDetail": "text_only"
}

Python (Apify Client)

from apify_client import ApifyClient
client = ApifyClient("your_token")
run = client.actor("crawloop/google-lens-ocr-api").call(run_input={
"imageUrls": [
"IMAGE_URL_1",
"IMAGE_URL_2",
],
"outputDetail": "lines",
"language": "en",
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(f"URL: {item['imageUrl']}")
print(f"Text: {item['fullText']}")
for line in item.get("lines", []):
print(f" [{line['text']}]")

JavaScript (Apify Client)

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'your_token' });
const run = await client.actor('crawloop/google-lens-ocr-api').call({
imageUrls: ['IMAGE_URL_1', 'IMAGE_URL_2'],
outputDetail: 'lines',
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const item of items) {
console.log(`${item.imageUrl}: ${item.fullText}`);
}

Input Parameters

ParameterTypeDefaultDescription
imageUrlstringURL of a single image or PDF document.
imageUrlsarrayList of image URLs to process in parallel (max 50 per run).
imageBase64stringBase64-encoded image (raw or data:image/...;base64,... URI).
outputDetailstringfullfull / lines / words / text_only — controls structural detail in the response.
languagestringenISO 639-1 language hint (en, de, fr, ja, ru, …).
regionstringUSISO 3166-1 region hint for locale-specific formats (addresses, phone numbers).
translateTostringOptional ISO 639-1 code to translate extracted text.
maxPdfPagesinteger5Maximum PDF pages to render and OCR per document (1–50).
proxyConfigurationobjectApify proxyProxy settings; residential proxies recommended at scale.

Output Detail Levels

LevelWhat's included
fullparagraphs → lines → words, all with bounding boxes
linesline text + bounding boxes (no word-level data)
wordslines with individual word bounding boxes
text_onlyplain text only, no coordinates

Output Format

Each successfully processed image produces one dataset item (or one JSON object in Standby mode):

{
"imageUrl": "YOUR_IMAGE_URL",
"language": "en",
"fullText": "Invoice #12345\nDate: 2024-01-15\nTotal: $499.00",
"processingMs": 380,
"error": null,
"lines": [
{
"text": "Invoice #12345",
"boundingBox": {
"centerX": 0.445,
"centerY": 0.107,
"width": 0.851,
"height": 0.115,
"pixelCoords": { "x": 30, "y": 33, "width": 1265, "height": 77 }
},
"words": [
{ "text": "Invoice", "boundingBox": { "centerX": 0.12, "centerY": 0.107 } },
{ "text": "#12345", "boundingBox": { "centerX": 0.35, "centerY": 0.107 } }
]
}
],
"paragraphs": []
}

PDF output

Each PDF page is a separate row with an additional page field:

{
"imageUrl": "YOUR_PDF_URL",
"page": 1,
"language": "en",
"fullText": "...",
"processingMs": 1200,
"error": null
}

Error output

Failed images return an error string instead of text. These rows are not billed:

{
"imageUrl": "YOUR_IMAGE_URL",
"fullText": "",
"error": "OCR timeout after 3 attempts",
"processingMs": 90000
}

Supported Image Formats

JPEG, PNG, WebP, BMP, TIFF, HEIC, GIF, PDF


FAQ

How accurate is the OCR?
Uses the same OCR engine as Google Lens in Chrome — excellent for printed text, signs, screenshots, and clear scans. Handwriting quality depends on contrast and legibility.

How many images can I process at once?
Up to 50 URLs per batch run. In Standby mode, pass an array of URLs in a single POST /ocr request.

What about PDFs?
Provide a PDF URL and set maxPdfPages. Each page is rendered at 150 DPI and OCR'd separately. One page equals one ocr-image billing event.

Can I use base64 images?
Yes — in both batch mode and Standby POST requests. Supports raw base64 and data:image/...;base64,... format.

Is there a rate limit?
No hard platform rate limit. Standby mode handles concurrent requests with thread-safe sessions and proxy rotation.

What if an image fails?
The response includes an error field. Failed or empty OCR results are not charged under pay-per-event pricing.

What languages are supported?
Detection is automatic. Set language to improve accuracy for a specific locale. Use translateTo to return translated text.

How long does processing take?
Simple images often complete in seconds. Complex scans, dense documents, or heavy parallel load may take longer; retries run automatically on transient timeouts.

Which mode should I choose?
Use Standby for API integrations and low-latency calls. Use batch mode for scheduled jobs, large exports, and Apify dataset/CSV workflows.


This Actor processes images and PDFs supplied by the user. Users must ensure they have the legal right to process submitted content and must comply with applicable privacy and data-protection laws in their jurisdiction.