Send a JSON payload
POST to the template endpoint with the values you want rendered. Authenticate with your API key.
Generate dynamic Open Graph images from JSON
The Open Graph Image template is the shortest path to a working open graph image api from your stack. Send a small JSON payload, get back a tested PNG that fits your brand. No browser, no headless Chrome wrangling, no design tooling on your side.
Common reasons people reach for this template:
New to social card meta? The Open Graph protocol specification covers the underlying tags this template fills.
POST to the template endpoint with the values you want rendered. Authenticate with your API key.
The template is rendered server-side as a 1200x630 PNG (or whatever dimensions the template defines).
The response includes a CDN URL for the PNG. Cache it, embed it, attach it to a tweet, anything you need.
A single cURL call to render a Open Graph Image as a PNG:
curl -X POST https://app.html2img.com/api/v1/templates/open-graph-image \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"How to ship faster","subtitle":"A guide for engineering teams","author_name":"html2img.com","background_color":"#0F172A","accent_color":"#3B82F6"}' For the full PHP, Node and Python equivalents, plus every input the template accepts, see the Open Graph Image API reference. Setting up your key is covered in the authentication guide.
A quick summary of what the Open Graph Image template accepts. The full reference, including example values and array shapes, is in the docs.
| Name | Type | Required |
|---|---|---|
| title | string | Required |
| subtitle | string | Optional |
| author_name | string | Optional |
| author_avatar_url | url | Optional |
| logo_url | url | Optional |
| background_color | string | Optional |
| accent_color | string | Optional |
See the full inputs reference for descriptions, examples and validation rules.
Sign up free, grab an API key, send a payload. The pricing page covers the higher-volume plans if you outgrow the free tier.