Skip to content

Barcode and QR code API

Barcodes and QR codes from your program. The same symbologies, the same rules and the same renderer as the free generators on qreska.com, and the dynamic codes of the panel.

Who it is for

The API comes with the Business plan (10,000 calls a month) and the Pro plan (100,000 calls a month). Keys are made in the panel, on its API page.

Go to the panel

Address and key

Every route is under https://app.qreska.com/api/v1. Each call carries the key in a header, never in the address, because addresses end up in logs and browser history. Do not put the key in page code that reaches a browser: the API is for your server.

An API key from the panel, in the Authorization: Bearer qrk_… header

Every route described in OpenAPI 3.1, for Postman, Insomnia or a client generator: https://app.qreska.com/api/v1/openapi.json

Limits

  • The plan's monthly allowance is counted per calendar month (UTC). Every call with a valid key counts, including those that fail validation; calls refused for a missing key or the limit do not.
  • Up to 20 calls a second per team. Beyond that the answer is 429 with a Retry-After header.
  • Every answer has RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers (seconds until the next month begins).

What we keep

The content of static codes is drawn in memory and forgotten once the answer is sent. The call log you see in the panel has the time, key, method, route without data, result and response time — no content and no IP address. Details in the privacy policy.

Examples

An EAN-13 as PNG at 600 dpi:

curl -X POST https://app.qreska.com/api/v1/barcodes \
  -H "Authorization: Bearer $QRESKA_KEY" \
  -H "Content-Type: application/json" \
  -d '{"symbology":"ean-13","data":"590123412345","format":"png","dpi":600}' \
  -o ean-13.png

A dynamic code, then a change of its target:

curl -X POST https://app.qreska.com/api/v1/codes \
  -H "Authorization: Bearer $QRESKA_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Flyer","target":{"type":"url","url":"https://example.com/offer"}}'

curl -X PATCH https://app.qreska.com/api/v1/codes/$CODE_ID \
  -H "Authorization: Bearer $QRESKA_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target":{"type":"url","url":"https://example.com/winter"}}'

SDKs for JavaScript and PHP

Two small libraries without dependencies: for Node.js 18+ (TypeScript, fetch) and for PHP 8.1+ (curl). They handle the key, errors as exceptions carrying the code from the table above, a retry after 429 rate_limited, and paging through the list of codes. Until they are published on npm and Packagist they install from the sdk/js and sdk/php folders of the repository.

JavaScript and TypeScript:

import { Qreska } from "@qreska/sdk";

const qreska = new Qreska({ apiKey: process.env.QRESKA_KEY });
const file = await qreska.barcode({ symbology: "ean-13", data: "590123412345", format: "png" });
const code = await qreska.codes.create({
  name: "Flyer",
  target: { type: "url", url: "https://example.com/offer" },
});

PHP:

$qreska = new \Qreska\Client(getenv('QRESKA_KEY'));
$file = $qreska->barcode(['symbology' => 'ean-13', 'data' => '590123412345', 'format' => 'png']);
file_put_contents('ean-13.png', $file->data);
$code = $qreska->createCode([
    'name' => 'Flyer',
    'target' => ['type' => 'url', 'url' => 'https://example.com/offer'],
]);

GTIN, ISBN and ISSN numbers

GTIN/EAN numbers are issued by GS1 (in Poland: GS1 Polska). Qreska only draws the code from a number you already have.

ISBNs are issued by the national ISBN agency (in Poland: the ISBN office of the National Library). Qreska only draws the code from a number you already have.

ISSNs are issued by the national ISSN centre (in Poland: the ISSN centre of the National Library). Qreska only draws the code from a number you already have.

Errors

Errors come as application/problem+json (RFC 9457). The code field is fixed, for programs to compare; title is for people, in Polish or English after the Accept-Language header. On validation errors, errors names the fields: path is the place in the request body, code is the reason.

Errors
CodeStatusMeaning
unauthorized401No API key, or the key is unknown or revoked.
forbidden403This organization's plan does not include the API.
suspended403The organization is suspended pending review: it cannot create codes or change targets.
not_found404There is no such resource in this organization.
invalid_request400The request is not valid JSON or does not match the schema.
invalid_data422This content cannot be encoded in the chosen symbology.
blocked_target422This address is on the block list, or leads to fraud or malware.
plan_limit409The plan does not allow more dynamic codes.
quota_exceeded429The plan's monthly allowance of API calls is used up.
rate_limited429Too many calls a second. Try again in a moment.
internal500An error on our side. Try again; if it keeps happening, write to us.

Routes

This month's use

GET /api/v1/usage

The team's plan, the calls in the current month and the limit. The simplest way to check that a key works; the call itself counts.

Response: 200 JSON

Symbologies

GET /api/v1/symbologies

The symbologies POST /api/v1/barcodes takes: id, kind, example, default sizes in mm, switches with their values, and who issues the numbers.

Response: 200 JSON

QR content types

GET /api/v1/qr-contents

The content types of the qrContent field (Wi-Fi, business card, email, bank transfer…) with their fields. The same as on the /qr pages.

Response: 200 JSON

Static code

POST /api/v1/barcodes

