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 Playground

Base 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+Page

No-key demo example:

https://www.webmorp.art/api/og/minimal?demo=1&title=My+Page&theme=dark&accent=%232563eb

Auto-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=article

Templates

SlugNameUse case
articleArticleBlog post with title, subtitle, author, image.
productProductE-commerce product card with price.
quoteQuotePull quote with author attribution.
podcastPodcastEpisode card with cover art and show name.
eventEventEvent card with date and location.
jobJobJob listing with company and location.
minimalMinimalTitle + subtitle, no frills.
brandBrandCentered logo with tagline.
gradientGradientAuto-generated gradient background.
dark-codeDark CodeCode snippet with syntax highlighting.

Query parameters

Empty values are dropped. All values should be URL-encoded.

NameRequiredDescription
keyProductionAPI key (`ogk_live_…`); also accepted as `Authorization: Bearer`.
demoDemo onlyUse `demo=1` without a key for watermarked evaluation images.
titleYesTitle text (1–300 chars). Required for the image to render.
subtitleNoSubheading (article, minimal, gradient).
authorNoAuthor (article, quote).
imageNoHTTPS URL to an image (article, product, podcast, event).
logoNoHTTPS URL (product, job, brand).
avatarNoHTTPS URL (quote).
priceNoPrice string (product).
dateNoDate or time (event).
locationNoPlace (event, job).
companyNoCompany name (job).
episodeNoEpisode label (podcast).
showNoShow name (podcast).
taglineNoTagline (brand).
codeNoCode snippet (dark-code).
languageNoe.g. ts, js (dark-code).
themeNo`light`, `dark`, or `classic` for supported templates.
accentNoAccent color as `#RRGGBB` for supported templates.
bgNoBackground color as `#RRGGBB` for supported templates.
fontNoFont family name for supported templates.
patternNo`none`, `dots`, or `grid` for supported templates.
domainSecurityOptional domain claim checked against the API key allowlist.
sigSecurityHMAC-SHA256 signature when a key requires signed URLs.

Errors (JSON body)

404 unknown_templateTemplate id is not in the list below.

401Missing, invalid, or revoked API key.

400 invalid_paramsZod validation failed; often empty `title` or invalid image URL.

429Monthly (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