GitHub
GET /v1/github/pull-requests

GitHub Pull Requests API

List repo PRs — draft, labels, author{}, head/base, opaque Link cursor (state echoed).

~12 credits (0.4/result) per request
TL;DR
List repo PRs — draft, labels, author{}, head/base, opaque Link cursor (state echoed). The GitHub Pull Requests API (GitHub) is a single authenticated GET request to /v1/github/pull-requests that responds with clean JSON and costs ~12 credits (0.4/result). Pass cache=true for a free 24h cache hit; default is always fresh. Start with 100 free credits — no credit card.

What is the GitHub Pull Requests API?

List pull requests for a repository via GitHub REST /pulls. Default state=open (pass closed|all — the applied filter is echoed as data.state). Each row: number, title, state, draft, labels[], author{id,login,avatar,url}, head/base refs, assignees, requestedReviewers, closedAt/mergedAt. Opaque nextCursor from GitHub's Link header (not a bare page number). Billing scales with results (~0.4/PR, min ~12 at default limit).

What you get

  • Bulk list of pull requests with metadata
  • Dates, URLs, and engagement fields when available
  • Configurable result limit
  • Ideal for monitoring and content pipelines

Try it

Open in Playground

Fill in the parameters below and copy a ready-to-run request, or open the live Playground to run it against your account (no API key paste).

Parameters

Sign in to run live
curl "https://api.captapi.com/v1/github/pull-requests?repo=vercel%2Fnext.js" \
  -H "Authorization: Bearer capt_live_..."
# or: -H "x-api-key: capt_live_..."

Edit the parameters and the code updates instantly. Switch languages and hit copy.

Example response

{
  "success": true,
  "data": {
    "repository": "vercel/next.js",
    "state": "closed",
    "totalReturned": 2,
    "nextCursor": "eyJ2IjoxLCJrIjoicHVsbHMiLCJwIjoyfQ",
    "hasMore": true,
    "pullRequests": [
      {
        "id": 11,
        "number": 100,
        "title": "docs: clarify cursor",
        "state": "closed",
        "draft": false,
        "url": "https://github.com/vercel/next.js/pull/100",
        "author": {
          "id": 1,
          "login": "example",
          "url": "https://github.com/example",
          "avatar": "https://avatars.githubusercontent.com/u/1?v=4"
        },
        "labels": [
          {
            "name": "documentation",
            "color": "0075ca"
          }
        ],
        "head": {
          "ref": "docs-cursor",
          "sha": "aaa111",
          "label": "example:docs-cursor"
        },
        "base": {
          "ref": "canary",
          "sha": "bbb222",
          "label": "vercel:canary"
        },
        "createdAt": "2026-06-01T00:00:00Z",
        "updatedAt": "2026-06-02T00:00:00Z",
        "closedAt": "2026-06-02T12:00:00Z",
        "mergedAt": "2026-06-02T12:00:00Z"
      },
      {
        "id": 12,
        "number": 101,
        "title": "WIP: experimental",
        "state": "closed",
        "draft": true,
        "url": "https://github.com/vercel/next.js/pull/101",
        "author": {
          "id": 2,
          "login": "dev",
          "url": "https://github.com/dev",
          "avatar": "https://avatars.githubusercontent.com/u/2?v=4"
        },
        "head": {
          "ref": "wip",
          "sha": "ccc",
          "label": "dev:wip"
        },
        "base": {
          "ref": "canary",
          "sha": "ddd",
          "label": "vercel:canary"
        },
        "createdAt": "2026-05-01T00:00:00Z",
        "updatedAt": "2026-05-03T00:00:00Z",
        "closedAt": "2026-05-03T00:00:00Z"
      }
    ]
  }
}

Billing metadata is returned in response headers: X-Captapi-Credits (credits charged), X-Captapi-Cache (hit or miss), and X-Captapi-Source. Failed requests (4xx/5xx) are never charged. See the full list of error codes in the error reference.

Response structure

A successful call returns success, cached, creditsUsed, and a data object with the following fields:

Top-level fields

  • repositoryRepository. Example: "vercel/next.js".
  • stateTop-level: filter echoed from the request (open|closed|all). On each PR: GitHub's PR state.
  • totalReturnedNumber of items returned in this response.
  • nextCursorOpaque Link-header cursor (not a bare page number).
  • hasMoreWhether more results are available beyond this page. When true, pass nextCursor to fetch the next page.

Pull requests

Each item in pullRequests contains:

  • idStable platform ID for the item.
  • numberNumber. Example: 100.
  • titleTitle of the item.
  • stateTop-level: filter echoed from the request (open|closed|all). On each PR: GitHub's PR state.
  • drafttrue when the PR is a draft — exclude from review-throughput metrics.
  • urlCanonical URL of the item.
  • authorPR author card {id, login, avatar, url} — not a bare login string.
  • labelsLabel objects [{name, color, description}] from the PR.
  • headSource branch {ref, sha, label}.
  • baseTarget branch {ref, sha, label}.
  • createdAtCreation date (ISO 8601).
  • updatedAtLast update date (ISO 8601).
  • closedAtWhen the PR was closed (ISO). Distinct from mergedAt.
  • mergedAtWhen the PR was merged (ISO). Null/omitted if not merged.

Parameters

NameTypeRequiredDescription
repostringYesRepository URL or owner/name, e.g. vercel/next.js.
statestringNoopen (API default), closed, or all. Echoed as data.state. Docs example uses closed so mergedAt is visible.
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.

Authentication: send your key as Authorization: Bearer capt_live_.... A typical call costs ~12 credits (0.4/result) — billed per result, so the exact amount scales with how many items you request. Pass cache=true for a free 24h cache hit; default is always fresh (metrics refresh within ~1 hour).

Using an AI agent? This endpoint is the MCP tool github_pull_requests via @captapi/mcp. Set it up →

How it works

  1. 1. Sign up — get 100 free credits, no card required.
  2. 2. Create a key from your dashboard.
  3. 3. Send one request to /v1/github/pull-requests and parse the JSON response.

Use cases

Review throughput

Count non-draft PRs (draft=false) opened or merged in a window without HTML scraping.

Label triage

Filter labels[] for bug/feature queues before assigning reviewers.

Branch mapping

Read head.ref → base.ref to see which branches land where.

Frequently asked questions

What does the GitHub Pull Requests API do?+

The GitHub Pull Requests API lets you list items in bulk with metadata from a public GitHub GitHub resource using one GET request to /v1/github/pull-requests. It returns clean JSON — no OAuth or infrastructure setup required.

How many credits does the GitHub Pull Requests 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.

Why does the docs example use state=closed if the default is open?+

API default is open. The docs cURL passes state=closed so mergedAt/closedAt show in the example response — data.state always echoes whichever filter ran.

Why include draft?+

Draft PRs are not ready for review. Counting them as shipped PRs skews throughput metrics — filter draft=false.

Is the GitHub Pull Requests 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.

More GitHub APIs

Ready to use the GitHub Pull Requests API?

Sign up, grab your key, and make your first call in 60 seconds.