Skip to content

Generate Open Graph images from an API

An OG image API makes the picture shown when a link is shared. With PostImager you send a post title and fields to /v1/renders using the article card or quote card at the link size, and get back a 1200 by 630 image. Store the file on your own site: download links expire after 24 hours and files after 7 days, so PostImager is not an image host.

How to use it

  1. Create a render with the template article-card and the size link when a post is published.
  2. Download the file from output.download.url and upload it to your own storage.
  3. Point your page's og:image tag at your stored copy.

Good to know

This suits a publishing step in a workflow, not rendering on each page view. A render can wait up to about 30 seconds on the free plan's browser limit, so run it when the post goes out.

Common questions

What size should an OG image be?
1200 by 630 pixels is the common size, and it is what the article card and quote card use at the link size.
Can I link straight to the generated image?
No. Download links expire after 24 hours and files are deleted after 7 days, so keep your own copy.