QR & Barcode Scanner

QR & Barcode Scanner API

Utilities

Scan QR codes and barcodes with your camera or from an image. See the decoded text and format, check links before opening them, and read Wi-Fi and contact codes.

Authentication

All API requests require a valid API key passed in the Authorization header as a Bearer token.

Rate Limit

20 requests per minute

Endpoints

1 endpoint available

Overview

Read QR codes and barcodes from an uploaded image. Send the image as multipart/form-data. The API returns every code it finds, each with its text and what kind of content it holds (link, Wi-Fi network, contact, email, SMS, phone number, location, one-time-password setup, calendar event, or plain text).

Notes

  • Images: PNG, JPEG, WebP, GIF, AVIF or TIFF, up to 10 MB. Large images are shrunk to 3000 pixels on the longest side.
  • format uses the same names as the page, such as qr_code, ean_13, code_128, data_matrix, pdf417 and aztec.
  • formats (a form field, optional) limits the search: all (default), matrix (QR, Data Matrix, Aztec, PDF417 and similar) or linear (EAN, UPC, Code 128 and similar).
  • Up to 20 codes are returned per image. position has the four corner points, in pixels of the decoded image. If nothing is found, count is 0 and codes is empty.
  • content.kind is one of url, wifi, contact, email, sms, tel, geo, otp, event or text, plus fields for that kind. For links, warnings lists problems such as plain http, a fake host before an "@", punycode (look-alike) hostnames and bare IP addresses. Scanned values are untrusted input, so treat links and contact data with care.

Endpoints

POST
https://opentools.ca/api/v1/tools/qr-barcode-scanner
Read QR codes and barcodes from an image

Request Body

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
file
file
Required
The image to scan. PNG, JPEG, WebP, GIF, AVIF or TIFF, up to 10 MB.
formats
string
Enum: all, matrix, linear
OptionalWhich kinds of code to look for.Default: all

Response Example

{
  "success": true,
  "count": 1,
  "codes": [
    {
      "value": "https://opentools.ca",
      "format": "qr_code",
      "formatName": "QR Code",
      "content": {
        "kind": "url",
        "url": "https://opentools.ca/",
        "host": "opentools.ca",
        "warnings": []
      },
      "position": {
        "topLeft": {
          "x": 25,
          "y": 25
        },
        "topRight": {
          "x": 231,
          "y": 25
        },
        "bottomRight": {
          "x": 231,
          "y": 231
        },
        "bottomLeft": {
          "x": 25,
          "y": 231
        }
      }
    }
  ]
}

Error Codes

400
Bad Request - No file in the file field, an image that cannot be read, or an invalid formats value
401
Unauthorized - Invalid or missing API key
403
Forbidden - API key inactive, expired, or request from a disallowed IP
413
Payload Too Large - Image over 10 MB
415
Unsupported Media Type - File is not one of the accepted image types
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error

Code Examples

curl -X POST https://opentools.ca/api/v1/tools/qr-barcode-scanner \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@photo.jpg" \
  -F "formats=all"

Ready to get started?

Create an API key to start using the QR & Barcode Scanner API.

Rather use it in your browser? Open the QR & Barcode Scanner