---
title: "Barcode and QR Code Tool API"
method: POST
path: "/v1/barcode-tools"
tags: ["documents"]
---

# Barcode and QR Code Tool API

`POST /v1/barcode-tools`

## Request

- Base URL: `https://agent.pocket.network`
- URL: `https://agent.pocket.network/v1/barcode-tools`
- Auth: none required

Decode, generate or validate barcodes and QR codes. Decode reads up to 32 codes from a public HTTPS image (QR, Data Matrix, Aztec, PDF417, EAN, UPC, Code 128 and more); generate answers a temporary HTTPS URL to a PNG or SVG, kept one hour; validate checks a payload and its check digit. POST /v1/barcode with operation. Pay per request in USDC; no account, no API key.

## Request body

- object: The body of POST /v1/barcode. Each operation's fields are in the OpenAPI document the backend serves at /openapi.json. Format names are lowercase, as the formats operation lists them, e.g. qr_code, data_matrix, ean13, code128.
  - `operation` 'decode' | 'generate' | 'validate' | 'formats', required: decode reads an image; generate draws a code; validate checks a payload against a format; formats lists what can be read and written.
  - `image_url` string: For decode, the public HTTPS image to read.
  - `params` object: For decode, optional {formats, try_harder, max_results (1 to 32)}. For generate and validate, {format, text (up to 4096 characters)}, and for generate also width and height (1 to 4096, default 1024), margin, error_correction (L, M, Q, H) and output_format (png or svg).

## Response `200`

The upstream response, served after payment settles.

- object: A JSON object with ok and operation. decode adds results (format, text, bytes_base64, position, orientation, is_valid) and count; generate adds output with barcode_format, image_format, width, height, bytes, url and expires_in_seconds; validate adds valid and format; formats adds read_formats, write_formats and a formats table. A refused request answers ok false with a code, e.g. invalid_check_digit.

## Other responses

- `400`: Malformed request.
- `402`: Payment required. The x402 v2 terms are in the PAYMENT-REQUIRED header and, identically, in this body; sign the chosen option and retry with the PAYMENT-SIGNATURE header. The receipt arrives in PAYMENT-RESPONSE.
- `503`: This service is not currently available to serve.

---

[API](https://skmtc.dev/pocket/apis/pocket-agentic-portal.md) · [All operations](https://skmtc.dev/pocket/apis/pocket-agentic-portal/llms.txt) · [OpenAPI document](https://skmtc.dev/pocket/apis/pocket-agentic-portal/revisions/96d2176db014?raw)
