> ## Documentation Index
> Fetch the complete documentation index at: https://docs.optimazehq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub

> Connect GitHub with a billing-read token so OPTIMAZE can import metered usage and cost.

Connect GitHub to OPTIMAZE with a personal access token (classic) that can read billing. OPTIMAZE imports metered usage and cost for one organisation or one enterprise. A GitHub App is not required.

> [!NOTE]
>
> GitHub is in beta. The tile on the **Integrations** page is marked **Beta**.

## Prerequisites

* A GitHub user who is an organisation owner or billing manager, or an enterprise owner or billing manager for an enterprise.

## Set up the GitHub integration

**1. Create a billing-read token in GitHub**

1. Sign in as an organisation owner or billing manager, or an enterprise owner or billing manager.
2. In **Developer settings**, create a personal access token (classic). Fine-grained tokens cannot read billing usage.
3. Copy the organisation or enterprise slug from the GitHub URL.

**2. Enter the details in OPTIMAZE**

Under **Data**, select **Integrations**. On the **GitHub** tile, select **Connect**, then fill in the form.

| Field | What to enter |
| :- | :- |
| **Personal access token (classic)** | The classic token you created |
| **Organisation slug (optional)** | The organisation to import. Enter this or **Enterprise slug**, not both |
| **Enterprise slug (optional)** | The enterprise to import. Enter this or **Organisation slug**, not both |
| **Display name (optional)** | A name to tell this connection apart from others |

**3. Connect**

Select **Connect**.

## What happens next

When you select **Connect**, OPTIMAZE runs a connection check before it starts importing. Each part of the check shows as passed, failed or not checked, and a later part is not checked when an earlier one fails.

| Check | What it confirms |
| :- | :- |
| **Authentication** | The credentials were accepted |
| **Access** | The credentials can read billing and usage data |
| **Required objects** | Anything you had to create in your own account exists. Not checked for providers that need nothing beyond credentials |
| **Data available** | There is cost data to import |

Once the check passes, the integration appears under **Connected** on the **Integrations** page. OPTIMAZE imports the previous six months of history on the first sync, and each later sync re-reads the last three days to pick up late changes.

## Troubleshooting

* **Authentication** fails: the token is wrong, revoked or expired, or is a fine-grained token. Use a classic token.
* **Access** fails: the token's user is not an owner or billing manager of the organisation or enterprise you entered.
* **Both slugs are filled in**: enter the organisation slug or the enterprise slug, not both.
* **Data available** fails: GitHub has no cost data for the period yet. Wait for GitHub to report usage, then connect again.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.