Skip to main content
Die REST-API verfügt jetzt über eine Versionskontrolle. Weitere Informationen findest du unter Informationen zur API-Versionsverwaltung.

REST-API-Endpunkte für Copilot-Metriken

Verwende die REST-API, um Copilot-Metriken anzuzeigen.

Du kannst diese Endpunkte verwenden, um eine Aufschlüsselung aggregierter Metriken für verschiedene GitHub Copilot-Features zu erhalten. Die API umfasst:

  • Daten für die letzten 28 Tage
  • Anzahl aktiver und beteiligter Benutzer
  • Aufschlüsselungen nach Sprache und IDE
  • Die Option zum Anzeigen von Metriken für ein Unternehmen, eine Organisation oder ein Team

Wenn du derzeit REST-API-Endpunkte für Metriken zur GitHub Copilot-Nutzung verwendest, wird empfohlen, so bald wie möglich zu diesen Endpunkten zu migrieren.

Hilfe zu den ersten Schritten findest du unter Analysieren der Nutzung im Laufe der Zeit mit der Copilot-Metrik-API.

Get Copilot metrics for an enterprise

Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions.

The response contains metrics for up to 28 days prior. 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.

To access this endpoint, the Copilot Metrics API access policy must be enabled or set to "no policy" for the enterprise within GitHub settings. Only enterprise owners and billing managers can view Copilot metrics for the enterprise.

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

Differenzierte Zugriffstoken für "Get Copilot metrics for an enterprise"

Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.

Parameter für „Get Copilot metrics for an enterprise“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
enterprise string Erforderlich

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

Abfrageparameter
Name, type, BESCHREIBUNG
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."

Standard: 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."

Standard: 28

HTTP-Antwortstatuscodes für „Get Copilot metrics for an enterprise“

StatuscodeBESCHREIBUNG
200

OK

403

Forbidden

404

Resource not found

422

Copilot Usage Merics API setting is disabled at the organization or enterprise level.

500

Internal Error

Codebeispiele für „Get Copilot metrics for an enterprise“

Wenn du unter GHE.com auf GitHub zugreifst, ersetze api.github.com unter api.SUBDOMAIN.ghe.com mit der dedizierten Unterdomäne deines Unternehmens.

Anforderungsbeispiel

get/enterprises/{enterprise}/copilot/metrics
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/enterprises/ENTERPRISE/copilot/metrics

Response

