QR Code

Generate QR codes from structured input.

apicrate-generate-qr

Generate a QR code from text, URL, WiFi credentials, vCard, email, SMS, or geographic coordinates. Returns a base64 data URI by default, or a pre-signed S3 download URL for PNG/SVG formats.

Credit cost: 2 credits per call.

Parameters

Parameter

Type

Required

Description

preset

string

yes

QR type: text, url, wifi, vcard, email, sms, geo

text

string

preset=text

Text to encode

url

string

preset=url

URL to encode

ssid

string

preset=wifi

WiFi network name

password

string

no

WiFi password (default empty)

name

string

preset=vcard

Contact full name

to

string

preset=email

Recipient email address

phone

string

preset=sms

Phone number

latitude

float

preset=geo

Latitude (-90 to 90)

longitude

float

preset=geo

Longitude (-180 to 180)

format

string

no

Output: base64 (default), png, svg

size

int

no

Image size 100–2000 px (default 400)

fg_color

string

no

Foreground hex color (default #000000)

bg_color

string

no

Background hex color (default #FFFFFF)

error_correction

string

no

L, M (default), Q, H

margin

int

no

Quiet zone 0–20 modules (default 4)

Example – Text QR

Request:

{
  "name": "apicrate-generate-qr",
  "arguments": {
    "preset": "text",
    "text": "Hello from ApiCrate!"
  }
}

Response:

{
  "preset": "text",
  "format": "base64",
  "data_uri": "data:image/png;base64,iVBORw0KGgo..."
}

Example – WiFi QR

Request:

{
  "name": "apicrate-generate-qr",
  "arguments": {
    "preset": "wifi",
    "ssid": "GuestNetwork",
    "password": "welcome2025",
    "format": "png"
  }
}

Response:

{
  "preset": "wifi",
  "format": "png",
  "url": "https://s3.example.com/qr/abc123.png?X-Amz-...",
  "expires": 1744819200
}

Errors

  • Unknown preset – only text, url, wifi, vcard, email, sms, and geo are supported.

  • Missing required parameter – each preset requires specific fields (e.g., ssid for wifi, name for vcard).

  • S3 unavailable – when using png or svg format and S3 is down. Use format=base64 as fallback.