Images

Read QR codes and barcodes from an image or a PDF

Finds every QR code and barcode (Code128, Code39, EAN, UPC, ITF, DataMatrix, PDF417, Aztec and more) in an image or a PDF and returns what each one says. It is the counterpart of generate_qr and generate_barcode. Reading runs on our own servers (zxing, as WebAssembly): the file is not sent to any third party. Works on sharp, rotated, small or slightly noisy codes; a very blurry photo or a half-covered code can return an empty list, which still costs the credit. Images: JPEG, PNG, WebP, GIF, TIFF or AVIF (not SVG), up to 50 megapixels. PDF: up to 20 pages per call.

Costs 1 credit per call.

post/code-reader

Request

  • Base URL: https://api.cofferdock.com
  • URL: https://api.cofferdock.com/code-reader
  • Auth: API key in header x-api-key

Request body

filestring byte required

The image or PDF to read, base64-encoded. Images: JPEG, PNG, WebP, GIF, TIFF or AVIF (up to 50 megapixels, not SVG). PDF: up to 20 pages per call.

formatsstring[]

Only look for these code types: a list such as ["QRCode","Code128"] (case does not matter), or a group: "AllLinear" (1D barcodes), "AllMatrix" (QR, DataMatrix, PDF417, Aztec...), "AllRetail", "AllIndustrial". Default: every type it can read.

max_codesinteger

Maximum number of codes to return, from 1 to 50. Default 20.

pagesstring

PDF only: which pages to read, 1-indexed, e.g. "1-3,5". Default: all pages (a PDF with more than 20 pages needs this).

scalenumber

PDF only: resolution at which each page is drawn before reading it, from 1 to 4. Default 2; higher = sharper and slower.

Response

Result.

successboolean
textstring nullable

The content of the first code found, or null if there are none.

Changes

No recorded changes to this operation across all 1 revision of this API.