---
title: "Set the scopes for a pull request"
method: PUT
path: "/repos/{owner}/{repository}/pulls/{number}/scopes"
tags: ["pull_requests"]
---

# Set the scopes for a pull request

`PUT /repos/{owner}/{repository}/pulls/{number}/scopes`

Set the scopes for a pull request.

This addresses the scopes by pull request number alone, so the report cannot say
which revision it was computed for, and the last one to arrive wins whatever
head that was. Prefer `PUT /repos/{owner}/{repository}/commits/{sha}/scopes`,
which names the revision.

A scope name may hold anything except a NUL byte or an unpaired UTF-16
surrogate, neither of which Postgres can store, and is limited to 1024
characters; a report carries at most 10000 of them. A report that breaks any of
these is refused in full with a 422 and nothing is stored, so the pull request
keeps whatever was reported for it last.

## Path parameters

- `number` integer, required — The pull request number
- `owner` string, required — The owner of the repository
- `repository` string, required — The name of the repository

## Request body

- ScopesBody
  - `scopes` string[], required
  - `all_scopes` boolean

## Response `204`

Successful Response

## Other responses

- `403` — Forbidden
- `404` — Not found
- `409` — Conflict
- `422` — Unprocessable entity

## Changes

- **2026-09-14** `cb8f6b3b5d17` — 1 warning
  - the `scopes/items/` request property's maxLength was set to `1024`
- **2026-08-13** `29857c6146cf` — 3 info
  - the endpoint scheme security `CIApplicationKey` was added to the API
  - the endpoint scheme security `ApplicationAuth` was removed from the API
  - the endpoint scheme security `GitHubTokenBearerAuth` was removed from the API

[Change history](https://skmtc.dev/mergify/apis/mergify-api/changes/repos/:owner/:repository/pulls/:number/scopes/put.md)

---

[API](https://skmtc.dev/mergify/apis/mergify-api.md) · [All operations](https://skmtc.dev/mergify/apis/mergify-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mergify/apis/mergify-api/revisions/dbaad859d897?raw)
