GitHub · Guide

How to get GitHub repositories

TL;DR
To get GitHub repositories, sign up for a free Captapi key, then send one GET request to /v1/github/repositories with your input. You get clean JSON back in seconds for ~12 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. 1

    Get a free API key

    Create a free Captapi account (100 credits, no card) and generate an API key from the dashboard.

  2. 2

    Call the GitHub Repositories API

    Send an authenticated GET request to /v1/github/repositories with your input. No OAuth, no scraping setup.

  3. 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": "pushed",
    "direction": "desc",
    "type": "owner",
    "totalReturned": 2,
    "nextCursor": "eyJ2IjoxLCJrIjoicmVwb3MiLCJwIjoyfQ",
    "hasMore": true,
    "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": 239734,
        "forks": 63487,
        "openIssuesAndPrs": 3,
        "defaultBranch": "master",
        "licenseName": "Other",
        "isFork": false,
        "isArchived": false,
        "pushedAt": "2026-07-18T04:53:39Z",
        "createdAt": "2011-09-04T22:48:12Z",
        "updatedAt": "2026-07-18T18:40:38Z"
      },
      {
        "platform": "github",
        "type": "repository",
        "name": "libgit2",
        "fullName": "torvalds/libgit2",
        "url": "https://github.com/torvalds/libgit2",
        "description": "A cross-platform, linkable library implementation of Git.",
        "owner": "torvalds",
        "ownerUrl": "https://github.com/torvalds",
        "ownerType": "User",
        "ownerAvatar": "https://avatars.githubusercontent.com/u/1024025?v=4",
        "language": "C",
        "stars": 370,
        "forks": 28,
        "openIssuesAndPrs": 1,
        "defaultBranch": "main",
        "homepage": "https://libgit2.org/",
        "licenseName": "Other",
        "isFork": true,
        "isArchived": false,
        "pushedAt": "2023-12-19T11:45:42Z",
        "createdAt": "2022-07-30T03:30:56Z",
        "updatedAt": "2026-07-18T17:03:41Z"
      }
    ]
  }
}

Billing metadata (credits charged, cache hit/miss) is returned in the X-Captapi-Credits and X-Captapi-Cache response headers.

Request parameters

NameTypeRequiredDescription
usernamestring YesGitHub username or profile URL, e.g. torvalds.
sortstringNocreated | updated | pushed | full_name (default updated). Not stars — GitHub's user-repos API has no stars sort. Echoed as data.sort.
directionstringNoasc or desc (default desc). Echoed as data.direction.
typestringNoowner (default) | member | all — affiliation filter. Echoed as data.type.
limitintegerNoMax items to return (default 30, max 100). Billed per result.
cursorstringNoOpaque cursor from a previous nextCursor (GitHub Link page=). Not a bare page number.
cachebooleanNoSet true to serve from the 24h response cache (0 credits on hit). Default false — always fetch fresh. Envelope includes cached + cachedAt on hits.

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 12 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. Hits include cached + cachedAt. 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 proxies, 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. Hits include cached + cachedAt. 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