How to get GitHub pull requests
GET request to /v1/github/pull-requests 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 repo PRs — draft, labels, author{}, head/base, opaque Link cursor (state echoed).How to get GitHub pull requests (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 Pull Requests API
Send an authenticated GET request to /v1/github/pull-requests 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/pull-requests?repo=vercel%2Fnext.js" \
-H "Authorization: Bearer capt_live_..."
# or: -H "x-api-key: capt_live_..."What the response looks like
{
"success": true,
"data": {
"repository": "vercel/next.js",
"state": "closed",
"totalReturned": 2,
"nextCursor": "eyJ2IjoxLCJrIjoicHVsbHMiLCJwIjoyfQ",
"hasMore": true,
"pullRequests": [
{
"id": 4983043045,
"number": 100650,
"title": "[cd] Document that Turbopack team can also approve releases",
"state": "closed",
"draft": false,
"url": "https://github.com/vercel/next.js/pull/100650",
"author": {
"id": 12292047,
"login": "eps1lon",
"type": "User",
"url": "https://github.com/eps1lon",
"avatar": "https://avatars.githubusercontent.com/u/12292047?v=4"
},
"head": {
"ref": "sebbie/docs-turbopack-approvals",
"sha": "f38e9ecdb457c4b735bcaddd3688099ece71e063",
"label": "vercel:sebbie/docs-turbopack-approvals"
},
"base": {
"ref": "canary",
"sha": "c0f54e5d093e7146c92be710f6804acad91d42c7",
"label": "vercel:canary"
},
"createdAt": "2026-10-23T12:54:20Z",
"updatedAt": "2026-10-23T13:12:35Z",
"closedAt": "2026-10-23T13:12:33Z",
"mergedAt": "2026-10-23T13:12:33Z",
"labels": [
{
"name": "created-by: Next.js team",
"color": "000000",
"description": "PRs by the Next.js team."
}
],
"assignees": [],
"requestedReviewers": []
},
{
"id": 4981396599,
"number": 100641,
"title": "Fix `pnpm new-test` unit type generating no test file",
"state": "closed",
"draft": false,
"url": "https://github.com/vercel/next.js/pull/100641",
"author": {
"id": 1365881,
"login": "sokra",
"type": "User",
"url": "https://github.com/sokra",
"avatar": "https://avatars.githubusercontent.com/u/1365881?v=4"
},
"head": {
"ref": "fleet/new-test-unit-template",
"sha": "f0490ef7f4c40c90d4dbce952b59c9ea4f0c4bac",
"label": "vercel:fleet/new-test-unit-template"
},
"base": {
"ref": "canary",
"sha": "3b658c96e3c318ce2708fc9ec31fbfc280e7acbd",
"label": "vercel:canary"
},
"createdAt": "2026-10-23T10:31:15Z",
"updatedAt": "2026-10-23T11:42:30Z",
"closedAt": "2026-10-23T11:42:27Z",
"mergedAt": "2026-10-23T11:42:27Z",
"labels": [
{
"name": "created-by: Turbopack team",
"color": "000000",
"description": "PRs by the Turbopack team."
},
{
"name": "tests",
"color": "ededed",
"description": null
}
],
"assignees": [],
"requestedReviewers": []
}
]
}
}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 |
|---|---|---|---|
| repo | string | Yes | Repository URL or owner/name, e.g. vercel/next.js. |
| state | string | No | open (API default), closed, or all. Echoed as data.state. Docs example uses closed so mergedAt is visible. |
| 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 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 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.
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. Selected profile endpoints also accept cacheMaxAge=1d|3d|7d|14d|30d. Use it for analytics, monitoring, and content automation.
Ready to get GitHub pull requests?
Start free with 100 credits — no credit card required.
Get your free API key