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:
| Plan | Monthly Requests | Rate Limit |
|---|---|---|
| Free | 1,000 | 10 req/sec |
| Starter | 10,000 | 50 req/sec |
| Pro | 50,000 | 100 req/sec |
| Enterprise | 250,000 | 500 req/sec |
Endpoints
OG Image Generation
GET
/api/ogGenerate Open Graph images dynamically for social media sharing.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
title | string | No | Hello World | Main title text |
description | string | No | - | Subtitle or description text |
theme | string | No | light | Color theme: light, dark, gradient, ocean, sunset |
template | string | No | default | Layout template: default, blog, social, minimal |
width | number | No | 1200 | Image width (200-2048) |
height | number | No | 630 | Image height (200-2048) |
fontSize | number | No | 64 | Title font size (12-200) |
bgColor | string | No | - | Custom background color (hex) |
textColor | string | No | - | 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/qrGenerate customizable QR codes for any data.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
data | string | No | https://pixsnap.dev | Data to encode (URL, text, etc.) |
size | number | No | 300 | Image size in pixels (50-1000) |
format | string | No | png | Output format: png, svg |
dark | string | No | #000000 | QR code color (hex) |
light | string | No | #ffffff | Background color (hex) |
margin | number | No | 4 | Quiet zone margin (0-10) |
errorCorrection | string | No | M | Error 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/placeholderGenerate placeholder images for development and prototyping.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
width | number | No | 300 | Image width (10-2000) |
height | number | No | 200 | Image height (10-2000) |
size | string | No | - | Alternative format: 300x200 |
bg | string | No | #e5e7eb | Background color (hex) |
text | string | No | #6b7280 | Text color (hex) |
label | string | No | - | Custom label text |
showDimensions | boolean | No | true | Show dimensions on image |
pattern | string | No | - | 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/metaExtract metadata from any URL for link previews.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | Yes | - | 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
| Status | Description |
|---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
429 | Rate Limit Exceeded - Monthly limit reached |
500 | Internal Server Error |
502 | Bad 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" />