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.

Authentication methods

The GitHub Copilot connector supports two authentication methods:

  • Personal Access Token (PAT): Provides access to enterprise-level metrics, user-level metrics, and Copilot seat assignments
  • GitHub App Installation: Provides access to user-level metrics only (via the users-1-day API)

Both authentication methods import data into the same github_copilot_daily_usages table.

Note: The Copilot seat assignments API is optional, as active users can be determined from the users-1-day metrics. This is why GitHub App authentication, which only accesses the users-1-day endpoint, provides complete user-level usage data without requiring the seat assignments API.

GitHub App installation requirements

If you choose to use GitHub App authentication:

  • The GitHub App must be installed at the enterprise level (not organization level)
  • The app requires enterprise_copilot_metrics: read permission
  • Note that the enterprise-level metrics API and seat assignments API do not support GitHub App installation tokens, so only user-level daily metrics will be available

Prerequisites

To connect GitHub Copilot to DX, you need:

Setup instructions

Follow the steps below to connect GitHub to DX using your preferred authentication method.

Option 1: Personal Access Token (PAT)

This method provides access to all available Copilot metrics APIs.

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.

Option 2: GitHub App Installation

This method provides access to user-level metrics only.

Step 1

Create a GitHub App at the enterprise level with the following permission:

  • enterprise_copilot_metrics: read

Step 2

Install the GitHub App at the enterprise level. The installation must be at the enterprise level (not organization level) to access Copilot metrics.

Step 3

  • Navigate to the connections page in DX and select “+ Connection” in the top right.
  • Select GitHub App authentication and enter your installation credentials.

API reference

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

Note: When using GitHub App authentication, only the users-1-day endpoint is accessible. The enterprise-level metrics and seat assignments endpoints are only available with Personal Access Token authentication.

Endpoint Reference
/enterprises/{enterprise}/copilot/billing/seats Link (PAT only, optional)
/enterprises/{enterprise}/copilot/metrics Link (PAT only)
/enterprises/{enterprise}/copilot/metrics/reports/users-1-day Link (PAT and GitHub App)

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.