OG Pilot
Developer Documentation

OG Pilot API Documentation

Generate beautiful dynamic Open Graph images programmatically with signed URLs and ready-to-use templates.

  • Sign JWTs locally so your API key never leaves your server.
  • One URL generates branded OG images for every page.
  • Live previews help you validate layouts before shipping.
Live Template Preview
Customize the form below and see your OG image update in real-time

Used locally to derive sub. Stored only in your browser.

Default template for landing pages, homepages, and general content

1200 × 630px
Logo

OG Pilot

Generate beautiful Open Graph images programmatically

Hero

This preview simulates how your OG image will appear. The actual API generates a high-quality PNG.

{ "iss": "yourdomain.com", "sub": "YOUR_KEY", "iat": 1769808122, "template": "page", "title": "OG Pilot", "description": "Generate beautiful Open Graph images programmatically", "bg_color": "#1a1a2e", "text_color": "#eaeaea", "logo_url": "https://api.dicebear.com/7.x/shapes/svg?seed=acmecorp&backgroundColor=transparent&shape1Color=eaeaea&shape2Color=a0a0a0&shape3Color=808080", "image_url": "https://images.unsplash.com/photo-1551434678-e076c223a692?w=800&q=80" }

Sign this payload with HS256 using your API key as the secret. Remove iat for indefinite caching.

https://ogpilot.com/api/v1/images?token=YOUR_JWT_TOKEN
Getting Started
  1. Sign up at ogpilot.com
  2. Add your domain and verify ownership via DNS TXT
  3. Generate an API key in Settings → API Keys
  4. Ruby: Install the "og_pilot_ruby" gem to generate OG images in your application
  5. JavaScript, Python, PHP: Install the official SDKs (og-pilot-js, og-pilot, sunergos/og-pilot-php) and use the code examples below to generate URLs
How It Works
JWT signing happens in your application, not on OG Pilot servers

OG Pilot uses JWT tokens signed with your API key to authenticate requests. This means:

  • Your API key never leaves your server — it's used only to sign tokens
  • Each page gets a unique signed URL — generated at render time with dynamic content
  • Social platforms fetch the image — when they crawl your og:image meta tag
Your App
Sign JWT
og:image URL
Social Platform
OG Pilot CDN

1. Install gem & configure once

# Gemfile
gem "og_pilot_ruby"

# Set OG_PILOT_API_KEY and OG_PILOT_DOMAIN in your environment variables
# OG_PILOT_API_KEY=ogpilot-your-api-key
# OG_PILOT_DOMAIN=yourdomain.com

2. Generate images anywhere

# Use in meta tag
<meta property="og:image"
  content="<%= OgPilotRuby.create_image(title: "My Post Title") %>" />
Integration Checklist
Quick reference for setting up OG Pilot in your application

Install the appropriate library

Ruby: og_pilot_ruby
JS: og-pilot-js
Python: og-pilot
PHP: sunergos/og-pilot-php

Store API key and domain in environment variables

OG_PILOT_API_KEY=ogpilot-your-api-key
OG_PILOT_DOMAIN=yourdomain.com

Configure the SDK once

Ruby: OgPilotRuby.configure
JS: configure
Python: og_pilot.configure
PHP: OgPilot::setConfig (or .env in Laravel)

Add og:image meta tag to your layout

Ruby: OgPilotRuby.create_image(title: ...)
JS: createImage(...)
Python: og_pilot.create_image(...)
PHP: OgPilot::createImage([...])

Override per-page as needed

Pass template-specific parameters (author, date, etc.) to customize individual pages

Authentication

All API requests require a signed JWT passed as the token query parameter:

https://ogpilot.com/api/v1/images?token=YOUR_JWT_TOKEN

Required JWT claims:

  • iss - Verified domain hostname for your account
  • sub - API key prefix (first 8 characters of your API key)

Optional: iat for daily cache busting, plus any image parameters like template, title, and description.

API keys are account-scoped and can be used with any verified domain on your account.

Domain ownership must be verified via DNS TXT before the API generates images. For local development, requests from localhost are allowed in development mode only.

Cache Busting

If you include iat in the JWT payload, OG Pilot treats the image as cacheable for 24 hours from that timestamp.

To refresh daily, generate a new JWT with a new iat value. If you omit iat, the image will remain cached indefinitely until parameters change.

If a new render is queued, OG Pilot serves the last completed image while regeneration happens in the background. When no prior image exists, JSON responses return a 202 and HTML/PNG requests redirect to a processing placeholder. Failed renders return an error placeholder while OG Pilot retries.

Templates Reference

pagedefault

Default template for landing pages, homepages, and general content

ParameterTypeRequiredDescription
issstringYesVerified domain hostname for your account
substringYesAPI key prefix (first 8 chars of your key)
titlestringYesMain headline (max 60 chars)
bg_colorstringNoBackground color (hex)
descriptionstringNoSubtitle text (max 100 chars)
iatintegerNoIssued-at timestamp for daily cache busting
image_urlstringNoURL to main/hero image
logo_urlstringNoURL to your brand logo
templatestringNoTemplate type
text_colorstringNoText color (hex)

blog_post

Optimized for blog articles with author info and publication date

