# QRCode BarCode API - full description > Generates QR codes and bar codes as images or PDF and decodes QR codes and bar codes from images and PDF documents. REST API and MCP server. 20 free requests per day per IP address; more with a prepaid request package (x402 payment in USDC on Base) or a RapidAPI plan. Base URL: `https://qrbar-code.intami.pl` OpenAPI 3 specification: `https://qrbar-code.intami.pl/open-api.yaml` MCP server: `https://qrbar-code.intami.pl/mcp` Contact: qrbarcode-api@intami.pl ## Access, payment and API keys - Without an API key every client IP address has 20 free requests per day, shared by the REST API and the MCP server. - Over the free limit (or when a package key has no requests left) the API answers `402 Payment Required` with a JSON body: `error` (`payment_required`), `message`, `packages` (each `id`, `requests`, `price`, `buy_url`), `packages_url`, `upgrade_url` (RapidAPI plans), `limits_url`. - Request packages have no daily limit and do not expire. Current offer: `pro` 1 000 requests for 1 USDC, `ultra` 150 000 requests for 9 USDC, `mega` 500 000 requests for 29 USDC (always check `GET /x402/packages`, which gives the current packages and prices). - An API key is sent in the `X-API-Key` header (MCP: the header in the client configuration or the `api_key` tool argument). New keys start with `qr_`. An unknown key gives `401`. - Every answer to a request with a package key carries `X-Requests-Remaining` with the requests left. - Counted: every answer with a result (2xx), also a decoding that found no code. Not counted: invalid requests (4xx) and server errors (5xx). - Units: generating a code uses one request. Decoding with a package key uses one request for every decoded code, at least one; when the package runs out during a decoding, the result is still returned and the balance ends at 0. A free decoding is one request of the free quota. - Technical limit: 120 requests per minute per IP address, also with an API key; over it `429 Too Many Requests` with `Retry-After: 60`. - RapidAPI: the same API is available as a RapidAPI subscription (https://rapidapi.com/intami-intami-default/api/barcode-and-qrcode-decoder-generator/pricing); requests through RapidAPI are billed by RapidAPI. ### Buying a package with x402 (HTTP) 1. `GET /x402/packages` returns `{"packages":[{"id":"pro","requests":1000,"price":"1 USDC on Base","buy_url":"..."}],"upgrade_url":"..."}`. 2. `POST /x402/packages/{id}` without a payment returns `402` with x402 version 2 payment requirements: the JSON body (`x402Version`, `resource`, `accepts`, `message`) and the same, base64 encoded, in the `PAYMENT-REQUIRED` header. The payment is a USDC transfer authorization (EIP-3009, scheme `exact`) on Base. 3. Retry the same `POST` with the base64 encoded payment payload in the `PAYMENT-SIGNATURE` header. Optionally send `X-Payment-Claim` (a random secret of 16-128 printable characters) and resend the same value with the same payment when retrying, to receive the API key. 4. The answer (`200`) is `{"api_key":"qr_...","package":"pro","requests_added":1000,"requests_remaining":1000,"message":"..."}` with the settlement receipt, base64 encoded, in the `PAYMENT-RESPONSE` header. Save the key: it is shown only once. 5. A purchase sent with an `X-API-Key` header tops up that key instead of creating a new one. Errors of a purchase: `400` invalid payment or claim, `404` unknown package, `409` the payment belongs to another operation or client, `503` payment pending (retry with the same authorization, do not create a new payment) or the payment service is unavailable. Without the ability to sign x402 payments, a person can buy a package with a browser wallet (e.g. MetaMask, USDC on Base, no ETH needed) at `https://qrbar-code.intami.pl/wallet.html?package=`; append `#api_key=` to top up an existing key. The page shows the API key after the payment. ## Output formats of the generators The `Accept` header selects the output: `image/png` (default, also for `*/*`, `image/*` and an empty header), `image/jpeg`, `image/gif`, `image/webp`, `image/tiff`, `image/bmp`, `application/pdf`. Accept lists with q-values are supported. Append `;base64` (e.g. `image/png;base64`) to get the output as base64 text. An unsupported `Accept` gives `400`. A generator answers `201 Created` with the image; `Content-Type` is the produced format. The optional `X-TraceId` header is copied to the answer. ## POST /generate/qr/text QR code of a text. JSON body: - `text` (string, required) - text to encode. - `size` (integer) - image size in pixels, default 256, at most 4096. - `foregroundColor`, `backgroundColor` (string) - `#RGB`, `#RGBA`, `#RRGGBB`, `#RRGGBBAA` or `transparent`; defaults `#000000ff` and `#ffffffff`. - `withBorder` (boolean) - add a border (quiet zone) in the background color, default false. - `errorRecovery` (string) - `low`, `medium` (default), `high` or `highest`. `POST /generate/qr` is the same endpoint. ```shell curl -H 'Accept: image/png' 'https://qrbar-code.intami.pl/generate/qr/text' --output qr.png \ --data '{"text":"Hello", "size":256, "withBorder":true, "foregroundColor":"#ff0000", "errorRecovery":"high"}' ``` ## POST /generate/qr/url QR code of a web address. Body: `url` (string, required) and the common fields of `/generate/qr/text` (`size`, colors, `withBorder`, `errorRecovery`). ```shell curl -H 'Accept: image/png;base64' 'https://qrbar-code.intami.pl/generate/qr/url' --output qr.png.base64 --data '{"url":"https://example.com"}' ``` ## POST /generate/qr/tel QR code of a phone number (content `tel:`). Body: `tel` (string, required) and the common fields. ## POST /generate/qr/wifi QR code that joins a WiFi network (content `WIFI:S:;T:;P:;H:;;`, special characters escaped). Body: `sid` (network name), `security` (`WEP`, `WPA`, `WPA2-EAP` or `nopass`; the password is left out for `nopass`), `password`, `hidden` (boolean, default false) and the common fields. ```shell curl -H 'Accept: image/png' 'https://qrbar-code.intami.pl/generate/qr/wifi' --output wifi.png \ --data '{"sid":"MyWiFi", "security":"WPA", "password":"secret123"}' ``` ## POST /generate/qr/vcard QR code of a contact card (vCard). Body: `title`, `firstName`, `lastName` (strings), `tels`, `emails`, `urls` (arrays of `{"type":"work","value":"..."}`, `type` optional) and the common fields. ```shell curl -H 'Accept: image/png' 'https://qrbar-code.intami.pl/generate/qr/vcard' --output contact.png \ --data '{"firstName":"Jan", "lastName":"Kowalski", "tels":[{"type":"work","value":"+48 123 456 789"}], "emails":[{"value":"jan@example.com"}]}' ``` ## POST /generate/bar/{type} Bar code. `type` is `code128` (default for `/generate/bar`), `code39`, `code93`, `ean` (also `ean13`; data of 12 or 13 digits), `twooffive` (also `2of5`), `codabar`, `pdf417`, `datamatrix` or `aztec`. JSON body: - `data` (string, required) - data to encode. - `width` (integer) - width in pixels, default 300, at most 4096. - `height` (integer) - height in pixels, default 100, at most 4096. The answer has the header `X-BarCode-Type` with the generated type. Data that the type cannot encode, an unknown type or a size over the limit give `400`. ```shell curl -H 'Accept: image/png' 'https://qrbar-code.intami.pl/generate/bar/code128' --output bar.png \ --data '{"data":"123456789012", "width":350, "height":100}' ``` ## POST /decode Decodes QR codes and bar codes (EAN-13, EAN-8, UPC-A, UPC-E, Code 128, Code 39, Code 93, ITF, Codabar, Data Matrix, Aztec; not PDF417) from an image or a PDF. The body is the raw file. Images: png, jpeg, gif, webp, tiff, bmp (the format is detected from the content). PDF: set `Content-Type: application/pdf`. Answer (`201`, `application/json`): an array, empty when no code was found, of - `content` (string) - decoded content, - `meta.codeType` - `qrCode` or `barCode`, - `meta.format` - format of a bar code, e.g. `EAN_13`, `CODE_128`, - `meta.errorCorrection` - error correction level of a QR code, when known, - `meta.pdfPage` - page of the PDF where the code was found. Errors: `413` body over 10 MB, `422` not an image nor a PDF, a PDF of more than 10 pages, an image of more than 4096 x 4096 pixels. ```shell curl -H 'Accept: application/json' -H 'Content-Type: image/png' 'https://qrbar-code.intami.pl/decode' --data-binary @image.png curl -H 'Accept: application/json' -H 'Content-Type: application/pdf' -H 'X-API-Key: qr_...' 'https://qrbar-code.intami.pl/decode' --data-binary @document.pdf ``` ## MCP server URL `https://qrbar-code.intami.pl/mcp`, streamable HTTP transport, stateless (JSON responses). Access and limits are the same as for the REST API: the free daily allowance is shared with it; initialization, the tool list and a tool call that ends with an error do not use it. Send the API key in the `X-API-Key` header of the client configuration or in the `api_key` argument of the tools. Tools: - `generate_qr_code` - QR code as a PNG image. Arguments: `type` (`text` default, `url`, `tel`, `wifi`, `vcard`), `text`, `url`, `tel`, `wifi` (`{sid, security, password, hidden}`), `vcard` (`{title, firstName, lastName, tels, emails, urls}`), `backgroundColor`, `foregroundColor`, `withBorder`, `errorRecovery`, `size`, `api_key`. - `generate_bar_code` - bar code as a PNG image. Arguments: `type` (`code128` default, `code39`, `code93`, `ean`, `twooffive`, `codabar`, `pdf417`, `datamatrix`, `aztec`), `data`, `width`, `height`, `api_key`. - `decode_codes` - decodes codes from a base64 encoded image or PDF. Arguments: `data` (base64), `mimeType` (`application/pdf` for a PDF), `api_key`. Result: `{"codes":[...], "pages":n}` with the items of `/decode`. - `buy_package` - buys a package with an x402 payment. Arguments: `package` (id), `claim` (optional random secret of 16-128 characters; resend it when retrying the same payment), `api_key` (top up that key). The first call returns the x402 payment requirements (`x402Version` 2, `accepts`); retry the same call with the signed payment in `_meta["x402/payment"]`. The result contains the API key; the receipt is in `_meta["x402/payment-response"]`. When the free limit is exceeded, a tool returns an error result `payment_required` with the packages and `wallet_urls`: links to the wallet page where the user pays with a browser wallet and gets an API key. Results of calls with a package key carry the requests left in `_meta["requests_remaining"]`. Only an agent that can sign x402 payments within the user's wallet budget should use `buy_package`. ```json {"mcpServers": {"qrbar-code": {"type": "http", "url": "https://qrbar-code.intami.pl/mcp", "headers": {"X-API-Key": "qr_..."}}}} ``` ## Limits - `/decode` body: 10 MB; MCP request body: 10 MB (including the base64 encoded image of `decode_codes`). - Generator JSON body: 64 KB. - Generated images: at most 4096 px in width and height; results up to 10 MB. - PDF to decode: at most 10 pages; pages are rendered at up to 300 dpi (lower for large pages). - Image to decode: at most 4096 x 4096 pixels. - 20 free requests per day per IP address; 120 requests per minute per IP address.