GitHub Usage Reports Add user_id: Fix Positional CSV Parsers

GitHub usage reports now add user_id beside username. Update CSV and API consumers to use headers, preserve renamed accounts, and handle deleted users and bots.

Abstract usage report rows connected through a stable account key while identity labels change over time

GitHub usage reports now include a stable account identifier next to username. The change starts December 1, 2026, and the practical consequence is easy to miss: every column after username moves one position to the right.

If your billing pipeline reads CSV fields by number instead of by header, it can silently assign the wrong value to every field after username. A parser that has worked for months can keep running while producing bad reports.

What changed

Reports that already contain username now add user_id immediately beside it. The change applies to the detailed usage report, AI usage report, and premium request usage report, including exports created through the GitHub REST API. The summarized usage report does not change.

GitHub says this applies to all GitHub Enterprise Cloud account types and standalone organizations on GitHub Team. It is not a new billing calculation. The report shape changes, while the usage amounts are calculated the same way.

The first fix: stop using column positions

Do not fix this by adding one to a hard-coded index. Read the header row, build a name-to-index map, or use a CSV library that returns each row as a dictionary. Header-based parsing survives inserted columns and makes the expected fields visible in code review.

import csv

with open("usage.csv", newline="") as file:
    for row in csv.DictReader(file):
        username = row.get("username")
        user_id = row.get("user_id")
        net_amount = row.get("net_amount")
        # Store by user_id when it is present, not by username.

The same rule applies to API consumers. Treat the response or downloaded report as a named-field contract, not as a fixed array layout. Keep the report type and API version in your ingestion metadata so a later investigation can explain which shape produced a row.

Why user_id is better than username

Usernames are useful labels, but they are not stable identities. A person can rename an account, and a deleted account may no longer have a username in the report. user_id lets you keep the same account history together across a rename and identify usage that belongs to a deleted account.

The identifier also covers bot accounts. Do not assume that a missing or unfamiliar username means a human user. Store the account type or source fields your report provides, and keep bot usage separate when your cost model needs that distinction.

user_id can be empty. GitHub says it is empty when usage is not tied to an account. Keep that value as unknown or unassigned. Do not turn it into a fake user such as 0, system, or the empty string if those values could collide with real data.

Deleted accounts and totals

Usage from different deleted accounts will appear on separate rows instead of being combined into one empty-username row. GitHub also notes that totals you calculate may differ slightly in the last decimal places because each row is rounded separately. Compare totals with an appropriate tolerance rather than rejecting a report over a tiny rounding difference.

Do not mix report types

The detailed report includes fields such as organization, repository, workflow_path, username, and user_id. The AI usage report has model and token fields. The summarized report is grouped at a higher level and does not include username. Keep a separate schema for each report type instead of making every column optional in one giant record.

A short migration checklist

First, search for code that indexes report columns by number. Next, add a fixture containing username followed by user_id and assert that the fields land in the right database columns. Store user_id as a nullable string or integer according to the report contract. Then backfill account joins where username was previously the only key, and add a header check that fails loudly when a required field is missing.

If you match usage to audit events, use user_id as the durable join key and keep username as display data. If a row has no user_id, route it to an unassigned bucket and preserve the original row for later investigation.

Bottom line

The new user_id column fixes a real reporting weakness, but it can break brittle ingestion code on day one. Parse by header, key account history by user_id when present, preserve unknowns as unknown, and keep detailed, AI, premium request, and summarized reports on explicit schemas.