Skip to main content
O controle de versão da API REST já foi feito. Para obter mais informações, confira "Sobre o controle de versão da API".

Pontos de extremidade da API REST para métricas de uso do GitHub Copilot

Use a API REST para acessar métricas de uso do Copilot para uma empresa, uma organização ou uma equipe.

Get a summary of Copilot usage for organization members

Note

This endpoint is in public preview and is subject to change.

You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE across an organization, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.

The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day, and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics, they must have telemetry enabled in their IDE.

Organization owners, and owners and billing managers of the parent enterprise, can view Copilot usage metrics.

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

Tokens de acesso refinados para "Get a summary of Copilot usage for organization members"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter pelo menos um dos seguintes conjuntos de permissões:

  • "GitHub Copilot Business" organization permissions (read)
  • "Administration" organization permissions (read)

Parâmetros para "Get a summary of Copilot usage for organization members"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Parâmetros de consulta
Nome, Tipo, Descrição
since string

Show usage metrics since this date. This is a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Maximum value is 28 days ago.

until string

Show usage metrics until this date. This is a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) and should not preceed the since date if it is passed.

page integer

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

Padrão: 1

per_page integer

The number of days of metrics to display per page (max 28). For more information, see "Using pagination in the REST API."

Padrão: 28

Códigos de status de resposta HTTP para "Get a summary of Copilot usage for organization members"

Código de statusDescrição
200

OK

401

Requires authentication

403

Forbidden

404

Resource not found

500

Internal Error

Exemplos de código para "Get a summary of Copilot usage for organization members"

Exemplo de solicitação

get/orgs/{org}/copilot/usage
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/copilot/usage

Response

Status: 200
[ { "day": "2023-10-15", "total_suggestions_count": 1000, "total_acceptances_count": 800, "total_lines_suggested": 1800, "total_lines_accepted": 1200, "total_active_users": 10, "total_chat_acceptances": 32, "total_chat_turns": 200, "total_active_chat_users": 4, "breakdown": [ { "language": "python", "editor": "vscode", "suggestions_count": 300, "acceptances_count": 250, "lines_suggested": 900, "lines_accepted": 700, "active_users": 5 }, { "language": "python", "editor": "jetbrains", "suggestions_count": 300, "acceptances_count": 200, "lines_suggested": 400, "lines_accepted": 300, "active_users": 2 }, { "language": "ruby", "editor": "vscode", "suggestions_count": 400, "acceptances_count": 350, "lines_suggested": 500, "lines_accepted": 200, "active_users": 3 } ] }, { "day": "2023-10-16", "total_suggestions_count": 800, "total_acceptances_count": 600, "total_lines_suggested": 1100, "total_lines_accepted": 700, "total_active_users": 12, "total_chat_acceptances": 57, "total_chat_turns": 426, "total_active_chat_users": 8, "breakdown": [ { "language": "python", "editor": "vscode", "suggestions_count": 300, "acceptances_count": 200, "lines_suggested": 600, "lines_accepted": 300, "active_users": 2 }, { "language": "python", "editor": "jetbrains", "suggestions_count": 300, "acceptances_count": 150, "lines_suggested": 300, "lines_accepted": 250, "active_users": 6 }, { "language": "ruby", "editor": "vscode", "suggestions_count": 200, "acceptances_count": 150, "lines_suggested": 200, "lines_accepted": 150, "active_users": 3 } ] } ]

Get a summary of Copilot usage for a team

Note

This endpoint is in public preview and is subject to change.

You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE for users within a team, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.

The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day, and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics, they must have telemetry enabled in their IDE.

Note

This endpoint will only return results for a given day if the team had five or more members with active Copilot licenses, as evaluated at the end of that day.

Organization owners for the organization that contains this team, and owners and billing managers of the parent enterprise can view Copilot usage metrics for a team.

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

Tokens de acesso refinados para "Get a summary of Copilot usage for a team"

Esse ponto de extremidade funciona com os seguintes tipos de token refinados:

O token refinado deve ter pelo menos um dos seguintes conjuntos de permissões:

  • "GitHub Copilot Business" organization permissions (read)
  • "Administration" organization permissions (read)

Parâmetros para "Get a summary of Copilot usage for a team"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

team_slug string Obrigatório

The slug of the team name.

Parâmetros de consulta
Nome, Tipo, Descrição
since string

Show usage metrics since this date. This is a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Maximum value is 28 days ago.

until string

Show usage metrics until this date. This is a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) and should not preceed the since date if it is passed.

page integer

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

Padrão: 1

per_page integer

The number of days of metrics to display per page (max 28). For more information, see "Using pagination in the REST API."

Padrão: 28

Códigos de status de resposta HTTP para "Get a summary of Copilot usage for a team"

Código de statusDescrição
200

OK

401

Requires authentication

403

Forbidden

404

Resource not found

500

Internal Error

Exemplos de código para "Get a summary of Copilot usage for a team"

Exemplo de solicitação

get/orgs/{org}/team/{team_slug}/copilot/usage
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/team/TEAM_SLUG/copilot/usage

Response

Status: 200
[ { "day": "2023-10-15", "total_suggestions_count": 1000, "total_acceptances_count": 800, "total_lines_suggested": 1800, "total_lines_accepted": 1200, "total_active_users": 10, "total_chat_acceptances": 32, "total_chat_turns": 200, "total_active_chat_users": 4, "breakdown": [ { "language": "python", "editor": "vscode", "suggestions_count": 300, "acceptances_count": 250, "lines_suggested": 900, "lines_accepted": 700, "active_users": 5 }, { "language": "python", "editor": "jetbrains", "suggestions_count": 300, "acceptances_count": 200, "lines_suggested": 400, "lines_accepted": 300, "active_users": 2 }, { "language": "ruby", "editor": "vscode", "suggestions_count": 400, "acceptances_count": 350, "lines_suggested": 500, "lines_accepted": 200, "active_users": 3 } ] }, { "day": "2023-10-16", "total_suggestions_count": 800, "total_acceptances_count": 600, "total_lines_suggested": 1100, "total_lines_accepted": 700, "total_active_users": 12, "total_chat_acceptances": 57, "total_chat_turns": 426, "total_active_chat_users": 8, "breakdown": [ { "language": "python", "editor": "vscode", "suggestions_count": 300, "acceptances_count": 200, "lines_suggested": 600, "lines_accepted": 300, "active_users": 2 }, { "language": "python", "editor": "jetbrains", "suggestions_count": 300, "acceptances_count": 150, "lines_suggested": 300, "lines_accepted": 250, "active_users": 6 }, { "language": "ruby", "editor": "vscode", "suggestions_count": 200, "acceptances_count": 150, "lines_suggested": 200, "lines_accepted": 150, "active_users": 3 } ] } ]