Skip to main content

user_seats

Creates, updates, deletes, gets or lists a user_seats resource.

Overview

Nameuser_seats
TypeResource
Idgithub.copilot.user_seats

Fields

The following fields are returned by SELECT queries:

The user's GitHub Copilot seat details, including usage.

NameDatatypeDescription
assigneeobjectA GitHub user. (title: Simple User)
assigning_teamobjectThe team through which the assignee is granted access to GitHub Copilot, if applicable. (title: Team)
created_atstring (date-time)Timestamp of when the assignee was last granted access to GitHub Copilot, in ISO 8601 format.
last_activity_atstring (date-time)Timestamp of user's last GitHub Copilot activity, in ISO 8601 format.
last_activity_editorstringLast editor that was used by the user for a GitHub Copilot completion.
last_authenticated_atstring (date-time)Timestamp of the last time the user authenticated with GitHub Copilot, in ISO 8601 format.
organizationobjectA GitHub organization. (title: Organization Simple)
pending_cancellation_datestring (date)The pending cancellation date for the seat, in YYYY-MM-DD format. This will be null unless the assignee's Copilot access has been canceled during the current billing cycle. If the seat has been cancelled, this corresponds to the start of the organization's next billing cycle.
plan_typestringThe Copilot plan of the organization, or the parent enterprise, when applicable. (business, enterprise, unknown)
updated_atstring (date-time)Closing down notice: This field is no longer relevant and is closing down. Use the created_at field to determine when the assignee was last granted access to GitHub Copilot. Timestamp of when the assignee's GitHub Copilot access was last updated, in ISO 8601 format.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_copilot_seat_assignment_details_for_userselectorg, username> [!NOTE]
> This endpoint is in public preview and is subject to change.

Gets the GitHub Copilot seat details for a member of an organization who currently has access to GitHub Copilot.

The seat object contains information about the user's most recent Copilot activity. Users must have telemetry enabled in their IDE for Copilot in the IDE activity to be reflected in last_activity_at.
For more information about activity data, see Metrics data properties for GitHub Copilot.

Only organization owners can view Copilot seat assignment details for members of their organization.

OAuth app tokens and personal access tokens (classic) need either the manage_billing:copilot or read:org scopes to use this endpoint.
add_copilot_for_business_seats_for_usersinsertorg, selected_usernames> [!NOTE]
> This endpoint is in public preview and is subject to change.

Purchases a GitHub Copilot seat for each user specified.
The organization will be billed for each seat based on the organization's Copilot plan. For more information about Copilot pricing, see "About billing for GitHub Copilot in your organization."

Only organization owners can purchase Copilot seats for their organization members. The organization must have a Copilot Business or Copilot Enterprise subscription and a configured suggestion matching policy.
For more information about setting up a Copilot subscription, see "Subscribing to Copilot for your organization."
For more information about setting a suggestion matching policy, see "Managing policies for Copilot in your organization."

The response contains the total number of new seats that were created and existing seats that were refreshed.

OAuth app tokens and personal access tokens (classic) need either the manage_billing:copilot or admin:org scopes to use this endpoint.
cancel_copilot_seat_assignment_for_usersexecorg, selected_usernames> [!NOTE]
> This endpoint is in public preview and is subject to change.

Sets seats for all users specified to "pending cancellation".
This will cause the specified users to lose access to GitHub Copilot at the end of the current billing cycle unless they retain access through team membership.
For more information about disabling access to Copilot, see "Revoking access to Copilot for members of your organization."

Only organization owners can cancel Copilot seats for their organization members.

The response contains the total number of seats set to "pending cancellation".

OAuth app tokens and personal access tokens (classic) need either the manage_billing:copilot or admin:org scopes to use this endpoint.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
orgstringThe organization name. The name is not case sensitive.
usernamestringThe handle for the GitHub user account.

SELECT examples

> [!NOTE]
> This endpoint is in public preview and is subject to change.

Gets the GitHub Copilot seat details for a member of an organization who currently has access to GitHub Copilot.

The seat object contains information about the user's most recent Copilot activity. Users must have telemetry enabled in their IDE for Copilot in the IDE activity to be reflected in last_activity_at.
For more information about activity data, see Metrics data properties for GitHub Copilot.

Only organization owners can view Copilot seat assignment details for members of their organization.

OAuth app tokens and personal access tokens (classic) need either the manage_billing:copilot or read:org scopes to use this endpoint.

SELECT
assignee,
assigning_team,
created_at,
last_activity_at,
last_activity_editor,
last_authenticated_at,
organization,
pending_cancellation_date,
plan_type,
updated_at
FROM github.copilot.user_seats
WHERE org = '{{ org }}' -- required
AND username = '{{ username }}' -- required
;

INSERT examples

> [!NOTE]
> This endpoint is in public preview and is subject to change.

Purchases a GitHub Copilot seat for each user specified.
The organization will be billed for each seat based on the organization's Copilot plan. For more information about Copilot pricing, see "About billing for GitHub Copilot in your organization."

Only organization owners can purchase Copilot seats for their organization members. The organization must have a Copilot Business or Copilot Enterprise subscription and a configured suggestion matching policy.
For more information about setting up a Copilot subscription, see "Subscribing to Copilot for your organization."
For more information about setting a suggestion matching policy, see "Managing policies for Copilot in your organization."

The response contains the total number of new seats that were created and existing seats that were refreshed.

OAuth app tokens and personal access tokens (classic) need either the manage_billing:copilot or admin:org scopes to use this endpoint.

INSERT INTO github.copilot.user_seats (
selected_usernames,
org
)
SELECT
'{{ selected_usernames }}' /* required */,
'{{ org }}'
RETURNING
seats_created
;

Lifecycle Methods

> [!NOTE]
> This endpoint is in public preview and is subject to change.

Sets seats for all users specified to "pending cancellation".
This will cause the specified users to lose access to GitHub Copilot at the end of the current billing cycle unless they retain access through team membership.
For more information about disabling access to Copilot, see "Revoking access to Copilot for members of your organization."

Only organization owners can cancel Copilot seats for their organization members.

The response contains the total number of seats set to "pending cancellation".

OAuth app tokens and personal access tokens (classic) need either the manage_billing:copilot or admin:org scopes to use this endpoint.

EXEC github.copilot.user_seats.cancel_copilot_seat_assignment_for_users 
@org='{{ org }}' --required
@@json=
'{
"selected_usernames": "{{ selected_usernames }}"
}'
;