GitHub Copilot REST API via curl. Use this skill to manage Copilot subscriptions and retrieve usage metrics.
If requests fail, run okou doctor check-connector --env-name GITHUB_TOKEN or okou doctor check-connector --url https://api.github.com/orgs/your-org/copilot/billing --method GET
All examples below assume you have GITHUB_TOKEN set.
Base URL: https://api.github.com
Required headers:
Authorization: Bearer ${GITHUB_TOKEN}Accept: application/vnd.github+jsonX-GitHub-Api-Version: 2022-11-28Get seat breakdown and settings for an organization. Replace your-org-name with your organization name:
curl -s -X GET "https://api.github.com/orgs/your-org-name/copilot/billing" --header "Authorization: Bearer $GITHUB_TOKEN" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"
Response:
{
"seat_breakdown": {
"total": 12,
"added_this_cycle": 2,
"pending_cancellation": 0,
"pending_invitation": 1,
"active_this_cycle": 12,
"inactive_this_cycle": 0
},
"seat_management_setting": "assign_selected",
"public_code_suggestions": "block"
}
Get all users with Copilot seats. Replace your-org-name with your organization name:
curl -s -X GET "https://api.github.com/orgs/your-org-name/copilot/billing/seats?per_page=50" --header "Authorization: Bearer $GITHUB_TOKEN" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" | jq '.seats[] | {login: .assignee.login, last_activity: .last_activity_at}'
Get specific user's Copilot seat information. Replace your-org-name with your organization name and username with the target username:
curl -s -X GET "https://api.github.com/orgs/your-org-name/members/username/copilot" --header "Authorization: Bearer $GITHUB_TOKEN" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"
Assign Copilot seats to specific users. Replace your-org-name with your organization name:
Write to /tmp/github_copilot_request.json:
{
"selected_usernames": ["user1", "user2"]
}
Then run:
curl -s -X POST "https://api.github.com/orgs/your-org-name/copilot/billing/selected_users" --header "Authorization: Bearer $GITHUB_TOKEN" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json
Response:
{
"seats_created": 2
}
Remove Copilot seats from specific users. Replace your-org-name with your organization name:
Write to /tmp/github_copilot_request.json:
{
"selected_usernames": ["user1", "user2"]
}
Then run:
curl -s -X DELETE "https://api.github.com/orgs/your-org-name/copilot/billing/selected_users" --header "Authorization: Bearer $GITHUB_TOKEN" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json
Response:
{
"seats_cancelled": 2
}
Assign Copilot to entire teams. Replace your-org-name with your organization name:
Write to /tmp/github_copilot_request.json:
{
"selected_teams": ["engineering", "design"]
}
Then run:
curl -s -X POST "https://api.github.com/orgs/your-org-name/copilot/billing/selected_teams" --header "Authorization: Bearer $GITHUB_TOKEN" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json
Remove Copilot from teams. Replace your-org-name with your organization name:
Write to /tmp/github_copilot_request.json:
{
"selected_teams": ["engineering"]
}
Then run:
curl -s -X DELETE "https://api.github.com/orgs/your-org-name/copilot/billing/selected_teams" --header "Authorization: Bearer $GITHUB_TOKEN" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json
Get usage statistics (requires 5+ active users). Replace your-org-name with your organization name:
curl -s -X GET "https://api.github.com/orgs/your-org-name/copilot/metrics?per_page=7" --header "Authorization: Bearer $GITHUB_TOKEN" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" | jq '.[] | {date, total_active_users, total_engaged_users}'
Response:
{
"date": "2024-06-24",
"total_active_users": 24,
"total_engaged_users": 20
}
Get team-specific usage metrics. Replace your-org-name with your organization name and team-name with the target team:
curl -s -X GET "https://api.github.com/orgs/your-org-name/team/team-name/copilot/metrics" --header "Authorization: Bearer $GITHUB_TOKEN" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"
The metrics response includes:
| Field | Description |
|-------|-------------|
| total_active_users | Users with Copilot activity |
| total_engaged_users | Users who accepted suggestions |
| copilot_ide_code_completions | Code completion stats by language/editor |
| copilot_ide_chat | IDE chat usage stats |
| copilot_dotcom_chat | GitHub.com chat usage |
| copilot_dotcom_pull_requests | PR summary usage |
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer