GitHub Copilot has revolutionized how builders write code by leveraging AI-powered options to boost productiveness. In the event you’re a developer or workforce chief utilizing GitHub Copilot, you may need to monitor its utilization and impression throughout your tasks. GitHub supplies APIs that can help you extract insightful information about Copilot’s efficiency and utilization, serving to you measure its worth successfully.
On this weblog, we’ll discover easy methods to generate a GitHub Copilot utilization report utilizing the GitHub API, offering step-by-step directions to automate the method.
- Generate the Private entry token – Go to Developer Settings

Choose Private Entry tokens -> Tokens(traditional)
Click on generate new token, Write a be aware, choose expiration.

Now choose the scope as copilot and hit generate token.

Copy the token as you have to that token for calling Github copilot API.
2. Now outline your variables:
$ent = “vscopilot”
$apiUrl = "https://api.github.com/enterprises/$ent/copilot/billing/seats"
$token =”entry token you bought from the developer settings”
3. Make the most of the operate I’m sharing under to name github copilot API
operate Invoke-GitHubApi {
param (
[string]$url
)
$headers = @{
Authorization = “token $token”
Settle for = “utility/vnd.github.v3+json”
}
$allResults = @()
$web page = 1
do {
$pagedUrl = $url + “?web page=” + $web page
$response = Invoke-RestMethod -Uri $pagedUrl -Headers $headers -Technique Get
$allResults += $response.Seats
$web page++
} whereas ($response.Seats.Depend -gt 0)
return $allResults
}
4. Name the API utilizing under command
$copilotUsers = Invoke-GitHubApi -url $apiUrl
Right here is the snippet that exhibits what’s going to occur in Realtime when you’ll mix this code:

You possibly can additional drill down every file and create a pleasant report, instance to get the login title
$copilotUsers[0].assignee.login
By leveraging the GitHub API, you may automate the technology of insightful Copilot utilization studies, empowering you to maximise the worth of this AI-driven software
Tech Wizard
https://techwizard.cloud