ForHosting KIT · Developer Utilities

Read a barcode from a photo

A dedicated handheld scanner reads a barcode instantly because it's built for exactly one job under exactly one kind of lighting; a phone camera photographing a crumpled receipt or a dented can has none of those guarantees.

● StablePer request + per image$0.002
Use it from WebAPIEmailTelegramApp soon

Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.

This barcode scanner api reads EAN, UPC and Code128 codes from an ordinary photo, so applications that only have a camera, not a laser scanner, can still pull a reliable product code out of an image.

Why photographed barcodes are harder than they look

A dedicated retail scanner sweeps a laser or takes a controlled image at a fixed distance and angle, conditions a barcode format was designed around from the start. A photo taken by hand introduces skew, uneven lighting, motion blur and, on curved packaging like a can or bottle, actual geometric distortion of the bars themselves. Decoding from that kind of image means correcting for all of it before the bar widths can even be measured accurately enough to read the underlying digits.

What POST /dev/barcode-decode does with your image

You send a photo containing a barcode, and the task locates the symbol, determines which symbology it's using, and returns the decoded value along with the format it identified. If a code is too damaged, too small, or too distorted to decode reliably, the task reports that outcome explicitly instead of guessing at a value that might be wrong.

Fifty years of the same underlying idea

The commercial barcode dates to 1974, when the first UPC-coded item was scanned at a real checkout counter, and the core mechanism, bars and spaces of varying width representing digits, hasn't fundamentally changed since. What has changed is how those codes get read: a job that once required a dedicated, expensive laser unit can now be done from a general-purpose camera image, which is precisely what makes decoding from an ordinary photo practical today in a way it wasn't a generation ago.

Distinguishing symbologies automatically

EAN, UPC and Code128 each encode their data with a different bar pattern and structure, and the task identifies which one it's looking at as part of decoding rather than requiring you to specify it in advance. That matters in practice because a mixed catalog might carry retail EAN or UPC codes on some items and Code128 logistics labels on others: you send the photo the same way either way, without pre-sorting images by format or configuring the decoder per item.

How it fits an automated intake workflow

Inventory audits done with a phone camera instead of a handheld scanner, returns processing that photographs a product to confirm its identity, and customer-facing apps that let a shopper scan a price tag to compare it elsewhere all call this endpoint the same way, sending an image and receiving the decoded value through a signed webhook or a signed link. A batch of photos from a single audit run processes through the same asynchronous model as a single image.

Phone-based inventory audits

Photograph shelf stock with a standard phone camera and decode each product's barcode without carrying a dedicated handheld scanner.

Returns processing verification

Confirm a returned item's identity by decoding the barcode on its packaging against the original order before issuing a refund.

Price comparison in a shopping app

Let a user photograph a price tag's barcode so the app can decode the product code and look up pricing elsewhere.

Format-agnostic warehouse reads

Decode a Code128 logistics label on one carton and the EAN on a retail product with the same call, one photo at a time, without configuring the format for each item.

Which barcode types does this barcode scanner api read?

EAN, UPC and Code128 (one-dimensional retail and logistics codes), with the symbology identified automatically as part of decoding.

Can it decode a barcode from a curved surface like a can?

Yes, within reasonable limits, the decoder is built to handle the distortion typical of barcodes printed on curved packaging photographed by hand.

What happens if the barcode is too damaged to read?

The task reports explicitly that the code couldn't be decoded reliably rather than returning a guessed or incorrect value.

Do I need to tell the API which symbology to expect?

No, the symbology is identified automatically as part of decoding, so you don't need to specify EAN, UPC or Code128 in advance.

Does it read more than one barcode per photo?

Each request decodes one barcode per image — the clearest code in the frame. To read several, send one image per barcode; each is billed the same per-image rate.

Is there a free tier for scanning barcodes?

There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.

How much does decoding a barcode cost?

$0.002 per request plus $0.005 per image, with no charge for a task that ultimately fails after retries.

How do I receive the decoded result?

POST /dev/barcode-decode returns a task_id immediately, and the decoded value is delivered via signed webhook or a signed link valid for 24 hours.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/dev/barcode-decode

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/dev/barcode-decode \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image":"https://ejemplo.com/imagen.jpg"}'
{
  "image": "https://ejemplo.com/imagen.jpg"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "dev.barcode_decode",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002
Per image$0.005

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →