# GitHub User Repositories (`github.user_repositories`)

A GitHub user's or organization's public repositories with stars, forks, language and dates, sortable and paged.

Docs: https://primaryapi.com/docs/api-reference/github/user_repositories

- Endpoint: `POST https://api.primaryapi.com/v1/run/github.user_repositories`
- Category: Knowledge & Data · Platform: `github` · Kind: list · Status: live
- Price: 1 credit per call; up to 35 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost.
- Billing unit: per successful call
- Reliability: routed to a healthy upstream and retried automatically when an attempt fails; live 30-day status: `GET https://api.primaryapi.com/v1/status/apis?sku=github.user_repositories`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `handle` | string | yes |  | max 200 chars | GitHub username (login), with or without @; a github.com profile URL also works. |
| `type` | enum | no | "owner" | one of: owner, all, member | Which repositories to include: owner (default), all, or member (collaborator / organization member). |
| `sort` | enum | no | "updated" | one of: created, updated, pushed, full_name | Repository ordering (default updated). |
| `direction` | enum | no |  | one of: asc, desc | Sort direction paired with sort. Default: asc for full_name, desc otherwise. |
| `limit` | integer | no | 30 | 1–100 | Rows per page, 1-100 (GitHub's own page-size limit, default 30). Keep it constant while paging. |
| `cursor` | string | no |  | max 500 chars | Opaque pagination cursor: pass the previous response's nextCursor. Takes precedence over page. |

Unknown fields are rejected with `400 invalid_input`. The routing controls `preferLatencyUnderMs` and `maxCredits` may be sent in the same JSON body.

## Output

When `output.found` is `true`, `output.data` has this shape:

| Field | Type | Description |
|---|---|---|
| `repos` | object[] |  |
| `repos[].id` | string \| null | GitHub numeric repository id (as a string) |
| `repos[].name` | string |  |
| `repos[].fullName` | string | owner/name |
| `repos[].description` | string \| null |  |
| `repos[].owner` | string | Owner login |
| `repos[].avatarUrl` | string \| null | Owner's avatar |
| `repos[].profileUrl` | string \| null | Repository page on github.com |
| `repos[].url` | string | Canonical repository URL |
| `repos[].homepage` | string \| null |  |
| `repos[].language` | string \| null | Primary language |
| `repos[].license` | string \| null | SPDX license id ("NOASSERTION" = other license) |
| `repos[].topics` | string[] |  |
| `repos[].stars` | integer \| null |  |
| `repos[].forks` | integer \| null |  |
| `repos[].watchers` | integer \| null |  |
| `repos[].openIssues` | integer \| null | Open issues plus open pull requests (GitHub semantics) |
| `repos[].size` | integer \| null | Repository size in KB |
| `repos[].defaultBranch` | string \| null |  |
| `repos[].private` | boolean |  |
| `repos[].fork` | boolean \| null |  |
| `repos[].archived` | boolean \| null |  |
| `repos[].createdUtc` | integer \| null | Creation time, UTC epoch seconds |
| `repos[].updatedAt` | string \| null | Last update (ISO-8601); also moves when the repo is starred |
| `repos[].pushedAt` | string \| null | Last push (ISO-8601) |
| `hasMore` | boolean |  |
| `nextCursor` | string \| null |  |

When the thing you asked about does not exist (or a search matches nothing) the call still succeeds: `output.found` is `false`, `output.data` is `null` and `output.reason` says why (`not_found`, `private`, `no_results`, …). Misses are free unless the notes below say misses are billed.

Pagination: pass the previous response’s `nextCursor` as `cursor` to get the next page; `nextCursor: null` means there are no more results.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/github.user_repositories" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"handle":"octocat","limit":30}'
```

## Example response

_Values are placeholders that follow the output schema; `credits` is what this call would cost at the usual price._

```json
{
  "output": {
    "found": true,
    "data": {
      "repos": [
        {
          "id": "1296269",
          "name": "Hello-World",
          "fullName": "octocat/Hello-World",
          "description": "My first repository on GitHub!",
          "owner": "octocat",
          "avatarUrl": "https://avatars.githubusercontent.com/u/583231?v=4",
          "profileUrl": "https://github.com/octocat/Hello-World",
          "url": "https://github.com/octocat/Hello-World",
          "homepage": null,
          "language": null,
          "license": null,
          "topics": [],
          "stars": 3876,
          "forks": 7297,
          "watchers": null,
          "openIssues": 7508,
          "size": 1,
          "defaultBranch": "master",
          "private": false,
          "fork": false,
          "archived": false,
          "createdUtc": 1296068472,
          "updatedAt": "2026-10-31T00:41:52.000Z",
          "pushedAt": "2024-08-20T23:54:42.000Z"
        }
      ],
      "hasMore": true,
      "nextCursor": "2"
    }
  },
  "provider": "PrimaryAPI",
  "credits": 1,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z",
  "nextCursor": null
}
```

## Pricing and reliability

- Usual price: 1 credit per call
- Price ceiling: up to 35 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost; the `maxCredits` routing control caps it per call
- Live 30-day status, success rate, uptime and latency: `GET https://api.primaryapi.com/v1/status/apis?sku=github.user_repositories`

## Errors to handle

`invalid_input`, `unauthorized`, `insufficient_balance`, `key_limit_reached`, `trial_cap_reached`, `forbidden`, `not_found`, `idempotency_conflict`, `rate_limited`, `all_sources_failed`, `service_unavailable`, `timeout`. See https://primaryapi.com/docs/errors.

## Notes

REST list responses carry no watcher count (watchers = null).

