Navigating GitHub Copilot Metrics: Adapting to API Deprecation and Enhancing GitHub Tracking
Adapting to GitHub Copilot API Changes: What Developers Need to Know
In the fast-evolving world of developer tools, APIs are constantly updated, deprecated, or replaced. A recent discussion in the GitHub Community highlights a common challenge: the deprecation of legacy GitHub Copilot metrics APIs, leaving developers scrambling for new ways to continue their github tracking of AI-assisted coding adoption and usage. This insight from devactivity.com explores the issue and provides clear guidance on navigating these changes.
The Challenge: Legacy Copilot Metrics API Sunset
The discussion began with a developer, yoav-dagan, encountering a 404 error when attempting to access the previously documented https://api.github.com/orgs/ORG/copilot/metrics endpoint. This was despite a changelog notice about deprecation, leading to confusion about the correct path forward for retrieving crucial data points like TOTAL_ACTIVE_USERS, COPILOT_IDE_CODE_COMPLETIONS, and more.
As confirmed by community experts AviJxn and Gecko51, the legacy endpoint was indeed fully sunset on April 2, 2026. This means the 404 error is expected behavior, not a mistake on the developer's part. The core issue is that while some documentation or blog posts might still reference the old URL, it's no longer valid.
The Solution: New Copilot Usage Metrics APIs
GitHub has introduced new Copilot usage metrics APIs, though they come with a different structure and require adaptation. Here are the key takeaways for developers:
- New Endpoint Patterns: The new APIs follow a different URL structure for organizational and user-level data.
GET /orgs/{ORG}/copilot/metrics/reports/organization-1-day
GET /orgs/{ORG}/copilot/metrics/reports/organization-28-day/latest
For per-user data:
GET /orgs/{ORG}/copilot/metrics/reports/users-1-day
GET /orgs/{ORG}/copilot/metrics/reports/users-28-day/latest- Schema Changes: Be aware that the field names have changed. Old columns like
COPILOT_IDE_CODE_COMPLETIONSare now often split out by language and model in the new schema. This means a direct 1:1 mapping might not be possible, requiring adjustments to your data processing pipelines. The full response structure is detailed in the official GitHub documentation atdocs.github.com/en/rest/copilot/copilot-usage-metrics. - Required Permissions: To access these new APIs, you'll need specific token scopes:
manage_billing:copilotorread:org. Both Classic PATs and fine-grained PATs can be used, provided the correct organization-level permissions are set.
Alternative Sources for Copilot Metrics
While the new APIs are the primary programmatic solution, there are other reliable ways to access Copilot usage data:
- GitHub UI: For immediate and comprehensive insights, the most reliable source is often the GitHub UI itself. Navigate to Organization settings → Copilot → Usage / Analytics to view detailed metrics. This is particularly useful for quick checks or when setting developer goals examples related to Copilot adoption.
- Audit Logs: For activity-level insights, audit logs can provide granular data, though they might require more processing to derive aggregate metrics.
- Export Data: If available, exporting data directly from the GitHub UI can serve as a temporary solution for integrating with your performance monitoring software.
Next Steps for Developers
If you're relying on Copilot metrics for your github tracking or internal reporting, it's crucial to:
- Update your API calls to use the new endpoints.
- Review the new schema and adjust your data parsing logic accordingly.
- Leverage the GitHub UI for a complete view while transitioning.
- Keep an eye on GitHub's official changelog and documentation for further updates on Copilot metrics APIs.
- If specific data points critical to your operations are still missing, consider opening a feature request or contacting GitHub support for roadmap clarity.
Adapting to API changes is a continuous part of development. By understanding the new Copilot metrics landscape, developers can ensure their github tracking remains robust and their insights into AI-assisted coding usage are accurate.
