View all connectors

GitHub Copilot Metrics (Enterprise)

By enabling the GitHub Copilot connector, you can import user-level Copilot usage metrics. Please refer to the API documentation below and our schema explorer to see what data DX imports—note that DX does not read or access your source code.

Prerequisites

To connect GitHub Commits to DX, you need:

Setup instructions

Follow the steps below to connect GitHub to DX.

Step 1

While signed into GitHub as an Enterprise Owner, navigate to Settings > Developer Settings > Personal Access Token.

Step 2

Click on Token (classic) > Generate new token (Classic). Either the manage_billing:copilot or read:enterprise scope is required.

Step 3

  • Navigate to the connections page in DX and select “+ Connection” in the top right.
  • Enter the credentials you have generated in the previous steps—refer to the information below for errors and troubleshooting.

API reference

The table below lists the specific API endpoints that are used by DX. Please note that, to access these API endpoint, your Copilot Metrics API access policy must be enabled or set to “no policy” for your enterprise.

Endpoint Reference
/enterprises/{enterprise}/copilot/billing/seats Link
/enterprises/{enterprise}/copilot/metrics Link
/enterprises/{enterprise}/copilot/metrics/reports/users-1-day Link

Errors

The table below lists potential error codes when adding a connection in DX.

Error Description
invalid_credentials Your API credentials entered are not valid.
invalid_permissions Your API token does not have the permissions required by DX—please verify that your service account is an Enterprise Owner.

Curl commands

When connection verification fails

When DX verifies a GitHub Copilot connection, it checks access to seat assignments. If your connection is failing, you can test the endpoints directly using the curl commands below to troubleshoot the issue. Replace YOUR_ENTERPRISE_SLUG with your enterprise slug and YOUR_TOKEN with your Personal Access Token.

1. Test Copilot Seat Assignments Access

This verifies that your token can access Copilot seat assignments:

curl -H 'Accept: application/vnd.github+json' -H 'Authorization: Bearer YOUR_TOKEN' -H 'X-GitHub-Api-Version: 2022-11-28' 'https://api.github.com/enterprises/YOUR_ENTERPRISE_SLUG/copilot/billing/seats'

2. Test Copilot Metrics Access

This verifies that your token can access Copilot metrics:

curl -H 'Accept: application/vnd.github+json' -H 'Authorization: Bearer YOUR_TOKEN' -H 'X-GitHub-Api-Version: 2022-11-28' 'https://api.github.com/enterprises/YOUR_ENTERPRISE_SLUG/copilot/metrics'

3. Test Copilot User 1-Day Usage Metrics Access

This verifies that your token can access daily user-level Copilot usage metrics. Replace YYYY-MM-DD with the date you want to inspect:

curl -H 'Accept: application/vnd.github+json' -H 'Authorization: Bearer YOUR_TOKEN' -H 'X-GitHub-Api-Version: 2022-11-28' 'https://api.github.com/enterprises/YOUR_ENTERPRISE_SLUG/copilot/metrics/reports/users-1-day'

Troubleshooting

I’m seeing “no_resource” error from API response

This indicates that you don’t have admin access to the enterprise account. Use the curl commands above to verify access to the required endpoints.

Copilot has been connected but all of my reports are blank

This indicates that a Copilot metrics API access policy has not yet been enabled for your enterprise.