Skip to content

Quick Start

Get your first OG image generated in under 5 minutes.

Step 1: Get Your API Key

  1. Choose a plan on our pricing page
  2. Complete checkout via Stripe
  3. Receive your API key via email

Your API key looks like: og_aBcDeFgHiJkLmNoPqRsTuVwXyZ123456

Keep it secret!

Your API key grants access to your account. Never expose it in client-side code.

Step 2: Make Your First Request

Use cURL to generate a test image:

bash
curl -X POST https://ogimageapi.io/api/generate \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "title": "Hello, World!",
    "subtitle": "My first OG image",
    "theme": "dark"
  }' \
  --output hello.png

Open hello.png - you should see your generated image!

Step 3: Customize Your Image

The API accepts these parameters:

ParameterTypeRequiredDescription
titlestringYesMain headline (max 200 chars)
subtitlestringNoSecondary text (max 300 chars)
author_namestringNoAuthor/creator name
author_avatar_urlstringNoURL to avatar image
themestringNodark or light (default: dark)
templatestringNodefault, minimal, or vibrant

Step 4: Integrate

Static Site Generators

Generate images during your build process:

javascript
// generate-og-images.js
const fs = require('fs');

async function generateOGImage(post) {
  const response = await fetch('https://ogimageapi.io/api/generate', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': process.env.OG_IMAGE_API_KEY
    },
    body: JSON.stringify({
      title: post.title,
      subtitle: post.excerpt,
      author_name: post.author,
      theme: 'dark'
    })
  });

  const buffer = await response.arrayBuffer();
  fs.writeFileSync(`./public/og/${post.slug}.png`, Buffer.from(buffer));
}

Dynamic Generation

For dynamic content, generate on-demand:

html
<meta property="og:image" content="https://your-server.com/api/og?title=Your+Title" />

Next Steps

Generate stunning Open Graph images programmatically.