# GitHub Repository (`github.repository`)

Metadata of one public GitHub repository: stars, forks, watchers, language, license, topics and timestamps.

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

- Endpoint: `POST https://api.primaryapi.com/v1/run/github.repository`
- Category: Knowledge & Data · Platform: `github` · Kind: lookup · Status: live
- Price: 1 credit per call; up to 3 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.repository`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `url` | string | yes |  | max 2048 chars | GitHub repository URL, e.g. https://github.com/facebook/react ("owner/repo" is accepted too). |

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

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.

## Example request

```bash
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"}'
```

## 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": {
      "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": 1735,
      "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"
    }
  },
  "provider": "PrimaryAPI",
  "credits": 1,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z"
}
```

## Pricing and reliability

- Usual price: 1 credit per call
- Price ceiling: up to 3 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.repository`

## 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

Private repositories are never returned, and the API never returns email addresses.

