MarkdownCopies this page as Markdown, ready to paste into an AI assistant.
GitHub API
6 GitHub endpoints behind one key, priced in credits per call and routed to the cheapest healthy source.
On this page
Knowledge & Data · 6 endpoints · from 1 credit per call
Endpoints
- POSTGitHub Repository
/v1/run/github.repositoryMetadata of one public GitHub repository: stars, forks, watchers, language, license, topics and timestamps.1 creditper call - POSTGitHub Trending Repositories
/v1/run/github.trending_repositoriesRepositories on GitHub Trending for a language and window, with rank, stars, stars gained and description.1 creditper call - POSTGitHub User
/v1/run/github.userPublic profile of a GitHub user or organization: name, bio, company, location, followers and repository counts.1 creditper call - POSTGitHub User Repositories
/v1/run/github.user_repositoriesA GitHub user's or organization's public repositories with stars, forks, language and dates, sortable and paged.1 creditper call - POSTGitHub Trending DevelopersPlanned
/v1/run/github.trending_developersTrending GitHub developers for a language and time range, with each developer’s most popular repository.Planned - POSTGitHub User ActivityPlanned
/v1/run/github.user_activityMonthly summary of a GitHub user’s public contributions (commits, pull requests and issues) for a given year.Planned
Calling them
Every endpoint on this page is one POST to https://api.primaryapi.com/v1/run/{sku} with your API key and a JSON body. Responses share one envelope, so code written for one endpoint handles the others. For example, github.repository:
curl -sS -X POST "https://api.primaryapi.com/v1/run/github.repository" \
-H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://github.com/octocat/Hello-World"}'const res = await fetch('https://api.primaryapi.com/v1/run/github.repository', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PRIMARYAPI_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://github.com/octocat/Hello-World',
}),
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.code}: ${body.error}`);
// found:false is a successful answer ("does not exist"), not an error
console.log(body.output.found ? body.output.data : body.output.reason, body.credits);import os
import requests
res = requests.post(
"https://api.primaryapi.com/v1/run/github.repository",
headers={"Authorization": f"Bearer {os.environ['PRIMARYAPI_API_KEY']}"},
json={
"url": "https://github.com/octocat/Hello-World",
},
timeout=60,
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['code']}: {body['error']}")
# found=False is a successful answer ("does not exist"), not an error
print(body["output"]["data"] if body["output"]["found"] else body["output"]["reason"], body["credits"])New to PrimaryAPI? Start with the Quickstart, then read Making requests.