Pull Requests
Push scopes and other per-pull-request data to Mergify.
Set the scopes for a pull request (deprecated) #
/repos/{owner}/{repository}/pulls/{number}/scopes
Deprecated, and removed in a future release: use
PUT /repos/{owner}/{repository}/commits/{sha}/scopes with the pull request's
head SHA instead. mergify ci scopes-send sends it from CLI 2026.9.10.1 on; on
a CI it cannot read the pull request and its head from, such as Jenkins, pass
--pull-request and --head-sha.
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.
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. A pull request number below 1, which GitHub never assigns, is refused the same way.
Application key permission: ci_reporting: write.
number integer required The pull request number
min: 1 · max: 9223372036854776000
owner string required The owner of the repository
min length: 1 · max length: 40 · pattern: ^[a-zA-Z0-9\-]+$
repository string required The name of the repository
min length: 1 · max length: 100 · pattern: ^[\w\-\.]+$
API_VERSION_UNKNOWN: The Mergify-Version header names an API version this server does not serve. served_versions lists the versions it serves.
Body: APIVersionUnknownBody
SUBSCRIPTION_FEATURE_REQUIRED: The organization's subscription does not include the feature feature names; upgrading the subscription enables it. Here, merge_queue_scopes: Merge Queue Scopes.CI_TOKEN_SCOPES_TARGET_REFUSED: The request is authenticated with the Mergify OIDC CI token of a job, which reports scopes only for the commit the job runs on, or for the pull request it tests. APPLICATION_KEY_REFUSED: The application key lacks the permission the request needs, or the request names an account or repository of another organization. CI_TOKEN_REFUSED: The Mergify OIDC CI token has expired, lacks the permission the request needs, or the request does not name the repository it was issued for.
Body: CredentialRefusedBody
Example Request
curl -X PUT "https://api.mergify.com/v1/repos/:owner/:repository/pulls/:number/scopes" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"scopes": [
"string"
],
"all_scopes": false
}' Set the scopes for a pull request, POST variant (deprecated) #
/repos/{owner}/{repository}/pulls/{number}/scopes
Deprecated, and removed in a future release: use
PUT /repos/{owner}/{repository}/commits/{sha}/scopes with the pull request's
head SHA instead. mergify ci scopes-send sends it from CLI 2026.9.10.1 on; on
a CI it cannot read the pull request and its head from, such as Jenkins, pass
--pull-request and --head-sha.
Application key permission: ci_reporting: write.
number integer required The pull request number
min: 1 · max: 9223372036854776000
owner string required The owner of the repository
min length: 1 · max length: 40 · pattern: ^[a-zA-Z0-9\-]+$
repository string required The name of the repository
min length: 1 · max length: 100 · pattern: ^[\w\-\.]+$
API_VERSION_UNKNOWN: The Mergify-Version header names an API version this server does not serve. served_versions lists the versions it serves.
Body: APIVersionUnknownBody
SUBSCRIPTION_FEATURE_REQUIRED: The organization's subscription does not include the feature feature names; upgrading the subscription enables it. Here, merge_queue_scopes: Merge Queue Scopes.CI_TOKEN_SCOPES_TARGET_REFUSED: The request is authenticated with the Mergify OIDC CI token of a job, which reports scopes only for the commit the job runs on, or for the pull request it tests. APPLICATION_KEY_REFUSED: The application key lacks the permission the request needs, or the request names an account or repository of another organization. CI_TOKEN_REFUSED: The Mergify OIDC CI token has expired, lacks the permission the request needs, or the request does not name the repository it was issued for.
Body: CredentialRefusedBody
Example Request
curl -X POST "https://api.mergify.com/v1/repos/:owner/:repository/pulls/:number/scopes" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"scopes": [
"string"
],
"all_scopes": false
}' Set the scopes for a commit #
/repos/{owner}/{repository}/commits/{sha}/scopes Set the scopes a commit impacts.
This replaces the deprecated pull request variant. Scopes computed for one revision do
not describe another, so naming the revision lets a report be matched against the
head a pull request actually has. A report for a revision a pull request has
already moved past can no longer overwrite what its current head reported; a
report is still applied to every open pull request whose head it currently
is, which is the normal case. In a repository whose configuration sets no
scopes.source, a report neither scopes the merge queue nor fills the scope
attribute; only the scopes-available attribute still turns true once it is
received. With a files source alone a report is ignored; declare
manual: null beside files to add it to the scopes matched from the changed
files, and the merge queue then waits for a report on every pull request's head
commit, except while it checks a pull request in place.
A report replaces the previous one for that revision in full: all_scopes
defaults to false, so omitting it clears a barrier previously reported for the
same commit. Send the complete result of your scope computation every time.
Send the pull request's head SHA (github.). That is
not always the revision your job checked out: on a pull_request event the
default checkout is a merge commit, and a report keyed on that SHA matches no
pull request head.
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.
Application key permission: ci_reporting: write.
sha string required The commit SHA the scopes were computed from
pattern: ^[0-9a-fA-F]{40}$
owner string required The owner of the repository
min length: 1 · max length: 40 · pattern: ^[a-zA-Z0-9\-]+$
repository string required The name of the repository
min length: 1 · max length: 100 · pattern: ^[\w\-\.]+$
API_VERSION_UNKNOWN: The Mergify-Version header names an API version this server does not serve. served_versions lists the versions it serves.
Body: APIVersionUnknownBody
SUBSCRIPTION_FEATURE_REQUIRED: The organization's subscription does not include the feature feature names; upgrading the subscription enables it. Here, merge_queue_scopes: Merge Queue Scopes.CI_TOKEN_SCOPES_TARGET_REFUSED: The request is authenticated with the Mergify OIDC CI token of a job, which reports scopes only for the commit the job runs on, or for the pull request it tests. APPLICATION_KEY_REFUSED: The application key lacks the permission the request needs, or the request names an account or repository of another organization. CI_TOKEN_REFUSED: The Mergify OIDC CI token has expired, lacks the permission the request needs, or the request does not name the repository it was issued for.
Body: CredentialRefusedBody
Example Request
curl -X PUT "https://api.mergify.com/v1/repos/:owner/:repository/commits/:sha/scopes" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"scopes": [
"string"
],
"all_scopes": false
}' Error response bodies #
An endpoint lists each error status it returns and links to the body that comes with it.
APIVersionUnknownBody
ACTIVITY_LOG_METADATA_FILTER_NOT_INDEXED API_VERSION_NOT_NEWER API_VERSION_ROLLBACK_UNAVAILABLE API_VERSION_UNKNOWN APPLICATION_KEY_EXPIRED APPLICATION_KEY_REFUSED AUTO_QUARANTINE_CONFIG_NOT_FOUND CI_ADMIN_ROLE_REQUIRED CI_ID_TOKEN_AUDIENCE_REFUSED CI_ID_TOKEN_EXCHANGE_NOT_FOUND CI_ID_TOKEN_EXPIRED CI_ID_TOKEN_INVALID CI_ID_TOKEN_ISSUER_REFUSED CI_ID_TOKEN_ISSUER_UNAVAILABLE CI_ID_TOKEN_NO_MATCHING_TRUST_POLICY CI_ID_TOKEN_NO_TRUST_POLICY CI_ID_TOKEN_REPOSITORY_NOT_INSTALLED CI_TOKEN_REFUSED CI_TOKEN_SCOPES_TARGET_REFUSED CI_TRACES_UPLOAD_UNUSABLE CI_TRUST_POLICY_GRANT_REFUSED CI_TRUST_POLICY_LIMIT_REACHED CI_TRUST_POLICY_NAME_TAKEN CI_TRUST_POLICY_NOT_FOUND CI_TRUST_POLICY_REPOSITORY_UNKNOWN COMMAND_RESTRICTED CONFIGURATION_BRANCH_REFUSED CONFIGURATION_INVALID CONFIGURATION_REFUSED_BY_REPOSITORY_RULES CONFIGURATION_SIGNED_COMMITS_REQUIRED DEFAULT_BRANCH_NOT_FOUND FLAKY_DETECTION_NOT_CONFIGURED GITHUB_ACCOUNT_SUSPENDED GITHUB_APP_ACCESS_LOST GITHUB_RATE_LIMITED GITHUB_TOKEN_NOT_ACCEPTED GITHUB_TWO_FACTOR_AUTHENTICATION_NONCOMPLIANT GITHUB_UPSTREAM_REQUEST_FORBIDDEN GITHUB_UPSTREAM_REQUEST_REJECTED GITHUB_UPSTREAM_UNAVAILABLE INTEGRATION_NOT_CONFIGURED INVALID_CURSOR IP_ALLOW_LIST_NOT_CONFIGURED KNOWN_TESTS_BEING_COMPUTED KNOWN_TESTS_NOT_SERVED MERGE_QUEUE_DISABLED MERGE_QUEUE_POLICY_INVALID_PATTERN MERGE_QUEUE_POLICY_LIMIT_REACHED MERGE_QUEUE_POLICY_NAME_TAKEN MERGE_QUEUE_POLICY_NOT_FOUND MERGE_QUEUE_SETTING_INVALID_BRANCH_PATTERN MERGE_QUEUE_SETTING_NOT_AVAILABLE MERGE_QUEUE_SETTING_TOO_MANY_BRANCH_PATTERNS NO_LOGIN_IN_PROGRESS ORGANIZATION_MEMBERS_ONLY PULL_REQUEST_ALREADY_QUEUED PULL_REQUEST_LEAVING_QUEUE PULL_REQUEST_NOT_FOUND PULL_REQUEST_NOT_QUEUEABLE PULL_REQUEST_NOT_QUEUED PULL_REQUEST_QUEUE_REQUESTED REPOSITORY_ADMIN_ROLE_REQUIRED REPOSITORY_READ_ROLE_REQUIRED REPOSITORY_WRITE_ROLE_REQUIRED RETRY_RULE_NOT_FOUND ROLE_ALREADY_GRANTED ROLE_CHANGE_REFUSED ROLE_GRANTEE_REFUSED ROLE_GRANT_NOT_FOUND SAML_ENFORCEMENT_NOT_AUTHORIZED SCHEDULED_FREEZE_NOT_FOUND SCOPES_COVERAGE_GLOB_TOO_COSTLY SCOPES_COVERAGE_MANUAL_SOURCE SCOPES_COVERAGE_PATH_NOT_FOUND SCOPES_COVERAGE_UNAVAILABLE SETTING_MANAGED_BY_ENV SETUP_ALREADY_DONE SETUP_TOKEN_MISMATCH STAFF_SESSION_REFUSED STATISTICS_SCOPE_PERIOD_TOO_LARGE SUBSCRIPTION_API_UNAVAILABLE SUBSCRIPTION_FEATURE_REQUIRED SUBSCRIPTION_INACTIVE SUBSCRIPTION_TOKEN_INVALID TEST_ALREADY_QUARANTINED TEST_BRANCH_NOT_TRACKED TEST_FAILURE_NOT_FOUND TEST_NOT_FOUND TEST_RESULTS_INGESTION_NOT_ENABLED TEST_RETRY_NOT_CONFIGURED TEST_STATE_NOT_FOUND TEST_STATE_OVERLAPExample Response
{
"detail": "string",
"error_code": "ACTIVITY_LOG_METADATA_FILTER_NOT_INDEXED",
"documentation_url": "string",
"served_versions": [
"string"
]
}
SubscriptionFeatureRequiredBody
ACTIVITY_LOG_METADATA_FILTER_NOT_INDEXED API_VERSION_NOT_NEWER API_VERSION_ROLLBACK_UNAVAILABLE API_VERSION_UNKNOWN APPLICATION_KEY_EXPIRED APPLICATION_KEY_REFUSED AUTO_QUARANTINE_CONFIG_NOT_FOUND CI_ADMIN_ROLE_REQUIRED CI_ID_TOKEN_AUDIENCE_REFUSED CI_ID_TOKEN_EXCHANGE_NOT_FOUND CI_ID_TOKEN_EXPIRED CI_ID_TOKEN_INVALID CI_ID_TOKEN_ISSUER_REFUSED CI_ID_TOKEN_ISSUER_UNAVAILABLE CI_ID_TOKEN_NO_MATCHING_TRUST_POLICY CI_ID_TOKEN_NO_TRUST_POLICY CI_ID_TOKEN_REPOSITORY_NOT_INSTALLED CI_TOKEN_REFUSED CI_TOKEN_SCOPES_TARGET_REFUSED CI_TRACES_UPLOAD_UNUSABLE CI_TRUST_POLICY_GRANT_REFUSED CI_TRUST_POLICY_LIMIT_REACHED CI_TRUST_POLICY_NAME_TAKEN CI_TRUST_POLICY_NOT_FOUND CI_TRUST_POLICY_REPOSITORY_UNKNOWN COMMAND_RESTRICTED CONFIGURATION_BRANCH_REFUSED CONFIGURATION_INVALID CONFIGURATION_REFUSED_BY_REPOSITORY_RULES CONFIGURATION_SIGNED_COMMITS_REQUIRED DEFAULT_BRANCH_NOT_FOUND FLAKY_DETECTION_NOT_CONFIGURED GITHUB_ACCOUNT_SUSPENDED GITHUB_APP_ACCESS_LOST GITHUB_RATE_LIMITED GITHUB_TOKEN_NOT_ACCEPTED GITHUB_TWO_FACTOR_AUTHENTICATION_NONCOMPLIANT GITHUB_UPSTREAM_REQUEST_FORBIDDEN GITHUB_UPSTREAM_REQUEST_REJECTED GITHUB_UPSTREAM_UNAVAILABLE INTEGRATION_NOT_CONFIGURED INVALID_CURSOR IP_ALLOW_LIST_NOT_CONFIGURED KNOWN_TESTS_BEING_COMPUTED KNOWN_TESTS_NOT_SERVED MERGE_QUEUE_DISABLED MERGE_QUEUE_POLICY_INVALID_PATTERN MERGE_QUEUE_POLICY_LIMIT_REACHED MERGE_QUEUE_POLICY_NAME_TAKEN MERGE_QUEUE_POLICY_NOT_FOUND MERGE_QUEUE_SETTING_INVALID_BRANCH_PATTERN MERGE_QUEUE_SETTING_NOT_AVAILABLE MERGE_QUEUE_SETTING_TOO_MANY_BRANCH_PATTERNS NO_LOGIN_IN_PROGRESS ORGANIZATION_MEMBERS_ONLY PULL_REQUEST_ALREADY_QUEUED PULL_REQUEST_LEAVING_QUEUE PULL_REQUEST_NOT_FOUND PULL_REQUEST_NOT_QUEUEABLE PULL_REQUEST_NOT_QUEUED PULL_REQUEST_QUEUE_REQUESTED REPOSITORY_ADMIN_ROLE_REQUIRED REPOSITORY_READ_ROLE_REQUIRED REPOSITORY_WRITE_ROLE_REQUIRED RETRY_RULE_NOT_FOUND ROLE_ALREADY_GRANTED ROLE_CHANGE_REFUSED ROLE_GRANTEE_REFUSED ROLE_GRANT_NOT_FOUND SAML_ENFORCEMENT_NOT_AUTHORIZED SCHEDULED_FREEZE_NOT_FOUND SCOPES_COVERAGE_GLOB_TOO_COSTLY SCOPES_COVERAGE_MANUAL_SOURCE SCOPES_COVERAGE_PATH_NOT_FOUND SCOPES_COVERAGE_UNAVAILABLE SETTING_MANAGED_BY_ENV SETUP_ALREADY_DONE SETUP_TOKEN_MISMATCH STAFF_SESSION_REFUSED STATISTICS_SCOPE_PERIOD_TOO_LARGE SUBSCRIPTION_API_UNAVAILABLE SUBSCRIPTION_FEATURE_REQUIRED SUBSCRIPTION_INACTIVE SUBSCRIPTION_TOKEN_INVALID TEST_ALREADY_QUARANTINED TEST_BRANCH_NOT_TRACKED TEST_FAILURE_NOT_FOUND TEST_NOT_FOUND TEST_RESULTS_INGESTION_NOT_ENABLED TEST_RETRY_NOT_CONFIGURED TEST_STATE_NOT_FOUND TEST_STATE_OVERLAPci_insights_quarantine delegated_roles integration_datadog integration_slack merge_queue_scopes merge_queue_stats scheduled_freeze test_tracked_branchesExample Response
{
"detail": "string",
"error_code": "ACTIVITY_LOG_METADATA_FILTER_NOT_INDEXED",
"documentation_url": "string",
"feature": "ci_insights_quarantine"
}
CredentialRefusedBody
ACTIVITY_LOG_METADATA_FILTER_NOT_INDEXED API_VERSION_NOT_NEWER API_VERSION_ROLLBACK_UNAVAILABLE API_VERSION_UNKNOWN APPLICATION_KEY_EXPIRED APPLICATION_KEY_REFUSED AUTO_QUARANTINE_CONFIG_NOT_FOUND CI_ADMIN_ROLE_REQUIRED CI_ID_TOKEN_AUDIENCE_REFUSED CI_ID_TOKEN_EXCHANGE_NOT_FOUND CI_ID_TOKEN_EXPIRED CI_ID_TOKEN_INVALID CI_ID_TOKEN_ISSUER_REFUSED CI_ID_TOKEN_ISSUER_UNAVAILABLE CI_ID_TOKEN_NO_MATCHING_TRUST_POLICY CI_ID_TOKEN_NO_TRUST_POLICY CI_ID_TOKEN_REPOSITORY_NOT_INSTALLED CI_TOKEN_REFUSED CI_TOKEN_SCOPES_TARGET_REFUSED CI_TRACES_UPLOAD_UNUSABLE CI_TRUST_POLICY_GRANT_REFUSED CI_TRUST_POLICY_LIMIT_REACHED CI_TRUST_POLICY_NAME_TAKEN CI_TRUST_POLICY_NOT_FOUND CI_TRUST_POLICY_REPOSITORY_UNKNOWN COMMAND_RESTRICTED CONFIGURATION_BRANCH_REFUSED CONFIGURATION_INVALID CONFIGURATION_REFUSED_BY_REPOSITORY_RULES CONFIGURATION_SIGNED_COMMITS_REQUIRED DEFAULT_BRANCH_NOT_FOUND FLAKY_DETECTION_NOT_CONFIGURED GITHUB_ACCOUNT_SUSPENDED GITHUB_APP_ACCESS_LOST GITHUB_RATE_LIMITED GITHUB_TOKEN_NOT_ACCEPTED GITHUB_TWO_FACTOR_AUTHENTICATION_NONCOMPLIANT GITHUB_UPSTREAM_REQUEST_FORBIDDEN GITHUB_UPSTREAM_REQUEST_REJECTED GITHUB_UPSTREAM_UNAVAILABLE INTEGRATION_NOT_CONFIGURED INVALID_CURSOR IP_ALLOW_LIST_NOT_CONFIGURED KNOWN_TESTS_BEING_COMPUTED KNOWN_TESTS_NOT_SERVED MERGE_QUEUE_DISABLED MERGE_QUEUE_POLICY_INVALID_PATTERN MERGE_QUEUE_POLICY_LIMIT_REACHED MERGE_QUEUE_POLICY_NAME_TAKEN MERGE_QUEUE_POLICY_NOT_FOUND MERGE_QUEUE_SETTING_INVALID_BRANCH_PATTERN MERGE_QUEUE_SETTING_NOT_AVAILABLE MERGE_QUEUE_SETTING_TOO_MANY_BRANCH_PATTERNS NO_LOGIN_IN_PROGRESS ORGANIZATION_MEMBERS_ONLY PULL_REQUEST_ALREADY_QUEUED PULL_REQUEST_LEAVING_QUEUE PULL_REQUEST_NOT_FOUND PULL_REQUEST_NOT_QUEUEABLE PULL_REQUEST_NOT_QUEUED PULL_REQUEST_QUEUE_REQUESTED REPOSITORY_ADMIN_ROLE_REQUIRED REPOSITORY_READ_ROLE_REQUIRED REPOSITORY_WRITE_ROLE_REQUIRED RETRY_RULE_NOT_FOUND ROLE_ALREADY_GRANTED ROLE_CHANGE_REFUSED ROLE_GRANTEE_REFUSED ROLE_GRANT_NOT_FOUND SAML_ENFORCEMENT_NOT_AUTHORIZED SCHEDULED_FREEZE_NOT_FOUND SCOPES_COVERAGE_GLOB_TOO_COSTLY SCOPES_COVERAGE_MANUAL_SOURCE SCOPES_COVERAGE_PATH_NOT_FOUND SCOPES_COVERAGE_UNAVAILABLE SETTING_MANAGED_BY_ENV SETUP_ALREADY_DONE SETUP_TOKEN_MISMATCH STAFF_SESSION_REFUSED STATISTICS_SCOPE_PERIOD_TOO_LARGE SUBSCRIPTION_API_UNAVAILABLE SUBSCRIPTION_FEATURE_REQUIRED SUBSCRIPTION_INACTIVE SUBSCRIPTION_TOKEN_INVALID TEST_ALREADY_QUARANTINED TEST_BRANCH_NOT_TRACKED TEST_FAILURE_NOT_FOUND TEST_NOT_FOUND TEST_RESULTS_INGESTION_NOT_ENABLED TEST_RETRY_NOT_CONFIGURED TEST_STATE_NOT_FOUND TEST_STATE_OVERLAPExample Response
{
"detail": "string",
"error_code": "ACTIVITY_LOG_METADATA_FILTER_NOT_INDEXED",
"documentation_url": "string",
"accepted_permissions": [
{
"resource": "merge_queue",
"access": "read"
}
]
}
Was this page helpful?
Thanks for your feedback!