GitHub Copilot Billing
By enabling the GitHub Copilot Billing connector, you can import GitHub’s usage-based billing data for Copilot. 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.
DX only imports Copilot billing rows (the copilot product) from the GitHub billing usage report; other products such as Actions, Packages, and Git LFS are ignored. The connector supports both enterprise-level and organization-level (non-enterprise) billing, depending on the authentication method you choose.
All data is imported into the github_copilot_billing_usages table. Enterprise data is identified by enterprise_slug; org-level data is identified by organization_id.
Authentication methods
The GitHub Copilot Billing connector supports two authentication methods:
- Personal Access Token (PAT): Provides access to the enterprise billing usage report. Enterprise only.
- GitHub App (Organization): Provides access to the organization billing usage report. For non-enterprise customers or org-level data.
Enterprise billing can only be read with a PAT—GitHub Apps cannot access enterprise billing. For organization-level billing, DX iterates over your GitHub App installations and pulls the usage report per organization using GET /organizations/{org}/settings/billing/usage.
Prerequisites
For enterprise-level connections (PAT):
- a GitHub user account that is an Enterprise Owner or billing manager
- allowlist DX IP addresses if your GitHub instance is behind a firewall or has IP restrictions. IP allowlisting must be configured at the enterprise level, not just the org-level, to avoid
internal_errorconnection issues.
For organization-level connections (GitHub App):
- a GitHub user account that is an Organization owner or billing manager
- the organization must have access to the enhanced billing platform
- allowlist DX IP addresses if your GitHub instance is behind a firewall or has IP restrictions
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 the enterprise billing usage report.
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). The manage_billing:enterprise scope is required.
Step 3
- Navigate to the connections page in DX and select “+ Connection” in the top right.
- Choose GitHub Copilot Billing, select the Enterprise connection type, and enter your enterprise slug and the token you generated—refer to the information below for errors and troubleshooting.
Option 2: GitHub App non-enterprise
This method is for organizations that do not use GitHub Enterprise. It provides access to the org-level billing usage report. Follow the full GitHub App registration and installation process.
Step 1
Browse to the URL below with ORGANIZATION_NAME replaced:
https://github.com/organizations/ORGANIZATION_NAME/settings/apps/new?public=false&url=https://getdx.com&request_oauth_on_install=false&setup_on_update=false&webhook_active=false
Step 2
This will pre-populate settings. Enter a name for your GitHub App (e.g. [COMPANYNAME] DX - GitHub Copilot Billing). In the Permissions & events tab, set the following permission:
| Scope | Permission | Description |
|---|---|---|
| Organization | Administration | Read-only (required) |
See GitHub’s billing usage documentation for details.
Step 3
Scroll to the bottom of the page and click Create GitHub App.
Step 4
The GitHub App ID will be shown at the top of the subsequent screen. Copy this ID for use in DX later.

Step 5
On the same screen, scroll down to Private keys and click Generate a private key to download a PEM file. Copy the contents of this file for use in DX later.

Step 6
Click Install App in the sidebar, then click Install beside each organization where you want Copilot billing data. No enterprise installation is required.

Step 7
Navigate to the connections page in DX and select “+ Connection” in the top right. Choose GitHub Copilot Billing, select the Organization connection type, and enter your App ID and private key.
API reference
The table below lists the specific API endpoints that are used by DX.
| Endpoint | Reference |
|---|---|
| /enterprises/{enterprise}/settings/billing/usage | Link (PAT only, enterprise) |
| /organizations/{org}/settings/billing/usage | Link (GitHub App, org-level only) |
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 or GitHub App does not have the permissions required by DX. For enterprise: verify your service account is an Enterprise Owner or billing manager and that your token has the manage_billing:enterprise scope. For org-level: verify your GitHub App has Organization: Administration (read) and is installed to the organization. |
Curl commands
When connection verification fails
When DX verifies a GitHub Copilot Billing connection, it checks access to the relevant endpoint. If your connection is failing, you can test the endpoints directly using the curl commands below to troubleshoot the issue. Replace YYYY, MM, and DD with the date you want to inspect.
Enterprise (PAT): Replace YOUR_ENTERPRISE_SLUG with your enterprise slug and YOUR_TOKEN with your Personal Access Token.
Org-level (GitHub App): Replace YOUR_ORG with your organization login and YOUR_INSTALLATION_TOKEN with an installation access token from your GitHub App.
1. Test Enterprise Billing Usage Access (enterprise PAT only)
This verifies that your token can access the enterprise billing usage report:
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/settings/billing/usage?year=YYYY&month=MM&day=DD'
2. Test Organization Billing Usage Access (org-level)
For org-level connections, test the organization API. Replace YOUR_ORG with your organization login and YOUR_INSTALLATION_TOKEN with an installation access token:
curl -H 'Accept: application/vnd.github+json' -H 'Authorization: Bearer YOUR_INSTALLATION_TOKEN' -H 'X-GitHub-Api-Version: 2022-11-28' 'https://api.github.com/organizations/YOUR_ORG/settings/billing/usage?year=YYYY&month=MM&day=DD'
Troubleshooting
I’m seeing “no_resource” error from API response
This indicates that you don’t have billing access to the enterprise or organization account. Use the curl commands above to verify access to the required endpoints.
Billing has been connected but my data is incomplete for the current day
GitHub’s billing usage totals for the current day are still accumulating, so org/enterprise-level values can lag until the day finalizes. DX re-fetches a recent window on each run, so these values update on subsequent imports.