Social Image Generator API

Generate Open Graph / Twitter preview images (1200×630 PNG or JPEG) from a title, subtitle and site name, with correct Vietnamese typography and themes.

GETPOSThttps://apibox.io.vn/v1/og-image
Images & Codes▶ Try it online

The OG image API draws the picture shown when a link is shared on Facebook, Zalo, X, LinkedIn or Slack. Give it a title, an optional subtitle, a small tag (“Mới”, “Blog”…) and a site name; it lays them out on a 1200×630 canvas with a colour band and returns a PNG (or JPEG). The title takes the largest size that fits in four lines and long titles end with an ellipsis.

Text is rendered from the Be Vietnam Pro typeface, designed for Vietnamese, so stacked diacritics (ặ, ễ, ỗ) are positioned correctly, which many generic image services get wrong. Choose a theme (light, dark, brand), your own background, background2 (gradient), color and accent, align=center, and the size: og (1200×630), twitter (1200×675), linkedin, square (1080×1080) or story (1080×1920).

Use the URL directly in <meta property="og:image">: images are cacheable for a day, so social networks fetch them once.

Parameters

NameInTypeRequiredDefault
titlequery|bodystringyesMain title (max 300 characters).
subtitlequery|bodystringnoSubtitle.
tagquery|bodystringnoSmall label above the title.
sitequery|bodystringnoSite / brand name at the bottom.
themequery|bodystringnolightlight, dark or brand.
sizequery|bodystringnoogog, twitter, linkedin, square, story.
backgroundquery|bodystringnoBackground colour (hex); background2 for a gradient.
colorquery|bodystringnoText colour.
accentquery|bodystringnoAccent colour (band, tag).
alignquery|bodystringnoleftleft or center.
formatquery|bodystringnopngpng or jpeg.

Example

curl "https://apibox.io.vn/v1/og-image?title=Bộ API cho lập trình viên Việt Nam&subtitle=VietQR, tỉnh thành, lịch âm&site=apibox.io.vn&tag=Mới" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o output

Response

binary image/png

Use cases

  • og:image for every blog post and product page
  • Share cards for events, job posts and announcements
  • Thumbnails for Zalo and Facebook link previews
  • Instagram / story covers from a headline

FAQ

How do I use it in my pages?

Put the API URL with your parameters in <meta property="og:image" content="…">, or generate the image once and store it.

Can I add a logo?

Not yet; use the site name and accent colour as a brand line.

Why PNG and not SVG?

Social networks only accept bitmap images (PNG, JPEG) for previews.

Related APIs

Start with 1,000 free requests every month. Get free API key →