Status: 200
[ { "date": "2024-06-24", "total_active_users": 24, "total_engaged_users": 20, "copilot_ide_code_completions": { "total_engaged_users": 20, "languages": [ { "name": "python", "total_engaged_users": 10 }, { "name": "ruby", "total_engaged_users": 10 } ], "editors": [ { "name": "vscode", "total_engaged_users": 13, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 13, "languages": [ { "name": "python", "total_engaged_users": 6, "total_code_suggestions": 249, "total_code_acceptances": 123, "total_code_lines_suggested": 225, "total_code_lines_accepted": 135 }, { "name": "ruby", "total_engaged_users": 7, "total_code_suggestions": 496, "total_code_acceptances": 253, "total_code_lines_suggested": 520, "total_code_lines_accepted": 270 } ] } ] }, { "name": "neovim", "total_engaged_users": 7, "models": [ { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "languages": [ { "name": "typescript", "total_engaged_users": 3, "total_code_suggestions": 112, "total_code_acceptances": 56, "total_code_lines_suggested": 143, "total_code_lines_accepted": 61 }, { "name": "go", "total_engaged_users": 4, "total_code_suggestions": 132, "total_code_acceptances": 67, "total_code_lines_suggested": 154, "total_code_lines_accepted": 72 } ] } ] } ] }, "copilot_ide_chat": { "total_engaged_users": 13, "editors": [ { "name": "vscode", "total_engaged_users": 13, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 12, "total_chats": 45, "total_chat_insertion_events": 12, "total_chat_copy_events": 16 }, { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "total_engaged_users": 1, "total_chats": 10, "total_chat_insertion_events": 11, "total_chat_copy_events": 3 } ] } ] }, "copilot_dotcom_chat": { "total_engaged_users": 14, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 14, "total_chats": 38 } ] }, "copilot_dotcom_pull_requests": { "total_engaged_users": 12, "repositories": [ { "name": "demo/repo1", "total_engaged_users": 8, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_pr_summaries_created": 6, "total_engaged_users": 8 } ] }, { "name": "demo/repo2", "total_engaged_users": 4, "models": [ { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "total_pr_summaries_created": 10, "total_engaged_users": 4 } ] } ] } } ]

Get Copilot metrics for an enterprise team

Note

This endpoint is only applicable to dedicated enterprise accounts for Copilot Business. See "About enterprise accounts for Copilot Business."

Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions.

The response contains metrics for up to 28 days prior. 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 enterprise team had five or more members with active Copilot licenses on that day, as evaluated at the end of that day.

To access this endpoint, the Copilot Metrics API access policy must be enabled or set to "no policy" for the enterprise within GitHub settings. Only owners and billing managers for the enterprise that contains the enterprise team can view Copilot metrics for the enterprise team.

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

Differenzierte Zugriffstoken für "Get Copilot metrics for an enterprise team"

Dieser Endpunkt funktioniert nicht mit GitHub-App-Benutzerzugriffstoken, GitHub-App-Installationszugriffstoken oder differenzierten persönlichen Zugriffstoken.

Parameter für „Get Copilot metrics for an enterprise team“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
enterprise string Erforderlich

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

team_slug string Erforderlich

The slug of the enterprise team name.

Abfrageparameter
Name, type, BESCHREIBUNG
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."

Standard: 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."

Standard: 28

HTTP-Antwortstatuscodes für „Get Copilot metrics for an enterprise team“

StatuscodeBESCHREIBUNG
200

OK

403

Forbidden

404

Resource not found

422

Copilot Usage Merics API setting is disabled at the organization or enterprise level.

500

Internal Error

Codebeispiele für „Get Copilot metrics for an enterprise team“

Wenn du unter GHE.com auf GitHub zugreifst, ersetze api.github.com unter api.SUBDOMAIN.ghe.com mit der dedizierten Unterdomäne deines Unternehmens.

Anforderungsbeispiel

get/enterprises/{enterprise}/team/{team_slug}/copilot/metrics
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/enterprises/ENTERPRISE/team/TEAM_SLUG/copilot/metrics

Response

Status: 200
[ { "date": "2024-06-24", "total_active_users": 24, "total_engaged_users": 20, "copilot_ide_code_completions": { "total_engaged_users": 20, "languages": [ { "name": "python", "total_engaged_users": 10 }, { "name": "ruby", "total_engaged_users": 10 } ], "editors": [ { "name": "vscode", "total_engaged_users": 13, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 13, "languages": [ { "name": "python", "total_engaged_users": 6, "total_code_suggestions": 249, "total_code_acceptances": 123, "total_code_lines_suggested": 225, "total_code_lines_accepted": 135 }, { "name": "ruby", "total_engaged_users": 7, "total_code_suggestions": 496, "total_code_acceptances": 253, "total_code_lines_suggested": 520, "total_code_lines_accepted": 270 } ] } ] }, { "name": "neovim", "total_engaged_users": 7, "models": [ { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "languages": [ { "name": "typescript", "total_engaged_users": 3, "total_code_suggestions": 112, "total_code_acceptances": 56, "total_code_lines_suggested": 143, "total_code_lines_accepted": 61 }, { "name": "go", "total_engaged_users": 4, "total_code_suggestions": 132, "total_code_acceptances": 67, "total_code_lines_suggested": 154, "total_code_lines_accepted": 72 } ] } ] } ] }, "copilot_ide_chat": { "total_engaged_users": 13, "editors": [ { "name": "vscode", "total_engaged_users": 13, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 12, "total_chats": 45, "total_chat_insertion_events": 12, "total_chat_copy_events": 16 }, { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "total_engaged_users": 1, "total_chats": 10, "total_chat_insertion_events": 11, "total_chat_copy_events": 3 } ] } ] }, "copilot_dotcom_chat": { "total_engaged_users": 14, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 14, "total_chats": 38 } ] }, "copilot_dotcom_pull_requests": { "total_engaged_users": 12, "repositories": [ { "name": "demo/repo1", "total_engaged_users": 8, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_pr_summaries_created": 6, "total_engaged_users": 8 } ] }, { "name": "demo/repo2", "total_engaged_users": 4, "models": [ { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "total_pr_summaries_created": 10, "total_engaged_users": 4 } ] } ] } } ]

Get Copilot metrics for an organization

Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions.

Note

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

The response contains metrics for up to 28 days prior. 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.

To access this endpoint, the Copilot Metrics API access policy must be enabled for the organization. Only organization owners and owners and billing managers of the parent enterprise can view Copilot 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.

Differenzierte Zugriffstoken für "Get Copilot metrics for an organization"

Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:

Das differenzierte Token muss mindestens einen der folgenden Berechtigungssätze aufweisen.:

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

Parameter für „Get Copilot metrics for an organization“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
org string Erforderlich

The organization name. The name is not case sensitive.

Abfrageparameter
Name, type, BESCHREIBUNG
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."

Standard: 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."

Standard: 28

HTTP-Antwortstatuscodes für „Get Copilot metrics for an organization“

StatuscodeBESCHREIBUNG
200

OK

403

Forbidden

404

Resource not found

422

Copilot Usage Merics API setting is disabled at the organization or enterprise level.

500

Internal Error

Codebeispiele für „Get Copilot metrics for an organization“

Wenn du unter GHE.com auf GitHub zugreifst, ersetze api.github.com unter api.SUBDOMAIN.ghe.com mit der dedizierten Unterdomäne deines Unternehmens.

Anforderungsbeispiel

get/orgs/{org}/copilot/metrics
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/metrics

Response

Status: 200
[ { "date": "2024-06-24", "total_active_users": 24, "total_engaged_users": 20, "copilot_ide_code_completions": { "total_engaged_users": 20, "languages": [ { "name": "python", "total_engaged_users": 10 }, { "name": "ruby", "total_engaged_users": 10 } ], "editors": [ { "name": "vscode", "total_engaged_users": 13, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 13, "languages": [ { "name": "python", "total_engaged_users": 6, "total_code_suggestions": 249, "total_code_acceptances": 123, "total_code_lines_suggested": 225, "total_code_lines_accepted": 135 }, { "name": "ruby", "total_engaged_users": 7, "total_code_suggestions": 496, "total_code_acceptances": 253, "total_code_lines_suggested": 520, "total_code_lines_accepted": 270 } ] } ] }, { "name": "neovim", "total_engaged_users": 7, "models": [ { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "languages": [ { "name": "typescript", "total_engaged_users": 3, "total_code_suggestions": 112, "total_code_acceptances": 56, "total_code_lines_suggested": 143, "total_code_lines_accepted": 61 }, { "name": "go", "total_engaged_users": 4, "total_code_suggestions": 132, "total_code_acceptances": 67, "total_code_lines_suggested": 154, "total_code_lines_accepted": 72 } ] } ] } ] }, "copilot_ide_chat": { "total_engaged_users": 13, "editors": [ { "name": "vscode", "total_engaged_users": 13, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 12, "total_chats": 45, "total_chat_insertion_events": 12, "total_chat_copy_events": 16 }, { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "total_engaged_users": 1, "total_chats": 10, "total_chat_insertion_events": 11, "total_chat_copy_events": 3 } ] } ] }, "copilot_dotcom_chat": { "total_engaged_users": 14, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 14, "total_chats": 38 } ] }, "copilot_dotcom_pull_requests": { "total_engaged_users": 12, "repositories": [ { "name": "demo/repo1", "total_engaged_users": 8, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_pr_summaries_created": 6, "total_engaged_users": 8 } ] }, { "name": "demo/repo2", "total_engaged_users": 4, "models": [ { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "total_pr_summaries_created": 10, "total_engaged_users": 4 } ] } ] } } ]

Get Copilot metrics for a team

Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions.

Note

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

The response contains metrics for up to 28 days prior. 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.

To access this endpoint, the Copilot Metrics API access policy must be enabled for the organization containing the team within GitHub settings. Only organization owners for the organization that contains this team and owners and billing managers of the parent enterprise can view Copilot 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.

Differenzierte Zugriffstoken für "Get Copilot metrics for a team"

Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:

Das differenzierte Token muss mindestens einen der folgenden Berechtigungssätze aufweisen.:

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

Parameter für „Get Copilot metrics for a team“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
org string Erforderlich

The organization name. The name is not case sensitive.

team_slug string Erforderlich

The slug of the team name.

Abfrageparameter
Name, type, BESCHREIBUNG
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."

Standard: 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."

Standard: 28

HTTP-Antwortstatuscodes für „Get Copilot metrics for a team“

StatuscodeBESCHREIBUNG
200

OK

403

Forbidden

404

Resource not found

422

Copilot Usage Merics API setting is disabled at the organization or enterprise level.

500

Internal Error

Codebeispiele für „Get Copilot metrics for a team“

Wenn du unter GHE.com auf GitHub zugreifst, ersetze api.github.com unter api.SUBDOMAIN.ghe.com mit der dedizierten Unterdomäne deines Unternehmens.

Anforderungsbeispiel

get/orgs/{org}/team/{team_slug}/copilot/metrics
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/metrics

Response

Status: 200
[ { "date": "2024-06-24", "total_active_users": 24, "total_engaged_users": 20, "copilot_ide_code_completions": { "total_engaged_users": 20, "languages": [ { "name": "python", "total_engaged_users": 10 }, { "name": "ruby", "total_engaged_users": 10 } ], "editors": [ { "name": "vscode", "total_engaged_users": 13, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 13, "languages": [ { "name": "python", "total_engaged_users": 6, "total_code_suggestions": 249, "total_code_acceptances": 123, "total_code_lines_suggested": 225, "total_code_lines_accepted": 135 }, { "name": "ruby", "total_engaged_users": 7, "total_code_suggestions": 496, "total_code_acceptances": 253, "total_code_lines_suggested": 520, "total_code_lines_accepted": 270 } ] } ] }, { "name": "neovim", "total_engaged_users": 7, "models": [ { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "languages": [ { "name": "typescript", "total_engaged_users": 3, "total_code_suggestions": 112, "total_code_acceptances": 56, "total_code_lines_suggested": 143, "total_code_lines_accepted": 61 }, { "name": "go", "total_engaged_users": 4, "total_code_suggestions": 132, "total_code_acceptances": 67, "total_code_lines_suggested": 154, "total_code_lines_accepted": 72 } ] } ] } ] }, "copilot_ide_chat": { "total_engaged_users": 13, "editors": [ { "name": "vscode", "total_engaged_users": 13, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 12, "total_chats": 45, "total_chat_insertion_events": 12, "total_chat_copy_events": 16 }, { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "total_engaged_users": 1, "total_chats": 10, "total_chat_insertion_events": 11, "total_chat_copy_events": 3 } ] } ] }, "copilot_dotcom_chat": { "total_engaged_users": 14, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_engaged_users": 14, "total_chats": 38 } ] }, "copilot_dotcom_pull_requests": { "total_engaged_users": 12, "repositories": [ { "name": "demo/repo1", "total_engaged_users": 8, "models": [ { "name": "default", "is_custom_model": false, "custom_model_training_date": null, "total_pr_summaries_created": 6, "total_engaged_users": 8 } ] }, { "name": "demo/repo2", "total_engaged_users": 4, "models": [ { "name": "a-custom-model", "is_custom_model": true, "custom_model_training_date": "2024-02-01", "total_pr_summaries_created": 10, "total_engaged_users": 4 } ] } ] } } ]