Reference
OG image API
Renders a 1200×630 Open Graph (PNG) image. All templates use the same endpoint; only the template slug and query string change.
For a long-form SEO perspective on link previews, see the Open Graph images guide.
Open PlaygroundBase URL
Use your deployed app root (e.g. NEXT_PUBLIC_APP_URL). If the app is mounted under a path, include it (see basePath / NEXT_PUBLIC_BASE_PATH in this project).
Example base: https://www.webmorp.art
Authentication
Choose one of for production usage:
- Query:
?key=ogk_live_… - Header:
Authorization: Bearer ogk_live_…
Create keys from the dashboard after you sign in. For evaluation, add demo=1 and omit the key. Demo images are watermarked.
Endpoint
GET /api/og/{template}
Replace {template} with one of the slugs in the table below. Query parameters follow (see search params, excluding key when you use a header for auth).
Minimal example (replace KEY and use your key):
https://www.webmorp.art/api/og/minimal?key=KEY&title=My+PageNo-key demo example:
https://www.webmorp.art/api/og/minimal?demo=1&title=My+Page&theme=dark&accent=%232563ebAuto-generate from a URL
Use /api/og/auto when you want OGKit to fetch a page, extract metadata, and choose an article or minimal card. You can still override fields with query parameters.
https://www.webmorp.art/api/og/auto?key=KEY&url=https%3A%2F%2Fexample.com&template=articleTemplates
| Slug | Name | Use case |
|---|---|---|
| article | Article | Blog post with title, subtitle, author, image. |
| product | Product | E-commerce product card with price. |
| quote | Quote | Pull quote with author attribution. |
| podcast | Podcast | Episode card with cover art and show name. |
| event | Event | Event card with date and location. |
| job | Job | Job listing with company and location. |
| minimal | Minimal | Title + subtitle, no frills. |
| brand | Brand | Centered logo with tagline. |
| gradient | Gradient | Auto-generated gradient background. |
| dark-code | Dark Code | Code snippet with syntax highlighting. |
Query parameters
Empty values are dropped. All values should be URL-encoded.
| Name | Required | Description |
|---|---|---|
| key | Production | API key (`ogk_live_…`); also accepted as `Authorization: Bearer`. |
| demo | Demo only | Use `demo=1` without a key for watermarked evaluation images. |
| title | Yes | Title text (1–300 chars). Required for the image to render. |
| subtitle | No | Subheading (article, minimal, gradient). |
| author | No | Author (article, quote). |
| image | No | HTTPS URL to an image (article, product, podcast, event). |
| logo | No | HTTPS URL (product, job, brand). |
| avatar | No | HTTPS URL (quote). |
| price | No | Price string (product). |
| date | No | Date or time (event). |
| location | No | Place (event, job). |
| company | No | Company name (job). |
| episode | No | Episode label (podcast). |
| show | No | Show name (podcast). |
| tagline | No | Tagline (brand). |
| code | No | Code snippet (dark-code). |
| language | No | e.g. ts, js (dark-code). |
| theme | No | `light`, `dark`, or `classic` for supported templates. |
| accent | No | Accent color as `#RRGGBB` for supported templates. |
| bg | No | Background color as `#RRGGBB` for supported templates. |
| font | No | Font family name for supported templates. |
| pattern | No | `none`, `dots`, or `grid` for supported templates. |
| domain | Security | Optional domain claim checked against the API key allowlist. |
| sig | Security | HMAC-SHA256 signature when a key requires signed URLs. |
Errors (JSON body)
404 unknown_template — Template id is not in the list below.
401 — Missing, invalid, or revoked API key.
400 invalid_params — Zod validation failed; often empty `title` or invalid image URL.
429 — Monthly (or daily, on Scale) quota reached.
Next.js — opengraph-image alternative
Point metadata.openGraph.images at a fully qualified OGKit URL (or use /api/og/… on the same origin).
export const metadata = {
title: { absolute: "My post — OGKit" },
openGraph: {
title: "My post",
images: ["https://www.webmorp.art/api/og/article?key=KEY&title=My+post&author=ACME"]
},
twitter: {
card: "summary_large_image",
images: ["https://www.webmorp.art/api/og/article?key=KEY&title=My+post&author=ACME"]
}
};Signed URLs and domain allowlists
Paid keys can require signed URLs and domain claims from the dashboard. Sign the canonical path and sorted query string, excluding sig, with HMAC-SHA256 using the full API key as the secret.
// pseudo-code
const url = new URL("https://www.webmorp.art/api/og/minimal?key=KEY&title=Hello&domain=example.com");
url.searchParams.sort();
const sig = hmacSha256(fullApiKey, url.pathname + "?" + url.searchParams.toString());
url.searchParams.set("sig", sig);Guides and comparisons
Plain fetch
const u = new URL("https://www.webmorp.art/api/og/minimal");
u.searchParams.set("key", process.env.OGKIT_KEY!);
u.searchParams.set("title", "Hello");
const r = await fetch(u);
if (!r.ok) throw new Error(String(r.status));
const buf = await r.arrayBuffer();
// e.g. write to disk or return new Response(buf, { headers: { "Content-Type": "image/png" } })LLM and crawler discovery
For coding agents and search systems that ingest plain-text site maps, use /llms.txt (same facts at /llm.txt). It lists endpoints, templates, pricing summary, and deep links to comparisons and use cases.
Need live preview?
Use the Playground to pick a template, fill fields, and copy the final URL.
Go to Playground