QRay API

Generate QR codes from your own apps with a simple REST API: all 8 data types, PNG and SVG, colors, gradients, logos and frames — everything the web generator can do.

Get an API key https://qray.io/api/v1

Try it now — no signup

Paste this in your terminal. You get a real QR code back in one request:

curl -X POST https://qray.io/api/v1/demo \
  -H "Content-Type: application/json" \
  -d '{"qr":{"type":"url","fields":{"url":"https://qray.io"},"style":{"dot_style":"rounded","gradient":{"colors":["#2563EB","#A3E635"],"angle":45}}}}' \
  -o qr.png && open qr.png

Opens qr.png (macOS; on Linux use xdg-open qr.png). No key needed — the demo allows 10 requests/hour per IP.

Authentication

Every request must include your API key in the X-Api-Key header. Create and manage keys in your dashboard.

curl https://qray.io/api/v1/usage \
  -H "X-Api-Key: qray_live_YOUR_KEY"

The full key is shown only once, at creation. Store it in a secret manager — we keep only a SHA-256 digest.

Quickstart

Generate a styled QR code for a URL:

curl -X POST https://qray.io/api/v1/generate \
  -H "X-Api-Key: qray_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "qr": {
      "type": "url",
      "fields": { "url": "https://example.com" },
      "format": "png",
      "size": 512,
      "style": {
        "fg_color": "#111113",
        "dot_style": "rounded",
        "gradient": { "colors": ["#2563EB", "#A3E635"], "angle": 45 }
      }
    }
  }'

The response contains the image as base64 plus permanent URLs:

{
  "hash": "1c9a7f2b40d861e3",
  "format": "png",
  "size": 512,
  "image": "iVBORw0KGgoAAA…",          // base64
  "image_url": "https://qray.io/qr/1c9a7f2b40d861e3.png",
  "share_url": "https://qray.io/qr/1c9a7f2b40d861e3",
  "url": "/qr/1c9a7f2b40d861e3"
}

Endpoints

EndpointDescription
POST /api/v1/demo Generate a QR code without a key (keyless demo)
POST /api/v1/generate Generate a QR code
GET /api/v1/qr_codes List your QR codes
GET /api/v1/qr_codes/:hash Get one QR code
DELETE /api/v1/qr_codes/:hash Delete a QR code
GET /api/v1/qr_codes/:hash/image Get the QR image binary
GET /api/v1/health Service health and deployed version
GET /api/v1/usage Current plan and usage
GET /api/v1/api_keys List your API keys
POST /api/v1/api_keys Create an additional API key
DELETE /api/v1/api_keys/:id Revoke an API key

Prefer a machine-readable spec? Explore it interactively or import our OpenAPI file into Postman, Insomnia or a client generator: Interactive API explorer · openapi.yaml

QR types and fields

Pass the data type in qr.type and its fields in qr.fields:

typefields
urlurl
texttext
wifissid, password, encryption (WPA | WEP | nopass), hidden (true | false)
vcardfirst_name, last_name, phone, email, org, title, url
emailaddress, subject, body
phonenumber
smsnumber, message
geolatitude, longitude

For example, a WiFi QR your guests can scan to connect:

curl -X POST https://qray.io/api/v1/demo \
  -H "Content-Type: application/json" \
  -d '{"qr":{"type":"wifi","fields":{"ssid":"MyCafe","password":"latte123","encryption":"WPA"}}}' \
  -o wifi.png && open wifi.png

Options and styling

ParameterDescription
formatpng (default) | svg
size256 | 512 (default) | 1024 | 2048
style.fg_colorForeground hex color, e.g. #111113.
style.bg_colorBackground hex color, e.g. #FFFFFF.
style.dot_stylesquare | circle | rounded
style.eye_stylesquare | rounded
style.logo_dataRaw base64 PNG/JPG, no data: prefix (max ~500 KB).
style.gradientTwo or more colors; overrides fg_color.
style.framePNG only; ignored for SVG.

Images are cached for 24 hours and transparently regenerated afterwards — image_url is permanent and safe to hotlink.

Plans and rate limits

Each key has a daily quota that resets at midnight UTC:

PlanRequests
free100 requests / day
pro10 000 requests / day
enterprise100 000 requests / day

Every response carries the current window state:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87

Need pro or enterprise? Write to support@qray.io and we will upgrade your key.

Errors

HTTPerrorDescription
400missing_parameterA required parameter is missing or the body is malformed.
401unauthorizedMissing, invalid, or revoked API key.
404not_foundResource not found, or owned by another account.
422cannot_delete_active_keyAn API key cannot revoke the key used to authenticate the request.
422invalid_dataThe data to encode is empty or exceeds the length limit.
422unknown_typeqr.type is not one of the supported types.
422validation_failedThe resource could not be saved (see details).
429rate_limitedThe plan's daily request limit is exhausted.
503service_unavailableThe QR generation service is temporarily unavailable.