Sample - GitHub REST API
DELETE/orgs/{org}/copilot/billing/selected_users

Remove users from an organization's Copilot subscription

Removes Copilot seat assignments for each specified user by marking their seats for cancellation. Use selected_usernames to identify the organization members who should lose access at the end of the current billing cycle, unless they retain access through team membership. The response reports the number of seats marked as pending cancellation.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter · 1 body field
orgstringrequired
The organization name whose Copilot subscription you want to manage; the name is not case sensitive.

The organization members whose Copilot seats should be marked for cancellation.

selected_usernamesarray<string>required
The usernames of the organization members for which to revoke access to GitHub Copilot.

6 status codes
200Returns an object containing `seats_cancelled`, the total number of seats marked as pending cancellation for the specified users.
seats_cancelledintegerrequired
401Returned when authentication is missing or invalid.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Returned when the authenticated caller is not an organization owner or lacks the required Copilot billing or organization administration scope.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the organization or another specified resource cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when Copilot Business or Enterprise is not enabled, billing or the public code suggestions policy is not configured, the organization's Copilot access setting is invalid or unconfigured, or a user's seat cannot be cancelled because it was assigned through a team.
500Returned when an internal server error occurs.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 401 is returned when authentication is missing or invalid. A 403 is returned when you are not an organization owner or your token lacks the manage_billing:copilot or admin:org scope. A 404 is returned when the organization or specified resource cannot be found. A 422 is returned when Copilot Business or Enterprise, billing, the public code suggestions policy, or a valid Copilot access setting is not configured, or when a user's seat was assigned through a team. A 500 is returned for an internal server error. selected_usernames must contain at least one username, and org must identify the target organization.