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. This barcode scanner api reads EAN, UPC, Code128, Code39 and ITF 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.

Temporarily withdrawnPer request + per image$0.002

This task is not available right now, so it cannot be purchased. Nothing is charged for it.

How it works & API
Use it from WebAPIEmailApp soonTelegram soon

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 one or more barcodes, and the task locates each 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, Code128, Code39 and ITF 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 single photo, of a shipping carton for example, might contain an ITF code on the outer box and a Code128 label from a carrier stuck next to it, and both need to be read correctly without manual sorting.

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.

Mixed-symbology shipping label reads

Decode both the ITF code on an outer carton and a Code128 carrier label appearing in the same photo during dock intake.

Which barcode types does this barcode scanner api read?

EAN, UPC, Code128, Code39 and ITF, 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, Code128, Code39 or ITF in advance.

Can I decode multiple barcodes from one photo?

Yes, each barcode found in the image is decoded and returned separately, including cases where different symbologies appear in the same photo.

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, and soon from our app, email and Telegram.

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 →