ParameterTypeRequiredDescription
issstringYesVerified domain hostname for your account
substringYesAPI key prefix (first 8 chars of your key)
titlestringYesMain headline (max 60 chars)
author_avatar_urlstringNoAuthor avatar URL
author_namestringNoAuthor name
bg_colorstringNoBackground color (hex)
iatintegerNoIssued-at timestamp for daily cache busting
image_urlstringNoURL to main/hero image
logo_urlstringNoURL to your brand logo
publish_datestringNoPublication date (ISO 8601)
templatestringNoTemplate type
text_colorstringNoText color (hex)

podcast

Designed for podcast episodes with episode metadata

ParameterTypeRequiredDescription
issstringYesVerified domain hostname for your account
substringYesAPI key prefix (first 8 chars of your key)
titlestringYesEpisode title
bg_colorstringNoBackground color (hex)
episode_datestringNoEpisode date (ISO 8601)
iatintegerNoIssued-at timestamp for daily cache busting
image_urlstringNoURL to main/hero image
logo_urlstringNoURL to your brand logo
templatestringNoTemplate type
text_colorstringNoText color (hex)

product

E-commerce product pages with USP badges

ParameterTypeRequiredDescription
issstringYesVerified domain hostname for your account
substringYesAPI key prefix (first 8 chars of your key)
titlestringYesProduct name
bg_colorstringNoBackground color (hex)
iatintegerNoIssued-at timestamp for daily cache busting
image_urlstringNoURL to main/hero image
logo_urlstringNoURL to your brand logo
templatestringNoTemplate type
text_colorstringNoText color (hex)
unique_selling_pointstringNoUSP badge text

event

Event pages with date, location, and ticket info

ParameterTypeRequiredDescription
issstringYesVerified domain hostname for your account
substringYesAPI key prefix (first 8 chars of your key)
titlestringYesEvent name
bg_colorstringNoBackground color (hex)
event_datestringNoEvent date or range
event_locationstringNoEvent location
iatintegerNoIssued-at timestamp for daily cache busting
image_urlstringNoURL to main/hero image
logo_urlstringNoURL to your brand logo
templatestringNoTemplate type
text_colorstringNoText color (hex)

book

Book and publication pages

ParameterTypeRequiredDescription
book_authorstringYesBook author
issstringYesVerified domain hostname for your account
substringYesAPI key prefix (first 8 chars of your key)
titlestringYesBook title
bg_colorstringNoBackground color (hex)
book_descriptionstringNoLonger description
book_genrestringNoBook genre
book_series_numberintegerNoSeries number
descriptionstringNoBook description
iatintegerNoIssued-at timestamp for daily cache busting
image_urlstringNoURL to main/hero image
logo_urlstringNoURL to your brand logo
templatestringNoTemplate type
text_colorstringNoText color (hex)

portfolio

Personal portfolio and profile pages

ParameterTypeRequiredDescription
issstringYesVerified domain hostname for your account
substringYesAPI key prefix (first 8 chars of your key)
bg_colorstringNoBackground color (hex)
iatintegerNoIssued-at timestamp for daily cache busting
image_urlstringNoURL to main/hero image
logo_urlstringNoURL to your brand logo
templatestringNoTemplate type
text_colorstringNoText color (hex)
Code Examples
Use these helper functions to generate dynamic OG images. Pass page-specific values as parameters.
# Gemfile
gem "og_pilot_ruby"

# Set the API key and domain in your environment variables
OG_PILOT_API_KEY=your-og-pilot-api-key
OG_PILOT_DOMAIN=yourdomain.com

# ============================================================
# USAGE IN YOUR CONTROLLERS / VIEWS
# ============================================================

# Generate an OG image URL (handles JWT signing automatically)
og_image = OgPilotRuby.create_image(title: "My Page Title")

# With template and additional parameters
og_image = OgPilotRuby.create_image(
  title: @post.title,
  template: "blog_post",
  author_name: @post.author.name,
  publish_date: @post.published_at.to_date.iso8601,
  image_url: @post.featured_image_url
)

# In ERB templates
# <meta property="og:image" content="<%= OgPilotRuby.create_image(title: @page_title) %>" />

# ============================================================
# FULL CONTROLLER EXAMPLE (with Inertia.js meta tags)
# ============================================================

class PostsController < ApplicationController
  def show
    @post = Post.find(params[:id])

    og_image = OgPilotRuby.create_image(
      title: @post.title,
      description: @post.excerpt,
      template: "blog_post",
      author_name: @post.author.name
    )

    # Works great with Inertia Rails meta tags
    inertia_meta.add [
      {tag_name: "meta", property: "og:image", content: og_image},
      {tag_name: "meta", name: "twitter:image", content: og_image}
    ]

    render inertia: "posts/show", props: {post: @post}
  end
end

Security: Never hardcode your API key. Store it in an environment variable like OG_PILOT_API_KEY.

Error Codes
400 Bad RequestMissing or invalid parameters
401 UnauthorizedInvalid JWT token
403 ForbiddenDomain mismatch, not verified, or subscription required
404 Not FoundNot found
429 Too Many RequestsRate limited

Ship branded OG images in your next deploy

Connect your domain, generate signed URLs, and let OG Pilot handle every social preview. One endpoint, all your templates.

🔐JWT signing stays on your server⚡️Templates ready for blogs, products, and podcasts

Ready to onboard your next app?

Start a trial and ship OG images that earn clicks.

🌐

7-day free trial. No credit card required.