GitHub GraphQL API adds the archivePullRequest mutation
Introduced 2026-04-15 · score 0.95
HOW TO USE IT
When the pull request should be archived, call `Mutation.archivePullRequest` with its node ID. The mutation closes, locks, and archives the pull request; the GraphQL reference says only repository admins can archive it.
curl -H "Authorization: bearer <TOKEN>" -X POST -d '{"query":"mutation($input: ArchivePullRequestInput!) { archivePullRequest(input: $input) { pullRequest { id } clientMutationId } }","variables":{"input":{"pullRequestId":"<PULL_REQUEST_NODE_ID>"}}}' https://api.github.com/graphqlWHY THIS HELPS
Archive a pull request through the GitHub GraphQL API.
REQUIREMENTS AND LIMITATIONS
- input (required): `ArchivePullRequestInput!` argument for `archivePullRequest`.
- pullRequestId (required): Node ID of the pull request to archive (`ID!`).
- clientMutationId: Optional unique identifier for the client (`String`). The payload can return it.
- pullRequest: Payload field containing the archived pull request (`PullRequest`).
- Prerequisite: Authenticate to the GraphQL API using a personal access token, GitHub App, or OAuth app; required token scopes or permissions depend on the requested data/action. GitHub.com endpoint: `https://api.github.com/graphql`.
- Prerequisite: The GraphQL reference says only repository admins can archive pull requests.
- Docs conflict: GitHub's GraphQL reference says only repository admins can archive pull requests, while its archive guide says anyone with triage, write, maintain, or admin role can archive them: https://docs.github.com/en/enterprise-cloud%40latest/graphql/reference/pulls ; https://docs.github.com/en/communities/moderating-comments-and-conversations/archive-pull-requests
FIRST-PARTY EVIDENCE
- https://docs.github.com/en/graphql/overview/changelog#schema-changes-for-2026-04-15
- https://docs.github.com/en/enterprise-cloud%40latest/graphql/guides/forming-calls-with-graphql
- https://docs.github.com/en/enterprise-cloud%40latest/graphql/reference/pulls
Check the installed version and the source before using it. Entry JSON