OCR API — Extract Text from Images
Send an image, get back every line of text it contains with a confidence score — in one REST call. Built for developers who want OCR as a managed service, not a project.
Published 2026-05-21 · Updated 2026-10-26

TL;DR. To extract text from an image using an API, POST the image as multipart/form-data to Pixicular's image analysis API with services=detect-text. The response is one JSON document listing each line of text found in the image, with a confidence score per line. No SDK, no local model, no manual region detection.
How does an OCR API turn an image into text?
An OCR (optical character recognition) API takes a raw image as input and returns text as output. Pixicular's detect-text service finds the parts of the image that contain text, recognises the characters, and returns a list of detections: one entry per line of text, with the recognised string, a type of LINE, and a confidence percentage.
Keeping lines separate matters more than it sounds: a price and the product name above it stay distinct strings instead of running together in one blob. What the response does not carry is position or structure. There are no text coordinates, no paragraph or table grouping, and no language code, so if your application needs to know where text sits in the image or how lines group into fields, that logic lives on your side. The service fits text in photos and screenshots best — signs, product labels, posters, captions, UI text — rather than dense, full-page documents.
![A photo of a shop-window poster reading SUMMER SALE, UP TO 50% OFF, and ENDS SUNDAY, with an arrow to a detections[] panel listing each line with the type LINE and confidences of 99.6, 99.1, and 98.4; below it, POST /v1/detect with services=detect-text.](/_next/image?url=%2Flanding-pages%2Focr-api-extract-text-from-images%2Finfographic-1.webp&w=3840&q=75&dpl=dpl_7MeQwW947JDrnjJ8oxD2vUb8n1Dh)
Which types of text can the OCR API recognise?
The service reads text wherever it appears in a photo or screenshot, but some sources suit it better than others. Each detection is a whole line of text, with type always set to LINE. The response does not classify text as printed or handwritten.
| Text source | Common examples | What to expect |
|---|---|---|
| Printed text in photos | Signs, posters, product packaging, price tags, menus, notices | Best fit: clear, high-contrast lines usually come back with high confidence |
| Screenshots and UI text | App screens, error dialogs, social posts, memes | Good fit for short, well-separated lines; very small type lowers confidence |
| Stylised text | Shop signs, banners, decorative headings, custom typography | Works on many fonts; heavy decoration, curved text, and low contrast lower confidence |
| Dense documents | Book pages, contracts, multi-column reports, long receipts | Not its strength: lines come back without layout, so test before relying on it |
| Handwriting | Notes, whiteboards, filled-in forms | Not a documented use case; test on your own samples first |
For identity documents — passports, driving licences, national ID cards — detect-text returns the raw lines only. It does not parse fields or MRZ data, so extracting names, dates, and document numbers is code you write; see the ID document OCR for KYC guide for that workflow.
What does the JSON response look like?
The response is a single JSON document with a key per requested service under services. For detect-text the value contains a detections array. Each entry has detectedText (the recognised string), type (always LINE), and confidence (a percentage from 0 to 100).
{
"success": true,
"requestId": "req_Vx6nH3sQ8mBt2Kd9Lw",
"services": {
"detect-text": {
"detections": [
{ "detectedText": "SUMMER SALE", "type": "LINE", "confidence": 99.6 },
{ "detectedText": "UP TO 50% OFF", "type": "LINE", "confidence": 99.1 },
{ "detectedText": "ENDS SUNDAY", "type": "LINE", "confidence": 98.4 }
]
}
},
"photo": { "id": "photo_Rb5tY1uW7cZe3Fg0Hj", "status": "COMPLETED" },
"creditCost": 1,
"processingTimeMs": 980,
"processedAt": "2026-10-26T09:30:00.000Z"
}That is the whole result: there is no combined full-text field, no bounding box, no block or paragraph structure, and no language code. To get one string, join the lines with newlines. If the image contains no text, detections is an empty array. The full schema, including error codes and rate limits, is in the API documentation.
Which languages and scripts are supported?
Pixicular does not publish a list of supported languages or scripts for detect-text, and the response does not include a language code. You do not send a language hint either. If your images contain non-Latin scripts such as Cyrillic, Greek, Arabic, Hebrew, or Chinese, Japanese, and Korean, or mix several languages on one sign, test with real samples before you rely on the results. If your application needs the language, detect it on your side from the returned strings with a language-identification library.
How do you call the OCR API?
Authentication is a bearer token in the Authorization header. Send the image as multipart/form-data with a file part; JPEG, PNG, WebP, AVIF, and TIFF are accepted up to 10 MB and between 100×100 and 4096×4096 pixels. Pass the service name in the services form field — or a comma-separated list if you want OCR alongside other services in the same call.
curl
curl -X POST https://api.pixicular.com/v1/detect \
-H "Authorization: Bearer $PIXICULAR_API_KEY" \
-F "file=@./shop-window.jpg" \
-F "services=detect-text"TypeScript — typed extraction with confidence-based routing
interface TextDetection {
detectedText: string;
type: "LINE";
confidence: number; // 0-100
}
// Extract the lines of text in an image; queue low-confidence lines for review.
async function extractText(file: Blob) {
const body = new FormData();
body.append("file", file);
body.append("services", "detect-text");
const res = await fetch("https://api.pixicular.com/v1/detect", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PIXICULAR_API_KEY}` },
body,
});
// 202 means the request was queued under load: poll its statusUrl (see the docs).
if (res.status === 202) return null;
if (!res.ok) throw new Error(`OCR request failed: ${res.status}`);
const result = await res.json();
const lines: TextDetection[] = result.services["detect-text"]?.detections ?? [];
return {
text: lines.map((l) => l.detectedText).join("\n"),
confident: lines.filter((l) => l.confidence >= 90),
review: lines.filter((l) => l.confidence < 90),
};
}Combine detect-text with other services — for example to read the text on a claim photo and label what the photo shows in the same request, as covered in the insurance claim photo analysis guide. The image is uploaded once and the services run in parallel, so one multi-service request is faster than several round-trips; each service still counts as one operation.
How does Pixicular OCR compare to Google Vision and Tesseract?
Three kinds of OCR option come up in most developer evaluations: a multi-service image API like Pixicular, a cloud vision API like Google Cloud Vision, and the self-hosted open-source engine Tesseract. All three turn an image into text; they differ on output detail, integration effort, pricing, and what you have to operate yourself.
| Capability | Pixicular OCR | Google Vision OCR | Tesseract |
|---|---|---|---|
| Hosting model | Managed REST API | Managed REST API | Self-hosted open-source engine |
| Integration | One POST with a file or a URL, JSON back | REST or client libraries; a Google Cloud project and credentials | CLI or language bindings; you host, scale, and update it |
| Pricing model | Monthly plans with included operations; OCR is one operation per image | Per feature, per image; see Google's price list | Free software; you pay for the infrastructure you run it on |
| Output | Lines of text, each with a confidence score; no coordinates | Text with coordinates, plus a page, block, paragraph, and word hierarchy | Plain text, hOCR, ALTO, or TSV; coordinates in the structured formats |
| Languages | No published language list; no language code in the response | Broad language support with optional language hints | Language data packs chosen per call (for example -l eng+fra) |
| Handwriting | Not a documented use case | Supported by its document text detection feature | Limited; its models are trained mainly on print |
| Other image analysis in the same call | Yes: labels, moderation, age, and face emotions | Yes: several features per request, each billed | No; OCR only |
| Best fit | Short text in photos, alongside other image analysis | Document OCR and large-scale text extraction | High-volume OCR on infrastructure you already run |
The honest summary: if you need text coordinates, document layout, handwriting, or a documented language list, Google Cloud Vision or Tesseract is the better fit. Tesseract suits teams that already run infrastructure and want no per-call cost. Pixicular fits when reading short text in photos is one step among several — labels, moderation, age — and you want one endpoint, one key, and one JSON contract. See the pricing page for plans, and Pixicular vs Google Cloud Vision for a wider comparison. Competitor details change; check their current documentation before you decide.
What about image quality, file formats, and limits?
Three rules cover most quality issues without any experimentation:
- Size of the text: small type in a wide shot is the most common cause of missed lines. Images can be up to 4096×4096 pixels, so crop to the area that contains the text rather than downscaling the whole photo.
- Focus and lighting: motion blur, glare, and harsh shadows hurt more than a modest resolution does. A sharp, evenly lit photo usually beats a larger, blurry one.
- File format: send JPEG, PNG, WebP, AVIF, or TIFF up to 10 MB. Prefer the original capture over a re-compressed thumbnail: heavy compression artefacts around letters lower confidence.
The per-line confidence score is the right tool for handling quality variance in production. Rather than hard-failing requests below an arbitrary global threshold, treat each line independently: keep the high-confidence lines, surface the low-confidence ones in a review interface, and persist the request ID so you can fetch the stored result again when your thresholds change.
When should you use an OCR API instead of running OCR yourself?
The decision comes down to volume, infrastructure ownership, and the rest of the analysis you need. A managed OCR API is the right call when text extraction is one capability among several you want from each image — labels, moderation, age estimation, OCR — and you want one auth model and one JSON contract. It is also the right call when you do not want to operate model updates, servers, and language data packs yourself.
Self-hosting Tesseract makes sense when OCR is the only thing you need from the image, when your volume is large enough to dwarf any per-call API price, and when your team is already comfortable running Linux services. The trade-off is real: tuning page-segmentation modes, keeping language packs current, and adding handwriting models all become your problem rather than a vendor's.
For teams that need OCR plus other image analysis — for example moderation on user-uploaded photos that may carry text, or label detection alongside text extraction on claim photos — the cost of composing services matters more than the per-call cost. One request returning one JSON object beats orchestrating three services on your side.
Frequently asked questions
How do you extract text from an image using an API?
POST the image as multipart/form-data to https://api.pixicular.com/v1/detect with services=detect-text, or send its URL to /v1/detect-from-url. The API finds the text in the image and returns a JSON document with a detections array: one entry per line, with the recognised string in detectedText, the type LINE, and a confidence percentage. No SDK, no local model, no manual region detection.
How accurate is the OCR API?
Pixicular does not publish an accuracy figure for detect-text. Clear, in-focus, high-contrast printed text gives the most reliable lines; small type, decorative fonts, low contrast, motion blur, extreme perspective, and handwriting lower the confidence or cause missed lines. Every line carries a confidence score, so route low-confidence lines to manual review or a second pass rather than discarding them silently.
Which image file formats are supported?
JPEG, PNG, WebP, AVIF, and TIFF, up to 10 MB and between 100×100 and 4096×4096 pixels. For the best results, send the original capture rather than a re-compressed thumbnail, and crop to the area that contains the text instead of downscaling a wide shot, so the letters stay large and sharp.
Does the OCR API support languages other than English?
Pixicular does not publish a list of supported languages or scripts for detect-text, and the response does not include a language code. If your images contain non-Latin scripts such as Cyrillic, Arabic, or Chinese, or mix several languages, test with real samples before you rely on the results, and detect the language on your side from the returned text if you need it.
Can I extract handwritten text with the OCR API?
Handwriting is not a documented use case for detect-text. Neat, well-separated block capitals may come back, but cursive script, overlapping strokes, and faint pencil are unreliable. If handwriting matters to your product, test on your own samples first and plan a human review queue driven by the per-line confidence, or use a document-OCR service built for handwriting.
Add OCR to your application with one API call
The fastest way to evaluate the detect-text service is to POST a representative image with a single curl command and look at the JSON. Pick a plan on the pricing page, follow the API documentation for auth and rate limits, and combine this OCR guide with the ID document OCR and insurance claim photo analysis pages for use-case-specific detail.