How to get GitHub contributions
GET request to /v1/github/contributions with your input. You get clean JSON back in seconds for 2 credits per call — no OAuth, scraping or platform SDKs. GitHub contribution graph — sorted days[], currentStreak (today grace), longestStreak (2 credits).How to get GitHub contributions (step by step)
- 1
Get a free API key
Create a free Captapi account (100 credits, no card) and generate an API key from the dashboard.
- 2
Call the GitHub Contributions API
Send an authenticated GET request to /v1/github/contributions with your input. No OAuth, no scraping setup.
- 3
Read the JSON response
Parse the clean JSON response. Pass cache=true for a free 24h cache hit; default is always fresh.
Code example
curl "https://api.captapi.com/v1/github/contributions?username=getify" \
-H "Authorization: Bearer capt_live_..."
# or: -H "x-api-key: capt_live_..."What the response looks like
{
"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 (credits charged, cache hit/miss) is returned in the X-Captapi-Credits and X-Captapi-Cache response headers.
Request 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. |
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.
Ready to get GitHub contributions?
Start free with 100 credits — no credit card required.
Get your free API key