API Documentation

Everything you need to integrate the QR Code API into your application

Authentication

All API requests require an API key passed in the x-api-key header.

Demo API Key

Use your API key from the endpnt.dev dashboard in the x-api-key header.

API Endpoint

POSThttps://qr.endpnt.dev/api/v1/generate
GEThttps://qr.endpnt.dev/api/v1/generate?data=...

Both GET and POST methods are supported. For POST requests, send parameters in the request body as JSON. For GET requests, send parameters as URL query parameters.

Parameters

ParameterTypeRequiredDefaultDescription
datastringYesText, URL, or any data to encode in the QR code
formatstringNopngOutput format: "png", "jpeg", "webp", "svg"
sizenumberNo300QR code size in pixels (100-2000)
colorstringNo#000000QR code color in hex format (e.g., #000000)
backgroundstringNo#ffffffBackground color in hex format (e.g., #ffffff)
marginnumberNo2Margin around QR code (0-10)
error_correctionstringNoMError correction level: "L", "M", "Q", "H"
logo_urlstringNoURL to logo image for embedding (HTTP/HTTPS only)
logo_sizenumberNo20Logo size as percentage of QR code (5-30)

Response Format

Success Response

{
  "success": true,
  "data": {
    "image": "base64_encoded_image_data...",
    "format": "png",
    "size": 300,
    "file_size_bytes": 12840,
    "warnings": []
  },
  "meta": {
    "request_id": "req_a1b2c3d4",
    "processing_ms": 245,
    "remaining_credits": 99
  }
}

Error Response

{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "data field is required and must be a string"
  },
  "meta": {
    "request_id": "req_a1b2c3d4",
    "processing_ms": 12
  }
}

Interactive API Tester

Test the API directly from this page. Enter your API key above to start testing.

API Parameters

Code Examples

cURL

curl -X POST https://qr.endpnt.dev/api/v1/generate \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "data": "https://example.com",
    "format": "png",
    "size": 300,
    "color": "#000000",
    "background": "#ffffff",
    "error_correction": "M"
  }'

JavaScript (Browser/Node.js)

// Using fetch
const response = await fetch('https://qr.endpnt.dev/api/v1/generate', {
  method: 'POST',
  headers: {
    'x-api-key': 'your_api_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    data: 'https://example.com',
    format: 'png',
    size: 300,
    color: '#000000',
    background: '#ffffff',
    logo_url: 'https://example.com/logo.png',
    logo_size: 20
  })
});

const result = await response.json();
if (result.success) {
  // result.data.image contains base64 image data
  const img = document.createElement('img');
  img.src = `data:image/${result.data.format};base64,${result.data.image}`;
  document.body.appendChild(img);
}

Node.js with axios

// Using Node.js with axios
const axios = require('axios');
const fs = require('fs');

async function generateQR(data) {
  try {
    const response = await axios.post(
      'https://qr.endpnt.dev/api/v1/generate',
      {
        data: data,
        format: 'png',
        size: 300,
        color: '#000000',
        background: '#ffffff'
      },
      {
        headers: {
          'x-api-key': 'your_api_key',
          'Content-Type': 'application/json'
        }
      }
    );

    if (response.data.success) {
      const imageBuffer = Buffer.from(response.data.data.image, 'base64');
      fs.writeFileSync('qrcode.png', imageBuffer);
      console.log('QR code generated!');
    }
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}

generateQR('https://example.com');

Python

import requests
import base64

# Make the API request
response = requests.post(
    'https://qr.endpnt.dev/api/v1/generate',
    headers={
        'x-api-key': 'your_api_key',
        'Content-Type': 'application/json'
    },
    json={
        'data': 'https://example.com',
        'format': 'png',
        'size': 300,
        'color': '#000000',
        'background': '#ffffff',
        'error_correction': 'M'
    }
)

result = response.json()
if result['success']:
    # Decode and save the QR code
    image_data = base64.b64decode(result['data']['image'])
    with open('qrcode.png', 'wb') as f:
        f.write(image_data)
    print(f"Saved QR code: {result['data']['size']}px")

Error Codes

CodeStatusDescription
AUTH_REQUIRED401Missing x-api-key header
INVALID_API_KEY401API key does not exist or is invalid
RATE_LIMIT_EXCEEDED429Too many requests for your tier
INVALID_PARAMS400Parameter validation failed
DATA_TOO_LONG400Input data exceeds maximum length
LOGO_FETCH_FAILED400Could not fetch or process logo image
GENERATION_FAILED500QR code generation failed
INTERNAL_ERROR500Internal server error

Rate Limits

Rate limits depend on your subscription tier:

Free Tier

10 requests per minute
100 requests per month

Starter ($29/month)

60 requests per minute
5,000 requests per month

Pro ($99/month)

300 requests per minute
25,000 requests per month

Enterprise (Custom)

1,000+ requests per minute
100,000+ requests per month

Rate Limit Headers

Check the remaining_credits field in the response to track your usage. When limits are exceeded, you'll receive a 429 status code.

Need Help?

Can't find what you're looking for? We're here to help.