REST API endpoints for stacked pull requests
Use the REST API to interact with stacked pull requests.
List pull request stacks
Lists pull request stacks in a repository.
"List pull request stacks" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Pull requests" repository permissions (read)
このエンドポイントは、パブリック リソースのみが要求される場合は、認証または前述メンションアクセス許可なしで使用できます。
"List pull request stacks" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
| 名前, タイプ, 説明 |
|---|
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." デフォルト: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." デフォルト: |
"List pull request stacks" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | OK |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
"List pull request stacks" のコード サンプル
GHE.com でGitHubにアクセスする場合は、api.github.com を、api.SUBDOMAIN.ghe.com にある企業の専用サブドメインに置き換えます。
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/stacksResponse
Status: 200[
{
"id": 9876543,
"number": 42,
"node_id": "S_kwDOABCDEF4AAAAA",
"url": "https://api.github.com/repos/octocat/hello-world/stacks/42",
"base": {
"ref": "main"
},
"pull_requests": [
{
"number": 101,
"state": "open",
"draft": false,
"merged_at": null,
"head": {
"ref": "user-model",
"sha": "aaa1111aaa1111aaa1111aaa1111aaa1111aaa11"
}
},
{
"number": 102,
"state": "open",
"draft": false,
"merged_at": null,
"head": {
"ref": "user-api",
"sha": "bbb2222bbb2222bbb2222bbb2222bbb2222bbb22"
}
}
],
"open": true,
"created_at": "2026-04-15T10:00:00Z"
}
]Create a pull request stack
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.
"Create a pull request stack" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Pull requests" repository permissions (write)
"Create a pull request stack" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
| 名前, タイプ, 説明 |
|---|
pull_requests array of integers 必須An ordered list of pull request numbers forming the stack from bottom to top. |
"Create a pull request stack" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
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. |
"Create a pull request stack" のコード サンプル
GHE.com でGitHubにアクセスする場合は、api.github.com を、api.SUBDOMAIN.ghe.com にある企業の専用サブドメインに置き換えます。
要求の例
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/stacks \
-d '{"pull_requests":[101,102,103]}'Response
Status: 201{
"id": 9876543,
"number": 42,
"node_id": "S_kwDOABCDEF4AAAAA",
"url": "https://api.github.com/repos/octocat/hello-world/stacks/42",
"base": {
"ref": "main"
},
"open": true,
"created_at": "2026-04-15T10:00:00Z",
"pull_requests": [
{
"id": 100001,
"node_id": "PR_kwDOABCDEF4AAAAA",
"title": "Add user model",
"state": "open",
"merged_at": null,
"draft": false,
"html_url": "https://github.com/octocat/hello-world/pull/101",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false,
"user_view_type": "public"
},
"number": 101,
"url": "https://api.github.com/repos/octocat/hello-world/pulls/101",
"head": {
"ref": "user-model",
"sha": "aaa1111aaa1111aaa1111aaa1111aaa1111aaa11",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
},
"base": {
"ref": "main",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
}
},
{
"id": 100002,
"node_id": "PR_kwDOABCDEF4AAAAB",
"title": "Add user API",
"state": "open",
"merged_at": null,
"draft": true,
"html_url": "https://github.com/octocat/hello-world/pull/102",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false,
"user_view_type": "public"
},
"number": 102,
"url": "https://api.github.com/repos/octocat/hello-world/pulls/102",
"head": {
"ref": "user-api",
"sha": "bbb2222bbb2222bbb2222bbb2222bbb2222bbb22",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
},
"base": {
"ref": "user-model",
"sha": "aaa1111aaa1111aaa1111aaa1111aaa1111aaa11",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
}
}
]
}Get a pull request stack
Gets a pull request stack by providing its stack number.
"Get a pull request stack" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Pull requests" repository permissions (read)
このエンドポイントは、パブリック リソースのみが要求される場合は、認証または前述メンションアクセス許可なしで使用できます。
"Get a pull request stack" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
stack_number integer 必須The number that identifies the pull request stack. |
"Get a pull request stack" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | OK |
404 | Resource not found |
"Get a pull request stack" のコード サンプル
GHE.com でGitHubにアクセスする場合は、api.github.com を、api.SUBDOMAIN.ghe.com にある企業の専用サブドメインに置き換えます。
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/stacks/STACK_NUMBERResponse
Status: 200{
"id": 9876543,
"number": 42,
"node_id": "S_kwDOABCDEF4AAAAA",
"url": "https://api.github.com/repos/octocat/hello-world/stacks/42",
"base": {
"ref": "main"
},
"open": true,
"created_at": "2026-04-15T10:00:00Z",
"pull_requests": [
{
"id": 100001,
"node_id": "PR_kwDOABCDEF4AAAAA",
"title": "Add user model",
"state": "open",
"merged_at": null,
"draft": false,
"html_url": "https://github.com/octocat/hello-world/pull/101",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false,
"user_view_type": "public"
},
"number": 101,
"url": "https://api.github.com/repos/octocat/hello-world/pulls/101",
"head": {
"ref": "user-model",
"sha": "aaa1111aaa1111aaa1111aaa1111aaa1111aaa11",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
},
"base": {
"ref": "main",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
}
},
{
"id": 100002,
"node_id": "PR_kwDOABCDEF4AAAAB",
"title": "Add user API",
"state": "open",
"merged_at": null,
"draft": true,
"html_url": "https://github.com/octocat/hello-world/pull/102",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false,
"user_view_type": "public"
},
"number": 102,
"url": "https://api.github.com/repos/octocat/hello-world/pulls/102",
"head": {
"ref": "user-api",
"sha": "bbb2222bbb2222bbb2222bbb2222bbb2222bbb22",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
},
"base": {
"ref": "user-model",
"sha": "aaa1111aaa1111aaa1111aaa1111aaa1111aaa11",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
}
}
]
}Add pull requests to a pull request stack
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.
"Add pull requests to a pull request stack" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Pull requests" repository permissions (write)
"Add pull requests to a pull request stack" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
stack_number integer 必須The number that identifies the pull request stack. |
| 名前, タイプ, 説明 |
|---|
pull_requests array of integers 必須An ordered list of pull request numbers to append to the stack, from the current top upward. |
"Add pull requests to a pull request stack" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
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. |
"Add pull requests to a pull request stack" のコード サンプル
GHE.com でGitHubにアクセスする場合は、api.github.com を、api.SUBDOMAIN.ghe.com にある企業の専用サブドメインに置き換えます。
要求の例
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/stacks/STACK_NUMBER/add \
-d '{"pull_requests":[104,102]}'Response
Status: 200{
"id": 9876543,
"number": 42,
"node_id": "S_kwDOABCDEF4AAAAA",
"url": "https://api.github.com/repos/octocat/hello-world/stacks/42",
"base": {
"ref": "main"
},
"open": true,
"created_at": "2026-04-15T10:00:00Z",
"pull_requests": [
{
"id": 100001,
"node_id": "PR_kwDOABCDEF4AAAAA",
"title": "Add user model",
"state": "open",
"merged_at": null,
"draft": false,
"html_url": "https://github.com/octocat/hello-world/pull/101",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false,
"user_view_type": "public"
},
"number": 101,
"url": "https://api.github.com/repos/octocat/hello-world/pulls/101",
"head": {
"ref": "user-model",
"sha": "aaa1111aaa1111aaa1111aaa1111aaa1111aaa11",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
},
"base": {
"ref": "main",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
}
},
{
"id": 100002,
"node_id": "PR_kwDOABCDEF4AAAAB",
"title": "Add user API",
"state": "open",
"merged_at": null,
"draft": true,
"html_url": "https://github.com/octocat/hello-world/pull/102",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false,
"user_view_type": "public"
},
"number": 102,
"url": "https://api.github.com/repos/octocat/hello-world/pulls/102",
"head": {
"ref": "user-api",
"sha": "bbb2222bbb2222bbb2222bbb2222bbb2222bbb22",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
},
"base": {
"ref": "user-model",
"sha": "aaa1111aaa1111aaa1111aaa1111aaa1111aaa11",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
}
}
]
}Remove pull requests from a pull request stack
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.
"Remove pull requests from a pull request stack" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Pull requests" repository permissions (write)
"Remove pull requests from a pull request stack" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
stack_number integer 必須The number that identifies the pull request stack. |
"Remove pull requests from a pull request stack" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
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. |
"Remove pull requests from a pull request stack" のコード サンプル
GHE.com でGitHubにアクセスする場合は、api.github.com を、api.SUBDOMAIN.ghe.com にある企業の専用サブドメインに置き換えます。
要求の例
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/stacks/STACK_NUMBER/unstackResponse
Status: 200{
"id": 9876543,
"number": 42,
"node_id": "S_kwDOABCDEF4AAAAA",
"url": "https://api.github.com/repos/octocat/hello-world/stacks/42",
"base": {
"ref": "main"
},
"open": true,
"created_at": "2026-04-15T10:00:00Z",
"pull_requests": [
{
"id": 100001,
"node_id": "PR_kwDOABCDEF4AAAAA",
"title": "Add user model",
"state": "open",
"merged_at": null,
"draft": false,
"html_url": "https://github.com/octocat/hello-world/pull/101",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false,
"user_view_type": "public"
},
"number": 101,
"url": "https://api.github.com/repos/octocat/hello-world/pulls/101",
"head": {
"ref": "user-model",
"sha": "aaa1111aaa1111aaa1111aaa1111aaa1111aaa11",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
},
"base": {
"ref": "main",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"repo": {
"id": 1296269,
"url": "https://api.github.com/repos/octocat/hello-world",
"name": "hello-world"
}
}
}
]
}