IMAGE
open-graph
1200×630px
Project / GitHub Card
Developer-focused open graph card with repo name, description, language badge, stars, and forks.
Use Cases
- GitHub repository social previews
- Open-source project announcements
- Developer blog og:image
- Technical documentation cards
Tags
github
developer
open-source
repository
code
open-graph
stars
Template Variables
| Variable | Type | Default | Description |
|---|---|---|---|
| project_name | string | my-awesome-project | Repository or project name |
| description | string | A fast, open-source library for doing cool things | Short project description |
| language | string | Python | Primary programming language |
| language_color | color | #3572A5 | Language dot colour (use GitHub colours) |
| stars | string | 1.2k | Formatted star count |
| forks | string | 234 | Formatted fork count |
| owner | string | octocat | Repository owner or organisation name |
| avatar_url | url | https://picsum.photos/seed/avatar/80/80 | Owner avatar URL |
| bg_color | color | #0d1117 | Card background colour |
API Example
POST to
https://image.toolkitapi.io/v1/image/from-template
with your template URL and variable values.
curl -X POST "https://image.toolkitapi.io/v1/image/from-template" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"template_url": "https://toolkitapi.io/static/templates/image/og-github.html", "variables": {"project_name": "my-awesome-project", "description": "A fast, open-source library for doing cool things", "language": "Python", "language_color": "#3572A5", "stars": "1.2k", "forks": "234", "owner": "octocat", "avatar_url": "https://picsum.photos/seed/avatar/80/80", "bg_color": "#0d1117"}, "width": 1200, "height": 630, "format": "png"}'
import httpx, base64
resp = httpx.post(
"https://image.toolkitapi.io/v1/image/from-template",
headers={"X-API-Key": "YOUR_API_KEY"},
json={
"template_url": "https://toolkitapi.io/static/templates/image/og-github.html",
"variables": {
"project_name": "my-awesome-project",
"description": "A fast, open-source library for doing cool things",
"language": "Python",
"language_color": "#3572A5",
"stars": "1.2k",
"forks": "234",
"owner": "octocat",
"avatar_url": "https://picsum.photos/seed/avatar/80/80",
"bg_color": "#0d1117"
},
"width": 1200,
"height": 630,
"format": "png"
},
)
image_bytes = base64.b64decode(resp.json()["image"])
with open("result.png", "wb") as f:
f.write(image_bytes)
const response = await fetch("https://image.toolkitapi.io/v1/image/from-template", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"template_url": "https://toolkitapi.io/static/templates/image/og-github.html",
"variables": {
"project_name": "my-awesome-project",
"description": "A fast, open-source library for doing cool things",
"language": "Python",
"language_color": "#3572A5",
"stars": "1.2k",
"forks": "234",
"owner": "octocat",
"avatar_url": "https://picsum.photos/seed/avatar/80/80",
"bg_color": "#0d1117"
},
"width": 1200,
"height": 630,
"format": "png"
}),
});
const data = await response.json();
// data.image is a base64-encoded PNG
$body = @{
template_url = "https://toolkitapi.io/static/templates/image/og-github.html"
variables = {
"project_name": "my-awesome-project",
"description": "A fast, open-source library for doing cool things",
"language": "Python",
"language_color": "#3572A5",
"stars": "1.2k",
"forks": "234",
"owner": "octocat",
"avatar_url": "https://picsum.photos/seed/avatar/80/80",
"bg_color": "#0d1117"
}
width = 1200
height = 630
format = "png"
} | ConvertTo-Json -Depth 5
Invoke-RestMethod -Method POST `
-Uri "https://image.toolkitapi.io/v1/image/from-template" `
-Headers @{"X-API-Key" = "YOUR_API_KEY"} `
-ContentType "application/json" `
-Body $body