QR Code API with cURL

Generate QR codes from the command line. Perfect for bash scripts, CI/CD pipelines, and quick testing.

Basic Usage

# Generate a QR code and save to file
curl "https://qrcodeapi.io/api/generate?data=https://example.com" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o qr.png

Custom Options

# Custom size and colors
curl "https://qrcodeapi.io/api/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -G \
  --data-urlencode "data=https://github.com" \
  --data "size=500" \
  --data "color=4F46E5" \
  --data "background=F3F4F6" \
  -o branded-qr.png

SVG Output

# Get vector SVG format
curl "https://qrcodeapi.io/api/generate?data=hello&format=svg" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o qr.svg

Environment Variable for API Key

# Set your API key once
export QR_API_KEY="qr_your_key_here"

# Use in commands
curl "https://qrcodeapi.io/api/generate?data=test" \
  -H "Authorization: Bearer $QR_API_KEY" \
  -o qr.png

Bash Script Example

#!/bin/bash
# generate-qr.sh - Generate QR codes from a list

API_KEY="${QR_API_KEY}"
INPUT_FILE="urls.txt"

while IFS= read -r url; do
  filename=$(echo "$url" | md5sum | cut -d' ' -f1).png
  
  curl -s "https://qrcodeapi.io/api/generate" \
    -H "Authorization: Bearer $API_KEY" \
    -G \
    --data-urlencode "data=$url" \
    -o "qrcodes/$filename"
  
  echo "Generated: $filename"
done < "$INPUT_FILE"

POST with JSON Body

# Use POST for complex data
curl -X POST "https://qrcodeapi.io/api/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "data": "https://example.com/very/long/url/with/params?a=1&b=2",
    "size": 400,
    "color": "000000",
    "background": "ffffff"
  }' \
  -o qr.png

Batch Generation

# Generate multiple QR codes at once
curl -X POST "https://qrcodeapi.io/api/batch" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {"data": "https://example1.com"},
      {"data": "https://example2.com"},
      {"data": "https://example3.com"}
    ],
    "output": "zip"
  }' \
  -o qrcodes.zip

Check Response Headers

# See response details without downloading
curl -I "https://qrcodeapi.io/api/generate?data=test" \
  -H "Authorization: Bearer YOUR_API_KEY"

Get Your API Key

Sign up to get your API key and start generating.

Get Free API Key