GitHub contributions API
The contribution calendar a profile shows: one count per day and the year total.
GET /v1/github/users/{handle}/contributions1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/github/users/torvalds/contributions",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "login": "torvalds", "year": null, "total": 4043, "from": "2025-11-23", "to": "2026-11-25", "days": [ { "date": "2025-11-23", "level": 1, "count": 7 }, { "date": "2025-11-24", "level": 1, "count": 3 }, "… 366 more" ]}Parameters
| Name | Type | Description |
|---|---|---|
handlepath · required | string | GitHub username, with or without the @, or a profile URL. Example: torvalds. |
yearquery | integer | Calendar year (default: the last 12 months). |
Response fields
200 with a GitHubContributionsResponse, in GitHub’s own REST v3 objects.
| Field | Type | Description |
|---|---|---|
login | string | |
year | integer | null | The calendar year, or null for the last 12 months. |
total | integer | Contributions in the period, as the profile states it. |
from | string | null | |
to | string | null | |
days | GitHubContributionDay[] |
Status codes
| Status | Meaning |
|---|---|
200 | The calendar. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | No public GitHub user, repository or issue by that name. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | GitHub is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
GitHub is a trademark of GitHub, Inc. We are not affiliated with or endorsed by GitHub.