social template

Tweet Mockup Card: Tweet Card Image Generator API

Render a tweet-style card from supplied data — avatar, body, image, metrics

Tweet Mockup Card template preview, a social image generated by the html2img API

Use cases for the Tweet Card Image Generator API

The Tweet Mockup Card template is the shortest path to a working tweet card image generator 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:

  • Tweet quote cards for blog posts
  • Replicating tweets for slide decks
  • Tweet screenshots for newsletters

How it works

1

Send a JSON payload

POST to the template endpoint with the values you want rendered. Authenticate with your API key.

2

We render the image

The template is rendered server-side as a 1200x630 PNG (or whatever dimensions the template defines).

3

You get back a URL

The response includes a CDN URL for the PNG. Cache it, embed it, attach it to a tweet, anything you need.

Quick example

A single cURL call to render a Tweet Mockup Card as a PNG:

curl -X POST https://app.html2img.com/api/v1/templates/tweet-mockup-card \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"display_name":"Jordan Whitfield","handle":"@jwhitfield","body":"shipped a tiny side project this weekend and it already has more users than my last YC company\n\nfunny how that works","avatar_url":"https://i.pravatar.cc/160?img=15","verified":"blue","timestamp":"8:14 AM \u00b7 Apr 30, 2026","replies":"124","retweets":"512","likes":"4.2K","views":"182K","theme":"light"}'

For the full PHP, Node and Python equivalents, plus every input the template accepts, see the Tweet Mockup Card API reference. Setting up your key is covered in the authentication guide.

Inputs at a glance

A quick summary of what the Tweet Mockup Card template accepts. The full reference, including example values and array shapes, is in the docs.

Name Type Required
display_name string Required
handle string Required
body string Required
avatar_url url Optional
verified enum Optional
image_url url Optional
timestamp string Optional
replies string Optional
retweets string Optional
likes string Optional
views string Optional
theme enum Optional

See the full inputs reference for descriptions, examples and validation rules.

Related templates

Ready to render your first Tweet Mockup Card?

Sign up free, grab an API key, send a payload. The pricing page covers the higher-volume plans if you outgrow the free tier.