deno-github-contributions-api

March 8, 2026 ยท View on GitHub

JSR JSR Score ci deno deploy LICENSE

Fetch and render GitHub contributions data as JSON, SVG, terminal text, or plain text.

gif

Usage

As an API

In your terminal:

$ curl https://github-contributions-api.deno.dev
# Then follow the messages...

Of course, you can access the endpoint from the web browser: https://github-contributions-api.deno.dev

As a library

import { getContributions } from "jsr:@kawarimidoll/github-contributions-api";

const contributions = await getContributions("username", "ghp_token");

console.log(contributions.toTerm({ scheme: "random" }));
// Also available: toJson(), toText(), toSvg()

You can also specify a date range with from / to options.

A personal access token with the read:user scope is required. Generate one here: https://github.com/settings/tokens/new

Local Development

  1. Copy .envrc.example to .envrc and set your GitHub personal access token:
cp .envrc.example .envrc
# Edit .envrc and set your token
  1. Load environment variables with direnv:
direnv allow
  1. Start the development server:
deno task dev

Extra

If you are using GitHub CLI, you can call this API from gh-graph.

Acknowledgements tweet

if (this.repo.isAwesome || this.repo.isHelpful) {
  star(this.repo);
}