QR code

Returns JSON with a QR code for your text or URL as SVG markup and an SVG data URL, with error correction level and border options, generated by the uqr library.

Use when you need a qr code generator for a URL, text, Wi-Fi or payment link as an SVG image.

Do not use for reading or decoding an existing QR code, logos, colored codes or PNG output.

Price: 0.004 USDC per call (x402, eip155:8453). Typical response time: 500 ms (p95).

Call it over HTTP (x402)

POST https://x402-gateway.blackwoodstate8.workers.dev/v1/qr-code. A request without payment gets 402 Payment Required with the PAYMENT-REQUIRED header; any x402 client signs an EIP-3009 authorization and retries with PAYMENT-SIGNATURE (or X-PAYMENT). Invalid input is answered with 400 and not charged.

curl -i -X POST https://x402-gateway.blackwoodstate8.workers.dev/v1/qr-code -H 'content-type: application/json' -d '{"text":"https://x402-gateway.blackwoodstate8.workers.dev","ecc":"M"}'
Pay to0xbD2cf002490E99124156baee307FBd5FDF5e57A7
Asset0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (USDC)
Amount4000 atomic units (0.004 USDC)
Authorization window60 s

Call it over MCP

Streamable HTTP at https://x402-gateway.blackwoodstate8.workers.dev/mcp, tool blackwood_qrcode_generate. Payment goes in _meta["x402/payment"]; without it the tool returns the payment requirements.

Input

FieldTypeMeaning
textstringText or URL to encode, e.g. https://example.com (up to 2000 characters)
ecc (optional)stringError correction level: L 7%, M 15% (default), Q 25%, H 30%
border (optional)integerQuiet zone around the code, in modules (default 2)
pixelSize (optional)integerSVG units per module (default 10)

Example:

{
  "text": "https://x402-gateway.blackwoodstate8.workers.dev",
  "ecc": "M"
}

Output

Real example:

{
  "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 370 370\"><r...(10900 characters)",
  "dataUrl": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcm...(14562 characters)",
  "version": 4,
  "modules": 37,
  "ecc": "M",
  "bytes": 10900
}
JSON Schema
{
  "type": "object",
  "properties": {
    "svg": {
      "type": "string"
    },
    "dataUrl": {
      "type": "string"
    },
    "version": {
      "type": "number"
    },
    "modules": {
      "type": "number"
    },
    "ecc": {
      "type": "string"
    },
    "bytes": {
      "type": "number"
    },
    "next": {
      "type": "object",
      "properties": {
        "service": {
          "type": "string",
          "description": "Service id of the suggested next paid call"
        },
        "tool": {
          "type": "string",
          "description": "MCP tool name of the same call"
        },
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST"
          ]
        },
        "url": {
          "type": "string",
          "description": "Paid route of the next call"
        },
        "useWhen": {
          "type": "string",
          "description": "When the next call is the right one"
        },
        "sample": {
          "type": "string",
          "description": "Free fixed sample of the whole family"
        }
      },
      "required": [
        "service",
        "tool",
        "method",
        "url",
        "useWhen",
        "sample"
      ],
      "additionalProperties": false,
      "description": "Suggested next paid call in the same family (call it in a loop when the task continues)"
    }
  },
  "required": [
    "svg",
    "dataUrl",
    "version",
    "modules",
    "ecc",
    "bytes"
  ],
  "additionalProperties": false
}

More

Free schema and example: GET https://x402-gateway.blackwoodstate8.workers.dev/v1/qr-code. OpenAPI 3.1 · llms.txt · All services