Back to APIs
GitHub
The GitHub REST API lets you interact with repositories, users, organizations, code, pull requests, issues, and GitHub Actions.
Base URL
https://api.github.comreposPRsissuesactionscode search
Endpoints
GET
/repos/{owner}/{repo}Get metadata for a GitHub repository.
const response = await fetch("https://api.github.com/repos/vercel/next.js", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Accept": "application/vnd.github+json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
});
const data = await response.json();
console.log(data);Response Preview
{
"id": 123456,
"name": "next.js",
"full_name": "vercel/next.js",
"description": "The React Framework for the Web",
"stargazers_count": 120000,
"forks_count": 25400,
"open_issues_count": 2100
}GET
/search/repositoriesSearch for repositories by keyword.
const response = await fetch("https://api.github.com/search/repositories?q=react&sort=stars", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Accept": "application/vnd.github+json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
});
const data = await response.json();
console.log(data);Response Preview
{
"total_count": 412000,
"items": [
{ "full_name": "facebook/react", "stargazers_count": 219000 }
]
}