developer template

Github Social Preview Generator API

Repo cards sized for GitHub social preview, share posts, and READMEs

GitHub Social Preview template preview, a developer image generated by the html2img API

Use cases for the Github Social Preview Generator API

The GitHub Social Preview template is the shortest path to a working github social preview 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:

  • GitHub repository social previews
  • Open source launch posts
  • Developer portfolio cards

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 GitHub Social Preview as a PNG:

curl -X POST https://app.html2img.com/api/v1/templates/github-social-preview \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"repo_name":"acme/feather","description":"A 12kb React state management library that fits in your head.","language":"TypeScript","language_color":"#3178C6","stars":"12.4k","forks":"482","owner_name":"Acme","owner_avatar_url":"https://i.pravatar.cc/160?img=8","background_color":"#0D1117","accent_color":"#58A6FF"}'

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

Inputs at a glance

A quick summary of what the GitHub Social Preview template accepts. The full reference, including example values and array shapes, is in the docs.

Name Type Required
repo_name string Required
description string Optional
language string Optional
language_color string Optional
stars string Optional
forks string Optional
owner_name string Optional
owner_avatar_url url Optional
background_color string Optional
accent_color string Optional

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

Related templates

Ready to render your first GitHub Social Preview?

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