Read QR and barcodes
Read QR and barcodes is an API that reads the QR codes and barcodes in an image or a PDF and returns their content as text. It's the counterpart of QR generator and Barcode generator, which create them.
How it works
You send the image (or the PDF) and get back a list of every code it finds: what type it is (QR, Code 128, EAN-13…) and what it says. It reads several codes at once, even if they're rotated, small, or the photo isn't perfect. Reading happens on our own servers: the image isn't sent to any third-party service.
Honest note: it reads sharp, rotated, small or slightly noisy codes well. With very blurry photos, half-covered codes or very low contrast it may find nothing: in that case it returns an empty list, and the credit is still charged because the work was done. A PDF is read page by page (up to 20 pages per call; pick which ones with pages).
All you need
- Your API key. Create it in your dashboard with "+ Create key".
- In your automation platform, an "HTTP Request" step (n8n, Make, Zapier, Pipedream…).
How to use it in n8n
- Method:
POST· URL:https://api.cofferdock.com/code-reader - Send Headers:
x-api-key= your key - Send Body: binary file (in n8n: "n8n Binary File"), the image or the PDF
- The result has
text(the content of the first code) andcodes(the list of all of them).
Options
| Option | Default | What it does |
|---|---|---|
formats | all | Look only for certain types, for example QRCode or EAN13,Code128. |
max_codes | 20 | How many codes to return at most (1 to 50). |
pages | all | PDF only: which pages to read, for example 1-3,5. |
API overview
- Endpoint:
POST https://api.cofferdock.com/code-reader - Auth: header
x-api-key: YOUR_KEY. - Input: raw image or PDF (
image/*,application/pdf), or JSON{ "file": "<base64>" }. Images: JPEG, PNG, WebP, GIF, TIFF or AVIF, up to 50 megapixels (SVG isn't accepted). PNGs with a transparent background are read on a white background. - Engine: zxing-wasm (zxing-cpp compiled to WebAssembly, MIT license), in a separate thread from the server. It tries the image reduced to 4 megapixels and, if it finds nothing in a larger image, again with up to 12.
- Formats: QRCode, MicroQRCode, RMQRCode, Code128, Code39, Code93, Codabar, ITF, ITF14, EAN13, EAN8, UPCA, UPCE, ISBN, DataBar (and variants), DataMatrix, PDF417, Aztec, MaxiCode and others. A UPC-A comes back as an EAN-13 with a leading 0 (it's the same code).
- Errors:
400if it's neither an image nor a PDF, if the PDF has a password or more than 20 pages withoutpages;422if reading takes too long (not charged);503withRetry-Afterif the server is busy (not charged). - Limits: 30 requests/min per IP. File up to 20 MB (50 MB on Business and Scale). PDF: up to 20 pages per call. 1 call = 1 credit, also when there are no codes.
Options
| Option | Default | Description |
|---|---|---|
formats | all | List of formats (array or comma-separated text, case-insensitive), or a group: AllLinear (1D), AllMatrix (2D), AllRetail, AllIndustrial. |
max_codes | 20 | 1-50. Maximum number of codes to return. |
pages | all (up to 20) | PDF only. Pages to read, starting at 1: 1-3,5. |
scale | 2 | PDF only. 1-4. Resolution at which each page is drawn before reading it: higher is sharper and slower. |
Example
curl -X POST "https://api.cofferdock.com/code-reader" \
-H "x-api-key: YOUR_KEY" -H "Content-Type: image/jpeg" \
--data-binary @photo.jpg
Response
{ "success": true, "text": "https://cofferdock.com",
"codes": [
{ "format": "QRCode", "text": "https://cofferdock.com", "content_type": "Text" },
{ "format": "EAN13", "text": "5901234123457", "content_type": "Text" } ],
"meta": { "count": 2, "used": 12, "remaining": 488 } }
What you get back
text is the content of the first code (or null if there are none), meant to be used directly in your workflow. codes is the list of all of them: format (the type), text (what it says) and content_type (Text, Binary, GS1…). If a QR carries data that isn't text, bytes_base64 comes too. In a PDF, each code also has page, the number of the page it's on.