Skip to main content
Skip to content

REST API endpoints for Copilot code review

Use the REST API to manage Copilot code review.

Request a Copilot code review for a pull request

Requests a Copilot code review for a pull request. Every call expresses intent to start a new review: if no Copilot review has been requested yet, an initial request is created; if the most recent Copilot review has already completed (including if it was later dismissed or superseded), a new request is created automatically to continue the review lifecycle. If a Copilot code review request is already pending for the pull request, no new request is created and the response is 409.

If the actor or repository is not eligible for Copilot code review, the actor has no quota remaining, or the licensing organization is unavailable, no request is created and the response is 422 with a stable failure_reason. A review_effort is accepted only when that effort level is available for the repository and actor; an unrecognized or unavailable review_effort returns 422 with failure_reason INVALID_REVIEW_EFFORT. If the actor, repository owner, or requesting application owner has been flagged, the response is 403 with failure_reason ACTOR_FLAGGED. If the per-actor or per-owner request rate limit is exceeded, the response is 429 with failure_reason RATE_LIMITED. If Copilot code review cannot be serviced right now, the response is 503.

Existing human and team review requests on the pull request are left unchanged.

"Request a Copilot code review for a pull request" のきめ細かいアクセス トークン

このエンドポイントは、次の粒度の細かいトークンの種類で動作します:

粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:

  • "Pull requests" repository permissions (write)

"Request a Copilot code review for a pull request" のパラメーター

ヘッダー
名前, タイプ, 説明
accept string

Setting to application/vnd.github+json is recommended.

パスパラメーター
名前, タイプ, 説明
owner string 必須

The account owner of the repository. The name is not case sensitive.

repo string 必須

The name of the repository without the .git extension. The name is not case sensitive.

pull_number integer 必須

The number that identifies the pull request.

ボディパラメータ
名前, タイプ, 説明
review_effort string

The effort level to use for the Copilot code review. Omit to use the default effort level. Only effort levels available for the repository and actor are accepted. For more information, see Review effort level.

"Request a Copilot code review for a pull request" の HTTP 応答状態コード

状態コード説明
201

Created

401

Requires authentication

403

Forbidden. failure_reason is ACTOR_FLAGGED when the actor, repository owner, or requesting application owner has been flagged; it is absent for other authorization failures.

404

Resource not found

409

Conflict, a Copilot code review request is already pending for this pull request

422

Validation failed. failure_reason is present for a stable business denial (the actor or repository is not eligible, the actor has no quota remaining, or the licensing organization is unavailable) and absent when the request body fails generic request validation. failure_reason is INVALID_REVIEW_EFFORT when the requested review_effort is unrecognized or not available for the repository and actor, and message lists the available effort levels.

429

Too many requests. The per-actor or per-owner Copilot code review request rate limit has been exceeded. failure_reason is RATE_LIMITED.

503

Service unavailable, Copilot code review cannot be serviced right now

"Request a Copilot code review for a pull request" のコード サンプル

GHE.com でGitHubにアクセスする場合は、api.github.com を、api.SUBDOMAIN.ghe.com にある企業の専用サブドメインに置き換えます。

要求の例

post/repos/{owner}/{repo}/pulls/{pull_number}/copilot-code-review
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/pulls/PULL_NUMBER/copilot-code-review \ -d '{"review_effort":"balanced"}'

A Copilot code review request was created

Status: 201
{ "node_id": "RRR_kwDOAA", "state": "PENDING" }