Use the REST API to interact with stacked pull requests.
Note
Most endpoints use Authorization: Bearer <YOUR-TOKEN> and Accept: application/vnd.github+json headers, plus X-GitHub-Api-Version: 2026-03-10. Curl examples below omit these standard headers for brevity.
GET /repos/{owner}/{repo}/stacks
Lists pull request stacks in a repository.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
pull_request (integer)
Filter to the stack containing this repository pull request number.
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
page (integer)
The page number of the results to fetch. For more information, see "Using pagination in the REST API."
Default: 1
200 - OK
404 - Resource not found
422 - Validation failed, or the endpoint has been spammed.
Request:
curl -L \
-X GET \
https://api.github.com/repos/OWNER/REPO/stacks
Response schema (Status: 200):
Array of Pull Request Stack Minimal:
id: required, integernumber: required, integernode_id: required, stringurl: required, string, format: uribase: required, object:
ref: required, stringopen: required, booleancreated_at: required, string, format: date-timepull_requests: required, array of objects:
number: required, integerstate: required, string, enum: open, closeddraft: required, booleanmerged_at: required, string or null, format: date-timehead: required, object:
ref: required, stringsha: required, stringPOST /repos/{owner}/{repo}/stacks
Creates a stack from an ordered list of pull request numbers. Provide the pull
request numbers from the bottom of the stack to the top. Each pull request's
base ref must match the previous pull request's head ref.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
pull_requests (array of integers) (required)201 - Created
404 - Resource not found
422 - Validation failed. Returned when the request references pull requests that
don't exist in the repository, or when the pull requests can't form a
valid stack.
Request:
curl -L \
-X POST \
https://api.github.com/repos/OWNER/REPO/stacks \
-d '{
"pull_requests": [
101,
102,
103
]
}'
Response schema (Status: 201):
id: required, integernumber: required, integernode_id: required, stringurl: required, string, format: uribase: required, object:
ref: required, stringopen: required, booleancreated_at: required, string, format: date-timepull_requests: required, array of Pull Request Stack Pull Request:
id: required, integer, format: int64number: required, integerurl: required, stringhead: required, object:
ref: required, stringsha: required, stringrepo: required, object:
id: required, integer, format: int64url: required, stringname: required, stringbase: required, object:
ref: required, stringsha: required, stringrepo: required, object:
id: required, integer, format: int64url: required, stringname: required, stringnode_id: required, stringtitle: required, stringstate: required, string, enum: open, closedmerged_at: required, string or null, format: date-timedraft: required, booleanhtml_url: required, string, format: uriuser: required, any of:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringGET /repos/{owner}/{repo}/stacks/{stack_number}
Gets a pull request stack by providing its stack number.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
stack_number (integer) (required)
The number that identifies the pull request stack.
200 - OK
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/repos/OWNER/REPO/stacks/STACK_NUMBER
Response schema (Status: 200):
Same response schema as Create a pull request stack.
POST /repos/{owner}/{repo}/stacks/{stack_number}/add
Appends an ordered list of pull request numbers onto the top of an existing
stack. Provide only the pull requests you want to add, from the current top of
the stack upward. The first new pull request's base ref must match the current
top pull request's head ref.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
stack_number (integer) (required)
The number that identifies the pull request stack.
pull_requests (array of integers) (required)200 - OK
404 - Resource not found
409 - Conflict. Returned when the stack is being modified by another request.
422 - Validation failed. Returned when the request references pull requests that
don't exist in the repository, or when the pull requests can't be appended
to the stack.
Request:
curl -L \
-X POST \
https://api.github.com/repos/OWNER/REPO/stacks/STACK_NUMBER/add \
-d '{
"pull_requests": [
104,
102
]
}'
Response schema (Status: 200):
Same response schema as Create a pull request stack.
POST /repos/{owner}/{repo}/stacks/{stack_number}/unstack
Removes the unmerged pull requests from a stack. Pull requests that cannot be
unstacked (for example, those that are queued for merge) are left in place. When pull requests remain in the stack, the updated
stack is returned with a 200. When no pull requests remain, the stack is
dissolved and a 204 is returned.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
stack_number (integer) (required)
The number that identifies the pull request stack.
200 - OK
204 - A header with no content is returned.
404 - Resource not found
409 - Conflict. Returned when the stack is being modified by another request.
422 - Validation failed. Returned when the stack can't be unstacked because every
pull request in it is locked and cannot be removed.
Request:
curl -L \
-X POST \
https://api.github.com/repos/OWNER/REPO/stacks/STACK_NUMBER/unstack
Response schema (Status: 200):
Same response schema as Create a pull request stack.