API Documentation

Everything you need to integrate PixSnap into your applications.

Authentication

All API requests require authentication. You can authenticate using either method:

1. Authorization Header (Recommended)

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://pixsnap.dev/api/og?title=Hello"

2. Query Parameter

curl "https://pixsnap.dev/api/og?title=Hello&api_key=YOUR_API_KEY"

Security Note: Keep your API keys secure. Never expose them in client-side code or public repositories.

Rate Limits

Rate limits are based on your subscription plan:

PlanMonthly RequestsRate Limit
Free1,00010 req/sec
Starter10,00050 req/sec
Pro50,000100 req/sec
Enterprise250,000500 req/sec

Endpoints

OG Image Generation

GET/api/og

Generate Open Graph images dynamically for social media sharing.

Parameters

NameTypeRequiredDefaultDescription
titlestringNoHello WorldMain title text
descriptionstringNo-Subtitle or description text
themestringNolightColor theme: light, dark, gradient, ocean, sunset
templatestringNodefaultLayout template: default, blog, social, minimal
widthnumberNo1200Image width (200-2048)
heightnumberNo630Image height (200-2048)
fontSizenumberNo64Title font size (12-200)
bgColorstringNo-Custom background color (hex)
textColorstringNo-Custom text color (hex)

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://pixsnap.dev/api/og?title=My%20Blog%20Post&theme=dark&template=blog"

Response

Returns PNG image

QR Code Generation

GET/api/qr

Generate customizable QR codes for any data.

Parameters

NameTypeRequiredDefaultDescription
datastringNohttps://pixsnap.devData to encode (URL, text, etc.)
sizenumberNo300Image size in pixels (50-1000)
formatstringNopngOutput format: png, svg
darkstringNo#000000QR code color (hex)
lightstringNo#ffffffBackground color (hex)
marginnumberNo4Quiet zone margin (0-10)
errorCorrectionstringNoMError correction level: L, M, Q, H

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://pixsnap.dev/api/qr?data=https://pixsnap.dev&size=400&dark=%230ea5e9"

Response

Returns PNG or SVG image

Placeholder Images

GET/api/placeholder

Generate placeholder images for development and prototyping.

Parameters

NameTypeRequiredDefaultDescription
widthnumberNo300Image width (10-2000)
heightnumberNo200Image height (10-2000)
sizestringNo-Alternative format: 300x200
bgstringNo#e5e7ebBackground color (hex)
textstringNo#6b7280Text color (hex)
labelstringNo-Custom label text
showDimensionsbooleanNotrueShow dimensions on image
patternstringNo-Background pattern: grid, cross

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://pixsnap.dev/api/placeholder?width=800&height=400&bg=%230ea5e9&text=%23ffffff"

Response

Returns PNG image

URL Metadata

GET/api/meta

Extract metadata from any URL for link previews.

Parameters

NameTypeRequiredDefaultDescription
urlstringYes-URL to extract metadata from

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://pixsnap.dev/api/meta?url=https://github.com"

Response

{
  "success": true,
  "data": {
    "url": "https://github.com",
    "title": "GitHub: Let's build from here",
    "description": "GitHub is where...",
    "image": "https://github.githubassets.com/...",
    "siteName": "GitHub",
    "favicon": "https://github.com/favicon.ico",
    ...
  }
}

Error Codes

StatusDescription
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
429Rate Limit Exceeded - Monthly limit reached
500Internal Server Error
502Bad Gateway - Failed to fetch external URL

Code Examples

JavaScript / Node.js

const response = await fetch(
  'https://pixsnap.dev/api/og?' + new URLSearchParams({
    title: 'My Blog Post',
    theme: 'dark'
  }),
  {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  }
);

const imageBlob = await response.blob();

Python

import requests

response = requests.get(
    'https://pixsnap.dev/api/og',
    params={'title': 'My Blog Post', 'theme': 'dark'},
    headers={'Authorization': 'Bearer YOUR_API_KEY'}
)

with open('image.png', 'wb') as f:
    f.write(response.content)

HTML (Direct Image Embed)

<img
  src="https://pixsnap.dev/api/og?title=My%20Post&api_key=YOUR_KEY"
  alt="OG Image"
/>

<!-- For meta tags -->
<meta
  property="og:image"
  content="https://pixsnap.dev/api/og?title=My%20Post&api_key=YOUR_KEY"
/>