API Documentation

ShotOG generates beautiful OG images with a single API call. Edge-native, globally fast, developer-friendly.

Authentication

Pass your API key via the X-Api-Key header or api_key query parameter. Demo mode (no key) allows 10 requests/day.

# Create a free API key
curl -X POST https://shotog.2214962083.workers.dev/v1/keys \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com"}'

# Returns: { "key": "sk_...", "tier": "free", "monthly_limit": 500 }

Generate OG Image

GET /v1/og

Generate an image via query parameters. Perfect for embedding in <meta> tags.

# Simple
curl "https://shotog.2214962083.workers.dev/v1/og?title=Hello%20World"

# Full options
curl "https://shotog.2214962083.workers.dev/v1/og?title=My%20Post&subtitle=Great%20read&template=blog&eyebrow=Tech&author=Jane&api_key=sk_..."

POST /v1/og

Generate an image via JSON body.

curl -X POST https://shotog.2214962083.workers.dev/v1/og \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: sk_..." \
  -d '{
    "title": "My Post",
    "template": "blog",
    "subtitle": "A great read",
    "eyebrow": "Tech",
    "author": "Jane Doe"
  }'

POST /v1/og/batch

Generate up to 20 images in a single request. Returns JSON with base64 data URIs.

curl -X POST https://shotog.2214962083.workers.dev/v1/og/batch \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: sk_..." \
  -d '{
    "images": [
      {"id": "hero", "title": "My Product", "template": "product"},
      {"id": "blog-1", "title": "First Post", "template": "blog", "author": "Alice"}
    ],
    "defaults": {"format": "png", "width": 1200, "domain": "example.com"}
  }'

# Response:
# {
#   "results": [
#     {"id":"hero","success":true,"dataUri":"data:image/png;base64,..."},
#     {"id":"blog-1","success":true,"dataUri":"data:image/png;base64,..."}  
#   ],
#   "summary": {"total":2,"succeeded":2,"failed":0}
# }

Parameters

ParameterTypeRequiredDescription
titlestringYesMain title text
templatestringNoTemplate name (default: basic). Options: basic, blog, product, social, event, changelog, testimonial, announcement
subtitlestringNoSubtitle or description
eyebrowstringNoSmall text above title (e.g. "NEW", "Blog")
authorstringNoAuthor name
domainstringNoDomain watermark (default: shotog.com)
bgColorstringNoBackground color (hex, e.g. #667eea)
textColorstringNoText color (hex)
accentColorstringNoAccent color (hex)
formatstringNoOutput format: png (default) or svg
widthnumberNoImage width, 200-2400 (default: 1200)
heightnumberNoImage height, 200-1260 (default: 630)
fontUrlstringNoURL to a TTF/OTF font file (max 5MB, cached 1h)
avatarstringNoAvatar image URL (for blog, social, testimonial templates)
logostringNoLogo image URL (for basic, product templates)

Other Endpoints

EndpointMethodDescription
/v1/og/templatesGETList all available templates
/v1/keysPOSTCreate a new API key (self-service)
/v1/keys/usageGETCheck usage (requires X-Api-Key header)
/v1/og/batchPOSTBatch generate up to 20 images (returns JSON with base64)
/healthGETHealth check

SDK (TypeScript / JavaScript)

npm install shotog
import { ShotOG } from "shotog";

const og = new ShotOG({ apiKey: "sk_..." });

// Generate URL (no network request)
const url = og.url({ title: "Hello", template: "blog" });

// Generate image binary
const buffer = await og.generate({ title: "Hello", template: "blog" });

Response Headers

HeaderDescription
X-CacheHIT or MISS — indicates cache status
X-Render-Time-MsTotal render time in milliseconds
X-SVG-Time-MsSVG generation time
X-PNG-Time-MsPNG conversion time

Rate Limits

See Pricing for tier-based limits. Demo mode (no API key): 10 requests/day.