How to get GitHub repositories
GET request to /v1/github/repositories with your input. You get clean JSON back in seconds for ~4 credits (0.4/result) per call — no OAuth, scraping or platform SDKs. List a user's repos with sort/direction/type — opaque Link cursor (~0.4/repo).How to get GitHub repositories (step by step)
- 1
Get a free API key
Create a free Captapi account (100 credits, no card) and generate an API key from the dashboard.
- 2
Call the GitHub Repositories API
Send an authenticated GET request to /v1/github/repositories with your input. No OAuth, no scraping setup.
- 3
Read the JSON response
Parse the clean JSON response. Pass cache=true for a free 24h cache hit; default is always fresh.
Code example
curl "https://api.captapi.com/v1/github/repositories?username=torvalds" \
-H "Authorization: Bearer capt_live_..."
# or: -H "x-api-key: capt_live_..."What the response looks like
{
"success": true,
"data": {
"username": "torvalds",
"sort": "updated",
"direction": "desc",
"type": "owner",
"totalReturned": 2,
"nextCursor": null,
"hasMore": false,
"repositories": [
{
"platform": "github",
"type": "repository",
"name": "linux",
"fullName": "torvalds/linux",
"url": "https://github.com/torvalds/linux",
"description": "Linux kernel source tree",
"owner": "torvalds",
"ownerUrl": "https://github.com/torvalds",
"ownerType": "User",
"ownerAvatar": "https://avatars.githubusercontent.com/u/1024025?v=4",
"language": "C",
"stars": 252570,
"forks": 68425,
"openIssuesAndPrs": 3,
"defaultBranch": "master",
"isFork": false,
"isArchived": false,
"size": 6403541,
"visibility": "public",
"hasIssues": false,
"hasDiscussions": false,
"pushedAt": "2026-10-18T23:21:18Z",
"createdAt": "2011-09-04T22:48:12Z",
"updatedAt": "2026-10-19T13:48:27Z",
"homepage": null,
"license": null,
"licenseName": "Other"
},
{
"platform": "github",
"type": "repository",
"name": "GuitarPedal",
"fullName": "torvalds/GuitarPedal",
"url": "https://github.com/torvalds/GuitarPedal",
"description": "Linus learns analog circuits",
"owner": "torvalds",
"ownerUrl": "https://github.com/torvalds",
"ownerType": "User",
"ownerAvatar": "https://avatars.githubusercontent.com/u/1024025?v=4",
"language": "C",
"stars": 2462,
"forks": 128,
"openIssuesAndPrs": 15,
"defaultBranch": "main",
"isFork": false,
"isArchived": false,
"size": 19024,
"visibility": "public",
"hasIssues": true,
"hasDiscussions": false,
"pushedAt": "2026-10-15T18:30:33Z",
"createdAt": "2025-09-17T01:01:29Z",
"updatedAt": "2026-10-19T12:40:15Z",
"homepage": null,
"license": "GPL-2.0",
"licenseName": "GNU General Public License v2.0"
}
]
}
}Billing metadata (credits charged, cache hit/miss) is returned in the X-Captapi-Credits and X-Captapi-Cache response headers.
Request parameters
| Name | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | GitHub username or profile URL, e.g. torvalds. |
| sort | string | No | created | updated | pushed | full_name (default updated). Not stars — GitHub's user-repos API has no stars sort. Echoed as data.sort. |
| direction | string | No | asc or desc (default desc). Echoed as data.direction. |
| type | string | No | owner (default) | member | all — affiliation filter. Echoed as data.type. |
| limit | integer | No | Max items to return (default 10, max 100). Billed per result. |
| cursor | string | No | Opaque cursor from a previous nextCursor (GitHub Link page=). Not a bare page number. |
| cache | boolean | No | Set true to serve from the 24h response cache (0 credits on hit). Default false — always fetch fresh. |
Frequently asked questions
What does the GitHub Repositories API do?
The GitHub Repositories API lets you list items in bulk with metadata from a public GitHub GitHub resource using one GET request to /v1/github/repositories. It returns clean JSON — no OAuth or infrastructure setup required.
How many credits does the GitHub Repositories API cost?
At the default limit this endpoint costs 4 credits (0.4 per result). Billing scales with how many results you request. Pass cache=true to serve from the 24h cache (0 credits on hit); default is always fresh. Selected profile endpoints also accept cacheMaxAge=1d|3d|7d|14d|30d. Failed or empty results are never charged.
Do I need a GitHub API key or OAuth?
No. A single Captapi key works across every platform Captapi supports — YouTube, TikTok, Instagram, Facebook, Twitter/X, Reddit, Threads, Bluesky, Pinterest, LinkedIn, Rumble, Spotify, Kwai, and more. We handle access, rate limits, retries, and authentication for you.
Can I sort by stars?
No — GitHub's /users/{u}/repos only supports sort=created|updated|pushed|full_name. Use sort=pushed for recently active repos. For star ranking, call api.github.com search (user:LOGIN sort:stars) or github/repository per repo.
Why is parent missing on forks?
GitHub's list payload omits parent. isFork is still true. Call github/repository on the fork for parent (upstream fullName).
Is the GitHub Repositories API suitable for production use?
Yes. It is a stable REST endpoint with predictable JSON and automatic retries. Pass cache=true to serve from the 24h cache (0 credits on hit); default is always fresh. Selected profile endpoints also accept cacheMaxAge=1d|3d|7d|14d|30d. Use it for analytics, monitoring, and content automation.
Ready to get GitHub repositories?
Start free with 100 credits — no credit card required.
Get your free API key