API Documentation

Generate beautiful Open Graph images programmatically with a simple API call. Perfect for blogs, social media, and dynamic content.

Quick Start

1. Get Your API Key

Sign up and create an API key from your dashboard.

2. Make Your First Request

curl "https://ogforge.io/api/og-image?api_key=YOUR_API_KEY&template=blog-post&title=Hello+World"

3. Use the Image

<meta property="og:image" content="https://ogforge.io/api/og-image?api_key=YOUR_API_KEY&template=blog-post&title=My+Article" />

Endpoint Reference

GET/api/og-image

Generate an Open Graph image with customizable templates and parameters.

Base URL

https://ogforge.io

Authentication

Include your API key as a query parameter:

?api_key=YOUR_API_KEY

Common Parameters

ParameterTypeRequiredDescription
api_keystringYesYour API authentication key
templatestringYesTemplate name (see templates section)
formatstringNoImage format: png, jpeg, webp (default: png)
themestringNoTheme: light or dark (default: dark)
gradientstringNoGradient style: radial, linear, sunset, ocean, forest, purple, midnight, aurora, fire, candy
fontstringNoFont family: inter, roboto, poppins, montserrat, playfair, merriweather, lato, oswald, raleway, nunito, ubuntu, rubik, work-sans, dm-sans, space-grotesk
backgroundColorstringNoBackground color or gradient. Accepts: hex color (e.g., 1a1a2e), gradient preset (sunset, ocean, etc.), or custom gradient (linear:#ff5733,#3366ff)
presetstringNoStyle preset: modern, minimal, bold, elegant, playful, tech, corporate

Advanced Customization

OGForge provides 36 customization parameters plus 7 style presets for complete control over your OG images. Use presets for quick styling, or customize every aspect with granular parameters.

Style Presets

Quick-start styles that configure multiple parameters at once:

modern
minimal
bold
elegant
playful
tech
corporate

Example: ?preset=modern&pattern=grid

Typography (11 parameters)

ParameterTypeDescription
titleSizenumberTitle font size in pixels (20-120, default: 56)
titleWeightstringFont weight (400-900, default: 700)
titleAlignstringText alignment: left, center, right
titleLetterSpacingstringLetter spacing (e.g., 0.05em, -0.02em)
titleMaxLinesnumberMax lines before truncation (1-5, default: 3)
+ subtitleSize, subtitleWeight, metaSize and more...

Layout (7 parameters)

ParameterTypeDescription
paddingXnumberHorizontal padding in pixels (20-200, default: 60)
paddingYnumberVertical padding in pixels (20-200, default: 60)
contentGapnumberGap between elements (0-100, default: 32)
+ contentAlign, horizontalAlign, accentBarWidth, accentBarHeight

Visual Effects (9 parameters)

ParameterTypeDescription
borderRadiusnumberBorder radius for elements (0-50, default: 0)
textShadowstringCSS text-shadow (e.g., 2px 2px 4px rgba(0,0,0,0.5))
glowIntensitynumberGlow intensity for text (0-100)
+ boxShadow, overlayColor, overlayOpacity, glowColor, etc.

Background (8 parameters)

ParameterTypeDescription
backgroundImagestringURL to background image
backgroundBlurnumberBlur amount in pixels (0-20)
patternstringPattern: dots, grid, diagonal-lines, waves, noise, hexagons
patternOpacitynumberPattern opacity (0.0-1.0, default: 0.1)
+ backgroundSize, backgroundPosition, backgroundOpacity, patternColor

Quick Example

?preset=modern&titleSize=72&pattern=grid&borderRadius=16&glowIntensity=30

For complete documentation with 50+ examples, see the Customization Guide

Templates

blog-post

Perfect for blog articles

Parameters:

titleauthorauthorImagelogo

social-card

General social media sharing

Parameters:

titledescriptionimagesiteName

article

News articles and posts

Parameters:

titlecategoryreadingTimeauthordate

quote

Inspirational quotes

Parameters:

quoteauthorauthorTitle

announcement

Product announcements

Parameters:

titlesubtitledate

testimonial

Customer testimonials

Parameters:

quoteauthorcompanyrating

documentation

Technical documentation

Parameters:

titlesectionversion

podcast

Podcast episodes

Parameters:

titleepisodehostsduration

youtube

YouTube videos

Parameters:

titlechannelviewsduration

product

Product showcases

Parameters:

namepriceratingreviews

event

Events and webinars

Parameters:

titledatelocationtime

newsletter

Newsletter editions

Parameters:

titleissuedate

Code Examples

Blog Post Template

curl "https://ogforge.io/api/og-image?api_key=YOUR_API_KEY&template=blog-post&title=10+Best+Practices+for+API+Design&author=Jane+Smith&theme=dark"

Social Card Template

curl "https://ogforge.io/api/og-image?api_key=YOUR_API_KEY&template=social-card&title=Introducing+OGForge&description=Generate+beautiful+OG+images+instantly&siteName=OGForge"

Rate Limits

API requests are rate-limited to ensure fair usage and system stability.

Requests per minute30
Monthly limit (Free)50 images
Monthly limit (Starter)1,000 images
Monthly limit (Pro)5,000 images
Monthly limit (Business)25,000 images

Rate Limit Headers: Check the X-RateLimit-Remaining header in responses to track your usage.

Error Responses

400Bad Request

Invalid parameters or missing required fields.

{
  "error": "Validation failed",
  "details": [
    {
      "field": "template",
      "message": "Invalid template name"
    }
  ]
}
401Unauthorized

Invalid or missing API key.

{
  "error": "Invalid API key"
}
429Too Many Requests

Rate limit exceeded.

{
  "error": "Too many image generation requests",
  "retryAfter": 45
}
402Payment Required

Monthly limit exceeded. Upgrade your plan.

{
  "error": "Monthly limit exceeded",
  "limit": 50,
  "used": 50
}

Best Practices

✓ Do

  • • Cache generated images to reduce API calls
  • • URL-encode all parameter values
  • • Check rate limit headers before batch requests
  • • Use appropriate image formats (WebP for web)
  • • Implement exponential backoff for 429 errors

✗ Don't

  • • Regenerate the same image repeatedly
  • • Share API keys or commit them to source control
  • • Exceed rate limits with rapid-fire requests
  • • Include sensitive data in image parameters
  • • Use demo API key in production

Support

Need Help?

Have questions or run into issues? We're here to help!