# Github Copilot

Follow these steps to enable Copilot Metrics API access and generate a Personal Access Token (PAT) for integration.

***

#### Prerequisites - Before You Begin

* You must be an **organization owner** (or enterprise owner/billing manager if your org is part of an enterprise).
* **Copilot Metrics API access policy** must be enabled for your organization.
  * If it is not enabled, API calls for Copilot metrics will return a `422` error. [*Refer here*](https://docs.github.com/en/rest/copilot/copilot-metrics?apiVersion=2022-11-28)

***

#### Step 1: Enable Copilot Metrics API Access

1. Navigate to your **organization** or **enterprise settings**.
2. Locate the **Copilot** or **Copilot Metrics policy**.
3. Ensure that **API access** is set to **Enabled** (or left as *No policy*).

***

#### Step 2: Generate a Personal Access Token (Classic)

1. Log into GitHub with your **admin account**.
2. Click your **profile avatar** (upper-right) → **Settings**.
3. In the left sidebar, open **Developer settings** → **Tokens (classic)**.
4. Click **Generate new token (classic)**.
   * Add a descriptive note (e.g., *“Typo Copilot Metrics Access”*).
   * Set an expiration (recommended for security).
5. Select the following scopes:
   * `manage_billing:copilot` → required for Copilot metrics access
   * `read:org` → required to read organization members
6. Click **Generate token**.
7. Copy and **securely store** the token immediately - you won’t be able to see it again.
