Skip to main content
REST API теперь версия. Дополнительные сведения см. в разделе "О управлении версиями API".

Лицензирование

Используйте REST API для получения лицензионной информации.

List enterprise consumed licenses

Lists the license consumption information for all users, including those from connected servers, associated with an enterprise.

The authenticated user must be an enterprise admin to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the read:enterprise scope to use this endpoint.

Детализированные токены доступа для «List enterprise consumed licenses»

Эта конечная точка работает со следующими точными типами маркеров:

Маркер с точной детализацией должен иметь следующий набор разрешений.:

  • "Enterprise administration" enterprise permissions (read)

Параметры для «List enterprise consumed licenses»

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
enterprise string Обязательное поле

The slug version of the enterprise name.

Параметры запроса
Имя., Тип, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

HTTP-коды статуса ответа для «List enterprise consumed licenses»

Код состоянияDescription
200

Consumed Licenses Response

Примеры кода для «List enterprise consumed licenses»

Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.

Пример запроса

get/enterprises/{enterprise}/consumed-licenses
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/enterprises/ENTERPRISE/consumed-licenses

Consumed Licenses Response

Status: 200
{ "total_seats_consumed": 5000, "total_seats_purchased": 4500, "users": [ { "github_com_login": "monalisa", "github_com_name": "Mona Lisa", "enterprise_server_user_ids": [ "example_host_name.com:123", "example_host_name_2:222" ], "github_com_user": true, "enterprise_server_user": true, "visual_studio_subscription_user": false, "license_type": "enterprise", "github_com_profile": "https://github.com/monalisa", "github_com_member_roles": [ "org1:Owner", "org2:Owner" ], "github_com_enterprise_roles": [ "owner" ], "github_com_verified_domain_emails": [ "[email protected]" ], "github_com_saml_name_id": "monalisa", "github_com_orgs_with_pending_invites": [ "org1", "org2" ], "github_com_two_factor_auth": true, "enterprise_server_emails": [ "[email protected]" ], "visual_studio_license_status": "", "visual_studio_subscription_email": "", "total_user_accounts": 3 }, { "github_com_login": "", "github_com_name": "", "enterprise_server_user_ids": [ "example_host_name:123" ], "github_com_user": false, "enterprise_server_user": true, "visual_studio_subscription_user": false, "license_type": "enterprise", "github_com_profile": "", "github_com_member_roles": [], "github_com_enterprise_role": "", "github_com_enterprise_roles": [], "github_com_verified_domain_emails": [], "github_com_saml_name_id": "", "github_com_orgs_with_pending_invites": [], "github_com_two_factor_auth": "", "enterprise_server_emails": [ "[email protected]" ], "visual_studio_license_status": "", "visual_studio_subscription_email": "", "total_user_accounts": 1 } ] }

Get a license sync status

Gets information about the status of a license sync job for an enterprise.

The authenticated user must be an enterprise admin to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the read:enterprise scope to use this endpoint.

Детализированные токены доступа для «Get a license sync status»

Эта конечная точка работает со следующими точными типами маркеров:

Маркер с точной детализацией должен иметь следующий набор разрешений.:

  • "Enterprise administration" enterprise permissions (read)

Параметры для «Get a license sync status»

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
enterprise string Обязательное поле

The slug version of the enterprise name.

HTTP-коды статуса ответа для «Get a license sync status»

Код состоянияDescription
200

License Sync Status Response

Примеры кода для «Get a license sync status»

Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.

Пример запроса

get/enterprises/{enterprise}/license-sync-status
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/enterprises/ENTERPRISE/license-sync-status

License Sync Status Response

Status: 200
{ "server_instances": [ { "server_id": "deadbeef1", "hostname": "github.example.com", "last_sync": { "date": "2020-01-01T00:00:00Z", "status": "success", "error": "" } }, { "server_id": "filetoffish1", "hostname": "github2.example.com", "last_sync": { "date": "2020-01-01T00:00:00Z", "status": "success", "error": "" } } ] }

Get GitHub Advanced Security active committers for an enterprise

Gets the GitHub Advanced Security active committers for an enterprise per repository. The authenticated user must be an enterprise admin or billing manager.

Each distinct user login across all repositories is counted as a single Advanced Security seat, so the total_advanced_security_committers is not the sum of active_users for each repository.

The total number of repositories with committer information is tracked by the total_count field.

Детализированные токены доступа для «Get GitHub Advanced Security active committers for an enterprise»

Эта конечная точка работает со следующими точными типами маркеров:

Маркер с точной детализацией должен иметь следующий набор разрешений.:

  • "Enterprise administration" enterprise permissions (write)

Параметры для «Get GitHub Advanced Security active committers for an enterprise»

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
enterprise string Обязательное поле

The slug version of the enterprise name.

Параметры запроса
Имя., Тип, Description
advanced_security_product string

The security product to get GitHub Advanced Security active committers for.

For standalone Code Scanning or Secret Protection products, this parameter is required to specify which product you want committer information for. For other plans this parameter cannot be used.

Возможные значения: code_security, secret_protection

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

HTTP-коды статуса ответа для «Get GitHub Advanced Security active committers for an enterprise»

Код состоянияDescription
200

Success

Примеры кода для «Get GitHub Advanced Security active committers for an enterprise»

Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.

