GitHub Contribution Card API

Generate a PNG contribution graph for a GitHub user with custom theme, time range (months or weeks), and width. The CGI endpoint is /contrib/generate and responds with an image.

Endpoint

GET /contrib/generate?username=octocat&months=12&theme=light&width=1200&caption_year=1&caption_month=1&caption_day=0&download=0

Week-based range (overrides months):

GET /contrib/generate?username=octocat&weeks=16&theme=light&width=1200&download=0

Query string options

Parameter Type Required Notes
username string Yes GitHub username. Letters, numbers, and hyphens only.
months integer No How many months to include (calendar months ending today). Defaults to 12. Ignored if weeks is set.
weeks integer No How many week columns to show (Sunday-based weeks aligned with GitHub, ending now). If present, takes precedence over months. Clamped to 1..104.
theme string No Theme name. Defaults to light.
width integer No Output width in pixels. Clamped by API to 100..4000.
download 0 or 1 No 0 = inline image, 1 = attachment download.
caption_year 0 or 1 No Draw year labels above the graph when a new year appears.
caption_month 0 or 1 No Draw month labels above the graph when a new month starts.
caption_day 0 or 1 No Draw weekday labels on the left side of the graph.

Available themes: light, dark, classic, earth, pastel, neon, sunset, ocean, forest, amber, dracula, grayscale, github-dark (alias of dark), github-light (alias of light).

API tester

Time range
Open URL

Generated request URL:

Live preview

Generated GitHub contribution card preview