GitHub Contributions API
GitHub contribution graph — sorted days[], currentStreak (today grace), longestStreak (2 credits).
GET request to /v1/github/contributions that responds with clean JSON and costs 2 credits. Pass cache=true for a free 24h cache hit; default is always fresh. Start with 100 free credits — no credit card.What is the GitHub Contributions API?
Pass a GitHub username or profile URL and get the real last-year contribution calendar from github.com/users/{login}/contributions: totalContributions, from/to (min/max date), currentStreak, longestStreak, and days[{date, count, level}] sorted ascending by date (not GitHub's weekday-major DOM order). currentStreak uses GitHub's today-grace rule: a zero on today does not break the streak; a zero on any earlier day does. source discloses that HTML calendar. This is not /users/{u}/events/public (max 90 events / 90 days) and not a sampled stars sum. Flat 2 credits.
What you get
- Contributions fields as clean structured JSON
- IDs, URLs, and titles where the platform exposes them
- Engagement or popularity signals when available
- Stable IDs for joining with other endpoints
Try it
Fill in the parameters below and copy a ready-to-run request, or open the live Playground to run it against your account (no API key paste).
Parameters
curl "https://api.captapi.com/v1/github/contributions?username=getify" \
-H "Authorization: Bearer capt_live_..."
# or: -H "x-api-key: capt_live_..."Edit the parameters and the code updates instantly. Switch languages and hit copy.
Example response
{
"success": true,
"data": {
"username": "getify",
"source": "github.com/users/getify/contributions",
"url": "https://github.com/getify",
"totalContributions": 164,
"from": "2025-08-03",
"to": "2025-08-05",
"currentStreak": 2,
"days": [
{
"date": "2025-08-03",
"count": 0,
"level": 0
},
{
"date": "2025-08-04",
"count": 5,
"level": 2
}
]
}
}Billing metadata is returned in response headers: X-Captapi-Credits (credits charged), X-Captapi-Cache (hit or miss), and X-Captapi-Source. Failed requests (4xx/5xx) are never charged. See the full list of error codes in the error reference.
Response structure
A successful call returns success, cached, creditsUsed, and a data object with the following fields:
Top-level fields
usernameAccount username / handle.sourcePublic contribution calendar HTML path (github.com/users/{login}/contributions).urlCanonical URL of the item.totalContributionsContributions in the last year — the number on the profile graph heading. Equals sum(days[].count).fromEarliest date in days[] (YYYY-MM-DD). Always min(days[].date).toLatest date in days[] (YYYY-MM-DD). Always max(days[].date) — the calendar window ends on today.currentStreakConsecutive days with count>0 ending at the latest calendar day. Today-grace: if the last day is today and count is 0, that day is skipped (the day is not over); a zero on any earlier day breaks the streak. Computed after sorting days ascending.
Days
Each item in days contains:
dateDate. Example: "2025-08-03".countContributions on that date (from the calendar tool-tip).levelGitHub intensity 0–4 for the heatmap cell.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | GitHub username or profile URL, e.g. getify or https://github.com/getify. |
| cache | boolean | No | Set true to serve from the 24h response cache (0 credits on hit). Default false — always fetch fresh. Envelope includes cached + cachedAt on hits. |
Authentication: send your key as Authorization: Bearer capt_live_.... A typical call costs 2 credits. Pass cache=true for a free 24h cache hit; default is always fresh.
How it works
- 1. Sign up — get 100 free credits, no card required.
- 2. Create a key from your dashboard.
- 3. Send one request to
/v1/github/contributionsand parse the JSON response.
Use cases
Hiring screens
Read totalContributions + currentStreak from the real heatmap — not a 90-event API ceiling.
Cadence charts
Plot days[{date,count,level}] for the last year without scraping the profile HTML yourself.
Quiet periods
Spot gaps in the calendar (count=0 stretches) before outreach.
Frequently asked questions
What does the GitHub Contributions API do?+
The GitHub Contributions API lets you fetch full metadata and key stats from a public GitHub GitHub resource using one GET request to /v1/github/contributions. It returns clean JSON — no OAuth or infrastructure setup required.
How many credits does the GitHub Contributions API cost?+
Each successful call costs 2 credits. Pass cache=true to serve from the 24h cache (0 credits on hit); default is always fresh. Hits include cached + cachedAt. Selected profile endpoints also accept cacheMaxAge=1d|3d|7d|14d|30d. Failed or empty results are never charged.
Do I need a GitHub API key or OAuth?+
No. A single Captapi key works across every platform Captapi supports — YouTube, TikTok, Instagram, Facebook, Twitter/X, Reddit, Threads, Bluesky, Pinterest, LinkedIn, Rumble, Spotify, Kwai, and more. We handle proxies, rate limits, retries, and authentication for you.
Is recentPublicEvents still returned?+
No. That field was a count of /users/{u}/events/public rows (hard-capped at 90) and was not a contribution metric. This endpoint returns the heatmap: totalContributions, currentStreak, longestStreak, and days[] sorted by date.
Where does the calendar come from?+
The public HTML at github.com/users/{login}/contributions (same graph as the profile). source echoes that path.
Does a zero today break currentStreak?+
No — today-grace: if the last day is today and count is 0, it is skipped because the day is not over. A zero on any earlier day breaks the streak. days[] is sorted ascending so days.slice(-30) is the last 30 calendar days.
Is the GitHub Contributions API suitable for production use?+
Yes. It is a stable REST endpoint with predictable JSON and automatic retries. Pass cache=true to serve from the 24h cache (0 credits on hit); default is always fresh. Hits include cached + cachedAt. Selected profile endpoints also accept cacheMaxAge=1d|3d|7d|14d|30d. Use it for analytics, monitoring, and content automation.
More GitHub APIs
Ready to use the GitHub Contributions API?
Sign up, grab your key, and make your first call in 60 seconds.