Пример запроса

get/enterprises/{enterprise}/settings/billing/advanced-security
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/enterprises/ENTERPRISE/settings/billing/advanced-security

Success

Status: 200
{ "total_advanced_security_committers": 2, "total_count": 2, "maximum_advanced_security_committers": 4, "purchased_advanced_security_committers": 4, "repositories": [ { "name": "octocat-org/Hello-World", "advanced_security_committers": 2, "advanced_security_committers_breakdown": [ { "user_login": "octocat", "last_pushed_date": "2021-11-03", "last_pushed_email": "[email protected]" }, { "user_login": "octokitten", "last_pushed_date": "2021-10-25", "last_pushed_email": "[email protected]" } ] }, { "name": "octocat-org/server", "advanced_security_committers": 1, "advanced_security_committers_breakdown": [ { "user_login": "octokitten", "last_pushed_date": "2021-10-26", "last_pushed_email": "[email protected]" } ] } ] }

Get a list of Visual Studio subscriptions for the enterprise

Retrieves a list of Visual Studio subscriptions for the specified enterprise.

Детализированные токены доступа для «Get a list of Visual Studio subscriptions for the enterprise»

Эта конечная точка работает со следующими точными типами маркеров:

Маркер с точной детализацией должен иметь следующий набор разрешений.:

  • "Enterprise Licensing" enterprise permissions (read)

Параметры для «Get a list of Visual Studio subscriptions for the enterprise»

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
enterprise string Обязательное поле

The slug version of the enterprise name

Параметры запроса
Имя., Тип, Description
is_unmatched_only boolean

When true, only returns Visual Studio subscriptions that are not matched to a GitHub user.

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

По умолчанию.: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

По умолчанию.: 1

HTTP-коды статуса ответа для «Get a list of Visual Studio subscriptions for the enterprise»

Код состоянияDescription
200

OK

404

Resource not found

Примеры кода для «Get a list of Visual Studio subscriptions for the enterprise»

Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.

Пример запроса

get/enterprises/{enterprise}/visual-studio-subscriptions
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/enterprises/ENTERPRISE/visual-studio-subscriptions

Response

Status: 200
{ "total_count": 1, "visual_studio_subscription_assignments": [ { "email": "[email protected]", "subscriptionId": "00000000-0000-0000-0000-000000000000", "username": "gh-user", "manual_match": true } ] }

Add or update a Visual Studio subscription user match

Updates a manual match between a user and a Visual Studio subscription.

Детализированные токены доступа для «Add or update a Visual Studio subscription user match»

Эта конечная точка работает со следующими точными типами маркеров:

Маркер с точной детализацией должен иметь следующий набор разрешений.:

  • "Enterprise Licensing" enterprise permissions (write)

Параметры для «Add or update a Visual Studio subscription user match»

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
visual_studio_subscription_id string Обязательное поле

The ID of the Visual Studio subscription to add or update the match for. This is a GUID that comes from the Visual Studio management portal.

enterprise string Обязательное поле

The slug version of the enterprise name

Параметры запроса
Имя., Тип, Description
user_identifier string

The handle for the GitHub user account or a verified email associated with their account.

HTTP-коды статуса ответа для «Add or update a Visual Studio subscription user match»

Код состоянияDescription
200

OK

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Примеры кода для «Add or update a Visual Studio subscription user match»

Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.

Пример запроса

put/enterprises/{enterprise}/visual-studio-subscriptions/{visual_studio_subscription_id}
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/enterprises/ENTERPRISE/visual-studio-subscriptions/VISUAL_STUDIO_SUBSCRIPTION_ID \ -d '{"user_identifier":"monalisa"}'

Response

Status: 200
{ "visual_studio_subscription_email": "[email protected]", "subscription_id": "00000000-0000-0000-0000-000000000000", "username": "gh-user", "manual_match": true }

Delete a Visual Studio subscription user match

Deletes a manual match between a user and a Visual Studio subscription.

Детализированные токены доступа для «Delete a Visual Studio subscription user match»

Эта конечная точка работает со следующими точными типами маркеров:

Маркер с точной детализацией должен иметь следующий набор разрешений.:

  • "Enterprise Licensing" enterprise permissions (write)

Параметры для «Delete a Visual Studio subscription user match»

Заголовки
Имя., Тип, Description
accept string

Setting to application/vnd.github+json is recommended.

Параметры пути
Имя., Тип, Description
visual_studio_subscription_id string Обязательное поле

The ID of the Visual Studio subscription to delete the match for. This is a GUID that comes from the visual studio management portal.

enterprise string Обязательное поле

The slug version of the enterprise name

HTTP-коды статуса ответа для «Delete a Visual Studio subscription user match»

Код состоянияDescription
200

OK

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Примеры кода для «Delete a Visual Studio subscription user match»

Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.

Пример запроса

delete/enterprises/{enterprise}/visual-studio-subscriptions/{visual_studio_subscription_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/enterprises/ENTERPRISE/visual-studio-subscriptions/VISUAL_STUDIO_SUBSCRIPTION_ID

Response

Status: 200
{ "visual_studio_subscription_email": "[email protected]", "subscription_id": "00000000-0000-0000-0000-000000000000", "username": null, "manual_match": false }