/api/v1/ogGenerate beautiful, dynamic Open Graph images for social media sharing. Perfect for blog posts, product pages, and any content that benefits from custom social media previews.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| title | string | Yes | - | The main title text for the OG image. Max 100 characters. |
| description | string | No | - | Subtitle or description text. Max 200 characters. |
| theme | string | No | dark | Color theme: dark, light, gradient, ocean, sunset, forest. |
| logo | string | No | - | URL to a logo image to display in the top-left corner. |
| font | string | No | inter | Font family: inter, roboto, playfair, mono. |
| author | string | No | - | Author name displayed at the bottom of the image. |
| template | string | No | default | Template style: default, blog, product, minimal. |
defaultClean layout with title, description, and optional logo. Great for general purpose use.
blogOptimized for blog posts with author name, reading time badge, and category label.
productProduct-focused with prominent title, price badge, and call-to-action area.
minimalUltra-clean design with just the title and a subtle gradient background.
# Basic OG image
curl "https://captureapi.dev/api/v1/og?title=My+Blog+Post&description=A+deep+dive+into+APIs&theme=dark" \
-H "X-API-Key: cap_your_key" \
-o og-image.png
# With logo and author
curl "https://captureapi.dev/api/v1/og?title=Product+Launch&description=Introducing+our+new+API&theme=gradient&logo=https://example.com/logo.png&author=Jane+Doe&template=blog" \
-H "X-API-Key: cap_your_key" \
-o og-blog.pngasync function generateOgImage(title, options = {}) {
const params = new URLSearchParams({
title,
...(options.description && { description: options.description }),
theme: options.theme || "dark",
...(options.logo && { logo: options.logo }),
...(options.font && { font: options.font }),
...(options.author && { author: options.author }),
template: options.template || "default",
});
const response = await fetch(
`https://captureapi.dev/api/v1/og?${params}`,
{ headers: { "X-API-Key": process.env.CAPTURE_API_KEY } }
);
if (!response.ok) throw new Error("Failed to generate OG image");
return response.arrayBuffer();
}
// Use in Next.js metadata
export async function generateMetadata({ params }) {
const post = await getPost(params.slug);
return {
openGraph: {
images: [
`https://captureapi.dev/api/v1/og?title=${encodeURIComponent(post.title)}&theme=dark`
],
},
};
}import requests
import os
def generate_og_image(title, **kwargs):
params = {
"title": title,
"theme": kwargs.get("theme", "dark"),
"template": kwargs.get("template", "default"),
}
if kwargs.get("description"):
params["description"] = kwargs["description"]
if kwargs.get("author"):
params["author"] = kwargs["author"]
response = requests.get(
"https://captureapi.dev/api/v1/og",
params=params,
headers={"X-API-Key": os.environ["CAPTURE_API_KEY"]}
)
response.raise_for_status()
return response.content
# Usage
image = generate_og_image(
"My Awesome Blog Post",
description="A comprehensive guide to building APIs",
theme="gradient",
author="John Smith"
)
with open("og-image.png", "wb") as f:
f.write(image)package main
import (
"io"
"net/http"
"net/url"
"os"
)
func main() {
params := url.Values{}
params.Set("title", "My Awesome Blog Post")
params.Set("description", "A comprehensive guide to building APIs")
params.Set("theme", "gradient")
params.Set("author", "John Smith")
req, _ := http.NewRequest("GET",
"https://captureapi.dev/api/v1/og?"+params.Encode(), nil)
req.Header.Set("X-API-Key", os.Getenv("CAPTURE_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
f, _ := os.Create("og-image.png")
defer f.Close()
io.Copy(f, resp.Body)
}require "net/http"
require "uri"
params = URI.encode_www_form(
title: "My Awesome Blog Post",
description: "A comprehensive guide to building APIs",
theme: "gradient",
author: "John Smith"
)
uri = URI("https://captureapi.dev/api/v1/og?#{params}")
req = Net::HTTP::Get.new(uri)
req["X-API-Key"] = ENV["CAPTURE_API_KEY"]
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(req)
}
File.open("og-image.png", "wb") { |f| f.write(res.body) }<?php
$url = "https://captureapi.dev/api/v1/og?" . http_build_query([
"title" => "My Awesome Blog Post",
"description" => "A comprehensive guide to building APIs",
"theme" => "gradient",
"author" => "John Smith",
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("CAPTURE_API_KEY")
]);
$response = curl_exec($ch);
curl_close($ch);
file_put_contents("og-image.png", $response);
?>Automatically generate social cards for each blog post with the title, author, and category.
Create product-specific OG images with pricing and promotional text for better click-through rates.
Generate consistent social previews for your documentation pages with version numbers and section titles.
Create personalized social cards for user profile pages with avatar, name, and stats.