---
title: "GitHub Contributions API"
method: GET
path: "/v1/github/contributions"
tags: ["GitHub"]
---

# GitHub Contributions API

`GET /v1/github/contributions`

## Request

- Base URL: `https://api.captapi.com`
- URL: `https://api.captapi.com/v1/github/contributions`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

GitHub contribution graph — sorted days[], currentStreak (today grace), longestStreak (2 credits).

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.

Docs: https://captapi.com/apis/github-contributions

## Query parameters

- `username` string, required
- `cache` boolean

## Response `200`

Success. The data object for this endpoint.

- object
  - `success` unknown, required
  - `data` object, required
    - `username` string: Account username / handle.
    - `url` string: Canonical URL of the item.
    - `totalContributions` integer: Contributions in the last year — the number on the profile graph heading. Equals sum(days[].count).
    - `from` string: Earliest date in days[] (YYYY-MM-DD). Always min(days[].date).
    - `to` string: Latest date in days[] (YYYY-MM-DD). Always max(days[].date) — the calendar window ends on today.
    - `currentStreak` integer: Consecutive 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` object[]
      - `date` string: Date. Example: "2025-08-03".
      - `count` integer: Contributions on that date (from the calendar tool-tip).
      - `level` integer: GitHub intensity 0–4 for the heatmap cell.
    - `source` unknown

## Other responses

- `400`: Bad request: wrong platform URL, unknown endpoint, or an invalid parameter value. Not billed.
- `401`: Missing, invalid or revoked API key. Not billed.
- `402`: Not enough credits for this request. Not billed.
- `404`: The resource does not exist or is not public. Not billed.
- `422`: A required parameter is missing or has the wrong type. Not billed.
- `429`: Rate limit reached. Wait for Retry-After seconds. Not billed.
- `502`: The platform could not be reached or returned nothing usable. Retryable, not billed. 503 and 504 use the same envelope.

---

[API](https://skmtc.dev/captapi/apis/captapi-api.md) · [All operations](https://skmtc.dev/captapi/apis/captapi-api/llms.txt) · [OpenAPI document](https://skmtc.dev/captapi/apis/captapi-api/revisions/c9b9ac5ff1bd?raw)
