API reference

OGMint is one GET endpoint that returns a 1200×630 PNG. Every design decision is a query parameter, so your card is exactly as dynamic as the string you build.

The endpoint

GET https://ogmint.dev/api/og?template=gradient&title=Hello%20world&site=you.dev

Returns image/png, 1200×630 — the exact size Open Graph and Twitter cards want. Put it in a meta tag and you're done:

<meta property="og:image" content="https://ogmint.dev/api/og?title=Hello" />
<meta name="twitter:card" content="summary_large_image" />

Remember to URL-encode valuesencodeURIComponent in JavaScript, urlencode in most template languages.

Parameters

ParamDefaultWhat it does
templategradientOne of gradient, minimal, code, editorial, announcement, quote, stat. Unknown values fall back to gradient.
titleThe headline. Up to 140 characters; the font size steps down automatically as it grows.
subtitleemptySupporting line, up to 200 characters.
siteemptyYour site name or domain — rendered as the small chip.
accent2dd4a7Hex color, with or without #. Drives glows, chips, rules, and badges.
themedarkdark or light. The code template is always dark.
badgevariesPill text on announcement (default NEW), the kicker on editorial, the fake command on code.
authoremptyByline on editorial and attribution on quote.
value42%The big number on stat. Up to 20 characters.
labelemptyThe line under the big number on stat.
keyYour API key. Removes the corner badge and lifts the anonymous limit.

Templates

gradient

Ink canvas, soft accent glow, top accent bar. Uses title, subtitle, site. The safe, handsome default.

minimal

Hairline frame on quiet paper with an accent tick. Uses title, subtitle, site. Try theme=light.

code

A terminal window. site becomes the window's filename, badge the dimmed command line, title the highlighted output, subtitle a secondary output line. Always dark.

editorial

Serif magazine head. badge is the kicker (falls back to site), author the byline. Beautiful in theme=light with a warm accent like e2725b.

announcement

Centered launch card. badge is the pill (default NEW).

quote

Serif italic pull-quote with an oversized mark. title is the quote (quotation marks stripped automatically), author the attribution, subtitle their role.

stat

One huge number. value is the number, label its caption, title a context line at the bottom.

API keys

Keys are free during beta: grab one in the playground — email in, key out, no card. Append it to any render:

https://ogmint.dev/api/og?title=Hello&key=og_your_key_here

A valid key removes the corner badge and lifts the anonymous IP limit. Keys go in the URL because crawlers can't send headers for you; treat them like a public site key, not a secret. Signed URLs for tamper-proofing ship with the Scale tier.

Caching

Renders are cached at Cloudflare's edge, keyed on the canonical set of known parameters (junk parameters can't bust the cache). Responses carry cache-control: public, max-age=86400, s-maxage=31536000, immutable and an x-ogmint-cache: HIT | MISS header.

Want a new design for the same URL? Change any parameter — a different string is a different card. Social platforms cache aggressively on their side too; use their debuggers (Facebook Sharing Debugger, LinkedIn Post Inspector) to force a re-scrape after changes.

Rate limits

Exceeding the anonymous limit returns 429 with a JSON body pointing here.

Errors & fallbacks

A card URL in a meta tag must never break, so render failures don't return errors — they return a clean fallback card with your title on the default template, flagged with x-ogmint-degraded: 1. Only malformed API usage (bad signup payloads, exceeded limits) returns JSON errors.

Recipes

Next.js (App Router)

export async function generateMetadata({ params }) {
  const post = await getPost(params.slug);
  const og = `https://ogmint.dev/api/og?template=editorial&title=${encodeURIComponent(post.title)}&author=${encodeURIComponent(post.author)}&site=you.dev`;
  return { openGraph: { images: [og] }, twitter: { card: "summary_large_image" } };
}

Astro

---
const og = `https://ogmint.dev/api/og?template=minimal&title=${encodeURIComponent(frontmatter.title)}&site=you.dev`;
---
<meta property="og:image" content={og} />

Ghost

<!-- Settings → Code injection → Site header -->
<script>
  const t = document.querySelector("meta[property='og:title']")?.content || document.title;
  const m = document.createElement("meta");
  m.setAttribute("property", "og:image");
  m.content = "https://ogmint.dev/api/og?template=editorial&title=" + encodeURIComponent(t) + "&site=yourblog.com";
  document.head.appendChild(m);
</script>

Plain curl, because you're curious

curl -o card.png "https://ogmint.dev/api/og?template=stat&value=99.98%25&label=uptime&site=status.you.dev"