Barcode Reader API

Read every 1D / 2D barcode in a PNG or JPEG: EAN-13 / 8, UPC, Code 128 / 39 / 93, ITF, QR, DataMatrix, PDF417, Aztec, with position and GS1 country.

POSThttps://apibox.io.vn/v1/barcode-read
Images & Codes▶ Try it online

Upload a photo or a scan and get all the barcodes found in it, with their format, decoded text, corner positions and orientation. Linear codes: EAN-13, EAN-8, UPC-A, UPC-E, ISBN, Code 128 (shipping labels), Code 39, Code 93, Codabar, ITF / ITF-14 and GS1 DataBar. Matrix codes: QR, Micro QR, rMQR, DataMatrix (medicines, electronic parts), PDF417 (tickets, ID documents), Aztec and MaxiCode. Rotated, mirrored and inverted (light on dark) codes are tried automatically; formats=ean13,code128 limits the search (faster, fewer false hits) and max caps the number of codes.

Retail codes come with the GTIN-14 and the GS1 prefix country (893 = Vietnam), the same table as /v1/gtin-check. QR codes are classified (URL, Wi-Fi, vCard…) and VietQR payment codes are decoded into bank, account and amount. Binary payloads are returned in base64.

Decoding uses zxing-cpp compiled to WebAssembly (zxing-wasm, MIT / Apache-2.0), running inside our servers: images are not sent to any third party nor stored. Images over 2400 px are scaled down first; limit 30 megapixels within the file size of your plan. Sharp, well-lit photos where the code is at least ~2 px per bar read best.

Parameters

NameInTypeRequiredDefault
filebodyfileyesPNG or JPEG image (multipart, raw body or file_base64).
formatsquery|bodystringnoComma-separated formats to look for: ean13, ean8, upca, upce, code128, code39, code93, codabar, itf, databar, qr, microqr, datamatrix, pdf417, aztec, maxicode, or linear, matrix, retail. Default: all.
maxquery|bodynumberno20Maximum number of codes returned (1–50).
fastquery|bodybooleannofalseSkip the slower "try harder" pass (good for clean, computer-generated images).

Example

curl -X POST "https://apibox.io.vn/v1/barcode-read" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "0=@./my-file"

Response

{
  "found": true,
  "count": 1,
  "barcodes": [
    {
      "format": "EAN13",
      "symbology": "EANUPC",
      "text": "8934588012228",
      "content_type": "Text",
      "position": {
        "top_left": {
          "x": 33,
          "y": 0
        },
        "top_right": {
          "x": 317,
          "y": 0
        },
        "bottom_right": {
          "x": 317,
          "y": 149
        },
        "bottom_left": {
          "x": 33,
          "y": 149
        }
      },
      "orientation": 0,
      "is_mirrored": false,
      "is_inverted": false,
      "gtin": {
        "gtin14": "08934588012228",
        "gs1_prefix": {
          "prefix": "893",
          "name": "GS1 Vietnam",
          "country_code": "VN"
        }
      }
    }
  ],
  "image": {
    "format": "png",
    "width": 339,
    "height": 165
  },
  "decoder": "zxing-cpp (zxing-wasm)"
}

Use cases

  • Read product barcodes from photos in inventory or price-check apps
  • Match shipping labels (Code 128) from parcel photos
  • Read DataMatrix codes on medicine boxes
  • Scan PDF417 / QR on tickets and documents uploaded by users

FAQ

Can it read several codes in one image?

Yes, up to 50 (20 by default), each with its corners in pixels of the original image.

Why is a UPC-A code returned as EAN-13?

A UPC-A code is an EAN-13 starting with 0; the reader reports the 13-digit form, which is also the valid GTIN.

Which image formats are accepted?

PNG and JPEG. Convert HEIC / WebP first (for example with /v1/image-resize).

Related APIs

Start with 1,000 free requests every month. Get free API key →