How to get GitHub pull requests
GET request to /v1/github/pull-requests 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 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": 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 (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 30, 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. Envelope includes cached + cachedAt on hits. |
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.
Ready to get GitHub pull requests?
Start free with 100 credits — no credit card required.
Get your free API key