Audit Log Events and Managing Seats with the REST API
30-second answer
Every Copilot admin change leaves a trail in the organization's audit log: events start with copilot. (seats added or cancelled, policy changes, content exclusion changes) and you find them by searching action:copilot. To manage the subscription in code, use the Copilot user management REST API: GET /orgs/{org}/copilot/billing for the settings, GET /orgs/{org}/copilot/billing/seats for every seat with last_activity_at and last_activity_editor, and POST or DELETE /orgs/{org}/copilot/billing/selected_users (or /selected_teams) to add or cancel seats. The token needs the manage_billing:copilot scope, and a cancelled seat stays active until the end of the billing cycle.
Exam objective: 2.4.2 Use audit log events. 2.4.3 Manage subscriptions using the REST API. (Skills measured as of August 7, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
The <strong>audit log</strong> (organization settings › Archive › Logs) records Copilot events: seats added or cancelled, policy changes, content exclusion changes. Filter with <code>action:copilot</code>; the event names here are examples, so check the docs for the exact list.
👆 Click the glowing item on screen to continue
Read the steps as text
- The audit log (organization settings › Archive › Logs) records Copilot events: seats added or cancelled, policy changes, content exclusion changes. Filter with action:copilot; the event names here are examples, so check the docs for the exact list.
- The Copilot user management REST API lists seats with last_activity_at, so you can find seats nobody uses.
- POST /copilot/billing/selected_users adds seats; DELETE cancels them (the seat lasts until the end of the billing cycle). selected_teams does the same for teams. The token needs manage_billing:copilot.
🧪 Simulation for learning. Screens are simplified versions of Visual Studio Code and github.com with GitHub Copilot; names, files and suggestions are examples. Not affiliated with GitHub or Microsoft, and nothing here touches your real account.
🖱️ Drag to rotate · scroll or pinch to zoom
Audit log and metrics
Copilot settings changes, seat assignments and content exclusion changes appear in the audit log. Usage metrics and the REST API show adoption and activity.
🤔 What happens if…
Read this tour as text
- Plans and seats. Individuals use Copilot Free, Pro or Pro+. Organizations buy Copilot Business per seat; Copilot Enterprise adds features on GitHub Enterprise Cloud. Admins assign seats to users or teams.
- Policies flow down. An enterprise can enforce a Copilot policy for all its organizations or leave the choice to each organization. Policies cover features (chat in the IDE, on github.com, the CLI, code review, agents), models and MCP.
- Seats light up Copilot. A developer gets Copilot once they have a seat. Remove the seat and Copilot stops at the end of the billing cycle.
- Suggestions matching public code. A policy decides what happens when a suggestion matches public code: Block hides it; Allow shows it with a code reference (repository and licence) so you can decide.
- Content exclusions. Repository, organization and enterprise admins can exclude files and paths. Copilot won’t use them as context or suggest inside them in supported IDEs. Changes can take up to 30 minutes to reach editors.
- Audit log and metrics. Copilot settings changes, seat assignments and content exclusion changes appear in the audit log. Usage metrics and the REST API show adoption and activity.
- Responsible use. Policies reduce risk, but the developer still owns the output: review it, test it, scan it for vulnerabilities and check licences before it ships.
- Troubleshooting. No suggestions? Check the seat and sign-in, whether the file is excluded, whether the language is disabled in settings, the public code filter, network or proxy settings, and the Copilot logs in the IDE.
You're the Contoso org admin. Check the Copilot subscription with the REST API, find a seat nobody uses, give a new developer a seat, take one away, and prove it all from the audit log.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
You pay for 200 seats and suspect 40 are unused.
😊 THE SOLUTION
Use the seats API to find inactive users and the audit log to track changes.
- Paying for idle seats✓ last_activity_at
- Clicking seat by seat✓ POST / DELETE selected_users
- Who changed what?✓ action:copilot in the audit log
Start with a question
We pay for 120 Copilot seats. Finance asks how many people actually use them, and security asks who switched off the public code filter. Where do I look?
Think of an office building. The front desk keeps a visitor book: who came in, when, which floor. And the facilities team has a badge list: who has a badge, and when each badge last opened a door.
GitHub gives a Copilot admin both. The audit log is the visitor book: every Copilot settings change, seat change and content exclusion change, with who did it and when. The Copilot user management REST API is the badge list: every seat, when it was last used, and calls to hand out or take back seats in bulk.
Explain it like I’m 10
The technical explanation
Audit log events for Copilot
Organization owners open the Audit log page in the organization settings. Copilot events have names that start with copilot., so the search action:copilot filters to them. You’ll see things like:
- a seat added or cancelled for a user or team
- a Copilot policy changed (for example, a feature enabled or disabled)
- content exclusion settings changed
Each entry has the actor, the action, the time and details. You can export the results. Event names change over time, so check the docs’ list of audit log events rather than memorising each one. For the exam, remember the prefix and the search.
The Copilot user management REST API
All the endpoints sit under /orgs/{org}/copilot/billing. With the GitHub CLI, gh api makes the calls for you:
| Method and path | What it does |
|---|---|
GET /orgs/{org}/copilot/billing | Subscription settings and a seat breakdown for the org |
GET /orgs/{org}/copilot/billing/seats | Every seat with assignee, last_activity_at and last_activity_editor |
POST /orgs/{org}/copilot/billing/selected_users | Add seats for selected_usernames |
DELETE /orgs/{org}/copilot/billing/selected_users | Cancel seats for selected_usernames |
POST / DELETE /orgs/{org}/copilot/billing/selected_teams | The same, for selected_teams |
GET /orgs/{org}/copilot/metrics | Usage metrics for the org |
Finding an unused seat:
gh api /orgs/contoso/copilot/billing/seats
# { "total_seats": 3, "seats": [
# { "assignee": { "login": "chen-qa" },
# "last_activity_at": "2026-09-02T09:12:00Z",
# "last_activity_editor": "jetbrains/2026.2" }, ... ] }
Giving one person a seat and taking one away:
gh api -X POST /orgs/contoso/copilot/billing/selected_users -f "selected_usernames[]=dina-new"
# { "seats_created": 1 }
gh api -X DELETE /orgs/contoso/copilot/billing/selected_users -f "selected_usernames[]=chen-qa"
# { "seats_cancelled": 1 }
Three rules to remember:
- The token needs the
manage_billing:copilotscope. - Adding and cancelling by user or team applies when the org gives Copilot to selected members and teams, not “all members”.
- A cancelled seat goes into pending cancellation and keeps working until the end of the billing cycle.
-
1 List seats
GET .../copilot/billing/seats
-
2 Spot idle ones
last_activity_at older than 60 days, or empty.
-
3 Cancel
DELETE .../selected_users with their usernames.
-
4 Add new joiners
POST .../selected_users or assign their team.
-
5 Prove it
The audit log shows each change under action:copilot.
Architect level Automate the review, keep a human in it
You can run the seat review on a schedule, for example a GitHub Actions workflow that calls the seats endpoint once a month and opens an issue listing seats with no activity in 60 days. Don’t let the script cancel seats on its own: someone on leave or using an editor that reports activity late would lose access. Let a manager confirm, then cancel with one API call. Keep the token in an Actions secret, scoped to just what the job needs, and the audit log will show the cancellations with the token’s owner as the actor.
Real-world business scenario
Contoso (fictional)
- The problem
- Contoso paid for 120 Copilot Business seats but nobody knew who used them, and security couldn't tell who had changed the public code policy.
- What they used
- A monthly workflow that calls GET /orgs/contoso/copilot/billing/seats, an issue listing seats idle for 60 days, DELETE selected_users for confirmed ones, team-based seats for new joiners through selected_teams, and audit log searches with action:copilot.
- Why that choice
- The seats endpoint shows real usage per person, team seats remove the ticket for every new joiner, and the audit log answers 'who changed what' without guesswork.
- The result
- Contoso cancelled 18 idle seats in the first review, new developers get Copilot the day they join a team, and security can trace every Copilot policy change.
When to use it and when not to
✓ Use it when…
- Auditing who changed a Copilot policy, seat or content exclusion, with action:copilot.
- Finding idle seats with last_activity_at before a renewal.
- Adding or cancelling many seats in a script, or tying seats to a team.
✕ Think twice when…
- Expecting a seat cancelled by API to stop working immediately.
- Auto-cancelling seats with no human check.
- Storing the manage_billing:copilot token in code or a shared file.
↔ Alternatives to consider
- Organization settings › Copilot › Access for a handful of seat changes by hand.
- The Copilot metrics API and dashboard for adoption trends rather than per-seat activity.
Test yourself with exercises
5 original practice questions in the GH-300 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner Someone turned off Copilot Chat on github.com for the whole org last week. How do you find out who?
Model answer
Open the organization's audit log and search action:copilot. Copilot policy changes are logged there with the actor and the time.
Interviewer follows up
What else shows up there for Copilot?
You
Seats being added or cancelled, policy changes and content exclusion changes.
Intermediate How would you find Copilot seats nobody is using?
Model answer
Call GET /orgs/contoso/copilot/billing/seats and look at last_activity_at on each seat. An old date, or no date at all, means the person isn't using it. last_activity_editor tells me which editor they last used.
Experienced developer You cancel a seat on the 3rd of the month with the REST API. When does the user lose Copilot?
Model answer
At the end of the current billing cycle. The DELETE call returns seats_cancelled and the seat goes into pending cancellation, but it stays usable until the cycle ends.
Interviewer follows up
And what token do you need?
You
One with the manage_billing:copilot scope, from someone allowed to manage Copilot billing for the org, like an owner or billing manager.
Scenario Every new developer joins the "web" team. How do you make sure they all get Copilot without a ticket each time?
Model answer
Assign seats to the team instead of to people: POST /orgs/contoso/copilot/billing/selected_teams with selected_teams set to web. Anyone added to the team gets a seat, and anyone removed loses it at the end of the cycle.
Architecture & design Design a monthly Copilot licence review for an org with 800 seats.
Model answer
A scheduled workflow calls the seats endpoint, flags seats with no activity in, say, 60 days, and opens an issue listing them for managers to confirm. Confirmed ones are cancelled with DELETE selected_users. The metrics endpoint shows overall usage for the report, and the audit log, searched with action:copilot, proves who changed what.
Quick revision
Key points
- Copilot audit log events start with copilot. Search action:copilot.
- Logged events include seats added or cancelled, policy changes and content exclusion changes.
- GET /orgs/{org}/copilot/billing shows the subscription settings and seat counts.
- GET /orgs/{org}/copilot/billing/seats lists seats with last_activity_at and last_activity_editor.
- POST or DELETE /orgs/{org}/copilot/billing/selected_users (selected_usernames) or /selected_teams (selected_teams) add or cancel seats.
- Token scope manage_billing:copilot. A cancelled seat lasts until the end of the billing cycle.
- /orgs/{org}/copilot/metrics returns usage metrics.
Important terminology
- Audit log
- The organization's record of who did what and when, including Copilot settings, seat and content exclusion changes.
- action:copilot
- The audit log search qualifier that filters the log to Copilot events, whose names start with copilot.
- Copilot user management API
- REST endpoints under /orgs/{org}/copilot/billing to read Copilot settings, list seats and add or cancel seats.
- last_activity_at
- A field on each seat returned by the seats endpoint, showing when the user last used Copilot. Empty if they never have.
- selected_users
- The endpoint that adds seats (POST) or cancels seats (DELETE) for a list of usernames in selected_usernames.
- manage_billing:copilot
- The token scope needed to call the Copilot user management endpoints for an organization.
- Pending cancellation
- The state of a cancelled seat. The user keeps Copilot until the end of the current billing cycle.
Common mistakes
- Expecting a cancelled seat to stop working immediately.
- Using PATCH or PUT for seats. Adding is POST, cancelling is DELETE.
- Looking for Copilot settings changes in the repository's history instead of the organization audit log.
Exam tips
- "Who changed a Copilot policy?" = audit log, search action:copilot.
- "Find inactive seats" = GET .../copilot/billing/seats and last_activity_at.
- "Give a team Copilot by API" = POST .../copilot/billing/selected_teams.
- "Scope for the token" = manage_billing:copilot.
Five quick revision questions
-
1.Which search finds Copilot events in the audit log?Show
action:copilot
-
2.Which field shows when a seat was last used?Show
last_activity_at.
-
3.Which HTTP method cancels seats for users?Show
DELETE on /orgs/{org}/copilot/billing/selected_users.
-
4.When does a cancelled seat stop working?Show
At the end of the current billing cycle.
-
5.Which token scope do the seat endpoints need?Show
manage_billing:copilot.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: How Copilot Handles Your Data
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.