← Back to Home

API Documentation

Generate beautiful OG images with a simple GET request.

Base URL

GET /api/og

Parameters

titlestringrequired

Main title text (required)

descriptionstring

Subtitle or description text

templatestring

Template style: default, minimal, branded, blog, product, social, gradient

Default: default

themestring

Color theme: dark, light, black, navy, warm

Default: dark

brandstring

Brand name to display

accentstring

Accent color in hex format

Default: #6366f1

authorstring

Author name (for blog/social templates)

tagstring

Category tag (for blog template)

datestring

Date string (for blog template)

emojistring

Emoji to display (for product template)

Default: 🚀

fromstring

Gradient start color (for gradient template)

Default: #667eea

tostring

Gradient end color (for gradient template)

Default: #764ba2

Templates

defaultClean layout with title, description, and optional brand
minimalCentered title with optional description
brandedBrand header with accent bar at bottom
blogBlog post style with tag, author, and date
productProduct announcement with emoji block
socialQuote/tweet style with author
gradientFull gradient background

Examples

Basic Usage

GET /api/og?title=Hello%20World

Blog Post

GET /api/og?title=10%20Tips%20for%20Better%20Code&template=blog&tag=Tutorial&author=Crystal&date=Feb%202026

Product Launch

GET /api/og?title=Introducing%20OGPix&description=Beautiful%20social%20images&template=product&brand=OGPix&emoji=✨

Gradient Style

GET /api/og?title=Build%20Something%20Amazing&template=gradient&from=%23f97316&to=%23ec4899

Integration Examples

HTML Meta Tags

<meta property="og:image" content="https://ogpix.io/api/og?title=My%20Page%20Title" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://ogpix.io/api/og?title=My%20Page%20Title" />

Next.js

// app/blog/[slug]/page.tsx
export async function generateMetadata({ params }) {
  const post = await getPost(params.slug);
  
  return {
    openGraph: {
      images: [`https://ogpix.io/api/og?title=${encodeURIComponent(post.title)}&template=blog`],
    },
  };
}

cURL

curl -o image.png "https://ogpix.io/api/og?title=Hello%20World&theme=dark"

JavaScript/Fetch

const params = new URLSearchParams({
  title: 'My Amazing Post',
  description: 'A great description',
  template: 'branded',
  brand: 'My Site',
});

const imageUrl = `https://ogpix.io/api/og?${params}`;

Python

import urllib.parse
import requests

params = {
    'title': 'My Amazing Post',
    'template': 'blog',
    'author': 'Crystal',
}

url = f"https://ogpix.io/api/og?{urllib.parse.urlencode(params)}"
response = requests.get(url)

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

Response

Returns a PNG image with the following properties:

  • Content-Type: image/png
  • Dimensions: 1200 × 630 pixels
  • Cache: Images are cached at the edge for fast delivery

Built with ❤️ by Crystal • © 2026