Draws a code from the content given and returns a file in the format asked for. The value after normalization, with its check digit for instance, is in the Qreska-Value header; warnings that did not stop the drawing (contrast, module size) in Qreska-Warning.

Request body (JSON)

Request body (JSON)
FieldTypeValuesDescription
symbologyrequiredstringone of: ean-13, ean-8, upc-a, upc-e, isbn, issn, itf-14, gs1-128, code-128, code-39, interleaved-2-of-5, codabar, pharmacode, data-matrix, gs1-data-matrix, pdf417, aztec, micro-qr, qrThe symbology, as in the generator's address: ean-13, code-128, qr…
datastringup to 8000 charactersThe code's content. For QR, qrContent can be given instead.
qrContentobjectFor qr only: a content type and its field values; the content is built from them as on the /qr page.
addonstringup to 5 charactersA 2- or 5-digit add-on, for symbologies that have one (EAN-13, UPC-A, ISBN…).
optionsobjectThe symbology's switches, such as errorCorrection for QR. Listed by GET /api/v1/symbologies.
formatstringone of: svg, png, pdf, json; default "svg"The file format.
moduleWidthMmnumber0.1 to 5Module width (X) in mm.
barHeightMmnumber3 to 300Bar height in mm, for linear codes.
hriobjectThe text under a linear code: whether to show it and the digit height in mm.
colorsobject#RRGGBB colours of the bars and the background. Red and orange bars on linear codes are refused: a laser scanner cannot see them.
rotationnumberone of: 0, 90, 180, 270Rotation in degrees.
moduleShapestringone of: square, rounded, dotFor qr only: the shape of the modules.
dpiinteger72 to 1200; default 300PNG resolution. Every module is a whole number of pixels, and the DPI written to the file matches the size in mm.
pdfobjectThe PDF page: fitted to the code with a margin, or A4.

Response: 200 A file: SVG, PNG, PDF, JSON

Dynamic codes

GET /api/v1/codes

The team's codes, newest first, a page at a time. The next page is fetched with the cursor from nextCursor; null means the end of the list.

Parameters

Parameters
FieldTypeValuesDescription
qstringup to 200 charactersSearch the name, the code's address and the target address.
projectIdstringup to 100 charactersOnly codes in this project.
limitinteger1 to 100; default 50Codes per page.
cursorstringup to 200 charactersThe cursor from the previous page's nextCursor.

Response: 200 JSON

New dynamic code

POST /api/v1/codes

Makes a dynamic code with a target. The target passes the same checks as in the panel: the block list and Google Web Risk. The plan's limits apply.

Request body (JSON)

Request body (JSON)
FieldTypeValuesDescription
namerequiredstringup to 120 charactersThe code's name, shown in the panel.
targetrequiredobjectThe target: url, vcard, wifi, links or menu (pdf only with a file uploaded in the panel).
projectIdobjectThe project the code goes into.

Response: 201 JSON

Dynamic code

GET /api/v1/codes/{id}

One of the team's codes with its target and settings. The password is never returned, only whether there is one.

Response: 200 JSON

Change a dynamic code

PATCH /api/v1/codes/{id}

Changes the target, name, project, look, state or options. A new target works at once, and the code's history in the panel shows that this key changed it.

Request body (JSON)

Request body (JSON)
FieldTypeValuesDescription
namestringup to 120 charactersA new name.
targetobjectA new target.
projectIdobjectA project, or null to take the code out of its project.
appearanceobjectThe look: module size, error correction, colours, shape, rotation, logo.
statusstringone of: active, pausedactive or paused. A blocked code cannot be resumed.
passwordobjectA password the code asks for, or null to remove it.
expiresAtobjectFrom this moment the code says it has expired; null removes the date.
scanLimitobjectAfter this many scans the code says it has expired; null removes the limit.

Response: 200 JSON

Delete a dynamic code

DELETE /api/v1/codes/{id}

Removes the code from the list. From then on its address says the code is inactive, and it will never go to anyone else.

Response: 204 No content

Scan statistics

GET /api/v1/codes/{id}/scans

People's scans (no bots) day by day, the totals of the period, the period before and ever, and the most common countries, cities, systems, devices and browsers.

Parameters

Parameters
FieldTypeValuesDescription
daysstringone of: 7, 30, 90, 365; default "30"The period in days.

Response: 200 JSON

Image of a dynamic code

GET /api/v1/codes/{id}/image

The code drawn with the look stored in the panel. A code with a WebP logo is available as SVG only; for PNG and PDF upload a PNG, JPEG or SVG logo.

Parameters

Parameters
FieldTypeValuesDescription
formatstringone of: svg, png, pdf; default "svg"The file format.
dpiinteger72 to 1200; default 300PNG resolution.

Response: 200 A file: SVG, PNG, PDF

Projects

GET /api/v1/projects

The projects the team groups its codes into.

Response: 200 JSON

New project

POST /api/v1/projects

Makes a project; its id goes into a code's projectId.

Request body (JSON)

Request body (JSON)
FieldTypeValuesDescription
namerequiredstringup to 80 charactersThe project's name.

Response: 201 JSON