Skip to content

Generate QR codes programmatically with the public API

Automate QR asset creation for agents, internal tools, templates, and campaign workflows using the Netlify function API.

Developer guide

QR Code Crafter publishes OpenAPI and AI discovery files so automated agents can find the generation endpoint, supported formats, rate guidance, and request schema.

The API accepts a payload value, output format, size, colors, error correction level, margin, and optional logo data URL.

Key decisions

Agent-readable discovery

Use /ai.txt, /.well-known/openapi.json, /openapi.yaml, and /.well-known/webmcp.json to understand the tool surface.

Six export formats

Generate SVG, PNG, JPG, WebP, PDF, and EPS assets from the same request structure.

Optional API keys

Requests can include X-Agent-Api-Key when credentials are issued, while public access remains available unless enforcement is enabled.

API request options

OptionAccepted valuesUse
formatsvg, png, jpg, webp, pdf, epsChoose the output asset type
size256-4096Set image dimensions for raster and layout exports
errorCorrectionLevelL, M, Q, HUse H when adding a logo or printing in tough conditions

Agent integration checklist

  • Set a descriptive User-Agent so QR Code Crafter can identify automated integrations.
  • Honor 429 and 503 Retry-After headers before retrying requests.
  • Decode the base64 data field from POST responses and save it with the returned extension.
  • Run a live smoke test across each content payload and export format before relying on the API in production.

Frequently asked questions

Which endpoint generates QR codes?

Use /.netlify/functions/generate-qr with either GET query parameters or a POST JSON body.

Does the API require authentication?

API key support is optional. Include X-Agent-Api-Key if you have one, and design clients to handle 401 if enforcement is enabled later.

Which file formats can the API return?

The public contract supports SVG, PNG, JPG, WebP, PDF, and EPS output formats.