Mastering GitHub Copilot Usage Metrics: Adapting to the New API for Enhanced Git Reporting

Understanding developer activity and the return on investment from tools like GitHub Copilot is crucial for effective software project tracking. For many organizations, this means integrating usage metrics into internal dashboards, often powered by tools like Power BI. A recent discussion on the GitHub Community forum highlighted a significant upcoming change to how these metrics are accessed, causing understandable concern among users relying on the existing API structure.

The core of the issue, as raised by sftong2000, is the impending sunset of the old GitHub Enterprise Copilot usage metrics API (https://api.github.com/enterprises//copilot/metrics) on April 2, 2026. This API previously returned direct JSON data, making integration relatively straightforward. The new API, documented at GitHub Docs, introduces a fundamentally different approach:

  • The usage window has shifted from the last 90 days to a more focused 28-day period.
  • Instead of direct data, the new API (https://api.github.com//enterprises/{enterprise}/copilot/metrics/reports/enterprise-28-day/latest) returns an object containing download_links to separate report files.

The original poster shared an example of the new API response, illustrating the change:

{
  "download_links": [
    "https://example.com/copilot-usage-report-1.json",
    "https://example.com/copilot-usage-report-2.json"
  ],
  "report_start_day": "2025-07-01",
  "report_end_day": "2025-07-28"
}

The primary pain point identified was the lack of clarity on the schema of these linked reports and the effort required to re-engineer existing git reporting solutions. Fortunately, fellow community members quickly stepped in with crucial insights and solutions.

Developer analyzing GitHub Copilot usage metrics on a dashboard.
Developer analyzing GitHub Copilot usage metrics on a dashboard.

Decoding the New Data Format: NDJSON

The key insight shared by midiakiasat and Yigtwxx is that the files behind the download_links are in NDJSON (Newline-Delimited JSON) format, not a single JSON array or object. This means each line within these files is an independent JSON object. This format is efficient for streaming large datasets but requires a different parsing approach than traditional JSON.

The schema for the fields within these NDJSON records is consistently documented in GitHub's "Data available in Copilot usage metrics" → "API and export fields" section, providing a stable reference for developers.

Data transformation pipeline from API to Power BI dashboard.
Data transformation pipeline from API to Power BI dashboard.

A Step-by-Step Guide to Adapting Your Reports

Migrating your git reporting dashboards to the new API requires a revised data ingestion workflow. Here’s a consolidated approach based on the community discussion:

  1. Call the New API Endpoint: Make a GET request to /enterprises/{enterprise}/copilot/metrics/reports/enterprise-28-day/latest. This will return the download_links, which are signed URLs that expire, so they must be used promptly.
  2. Download NDJSON Files: For each link obtained, download the corresponding file. Standard JSON parsers will likely fail here because the file isn't a single, enclosed JSON entity.
  3. Process NDJSON Data: This is the most critical step. You need to read each downloaded file, split its content by newline characters, and then parse each resulting line as an individual JSON object.
    • In Power Query (Power BI): When importing these files, you'll need to apply transformations to split the data line by line and then parse each line as a separate record. This typically involves using functions like Text.Split and Json.Document within custom M queries.
    • Using Python/Pandas: For those who prefer scripting, the Pandas library offers an elegant solution. You can directly read NDJSON files into a DataFrame using:
      import pandas as pd
      df = pd.read_json('filename.json', lines=True)
  4. Consolidate and Model: Once individual records are parsed from all report-*.json files, you can append or union them together. This consolidated dataset can then be used to build or update your Power BI model, aligning with the "API and export fields" schema. This process ensures your software development okr tracking remains accurate and up-to-date.

While the transition presents a learning curve, the community's swift response demonstrates the power of shared knowledge. By understanding NDJSON and adjusting your data ingestion pipeline, you can seamlessly continue to leverage GitHub Copilot usage metrics for robust software project tracking and informed decision-making.