GitHub API

Development API · Works globally · 60 req/hr unauthenticated · 5000 req/hr with token

TL;DR

The GitHub REST API is the most widely used developer API on the planet, providing programmatic access to nearly every GitHub feature — repositories, users, commits, issues, pull requests, releases, actions, and more. Without authentication you get 60 requests per hour (identified by IP), which is enough for basic exploration. With a free personal access token, the limit jumps to 5,000 requests per hour. The API uses standard REST patterns with JSON responses and supports conditional requests with ETags to conserve rate limit.

Quick start: https://api.github.com/repos/opencode-ai/opencode

No API key needed — just make a request!

How to Use This API

1. Get Repository Info

https://api.github.com/repos/opencode-ai/opencode

2. List User Repos

https://api.github.com/users/opencode-ai/repos?sort=stars&per_page=5

3. Search Code

https://api.github.com/search/code?q=import+react+language:javascript&per_page=3

4. JavaScript — Get Repo Stats

fetch('https://api.github.com/repos/opencode-ai/opencode')
  .then(r => r.json())
  .then(repo => {
    console.log(repo.full_name);
    console.log('Stars:', repo.stargazers_count);
    console.log('Forks:', repo.forks_count);
    console.log('Language:', repo.language);
    console.log('Description:', repo.description);
  });

5. Python — Trending Repos

import requests

resp = requests.get('https://api.github.com/search/repositories', params={
    'q': 'stars:>10000',
    'sort': 'stars',
    'order': 'desc',
    'per_page': 10
})
for repo in resp.json()['items']:
    print(f"{repo['full_name']} — ⭐ {repo['stargazers_count']:,}")
Try it: https://api.github.com/repos/opencode-ai/opencode

API Details

API URL
https://api.github.com
Documentation
docs.github.com/en/rest
Category
Development
Authentication
Not Required (higher rate limit with token)
Geographic Coverage
Global

Frequently Asked Questions

What is the rate limit without an API key?
60 requests per hour, identified by your IP address. The response includes X-RateLimit-Remaining and X-RateLimit-Reset headers.
How do I get a higher rate limit?
Create a free GitHub personal access token (Settings > Developer settings > Personal access tokens) and pass it as an Authorization: Bearer TOKEN header for 5,000 requests/hour.
Can I search code on GitHub?
Yes, the search API supports code, repositories, issues, users, commits, and topics. Code search is restricted to public repositories.
What about GraphQL?
GitHub also offers a GraphQL API at https://api.github.com/graphql which requires authentication. It allows more flexible queries with fewer round-trips.
Do conditional requests help with rate limits?
Yes, send If-None-Match with the ETag from a previous response. If data hasn't changed, you get a 304 (Not Modified) that doesn't count against your rate limit.
Can I access private repository data?
Only with appropriate authentication (personal access token or OAuth) granted access to those specific repositories.

What You Can Build