# Integrating with Chargebee

[Prerequisites](#prerequisites)

[Chargebee Setup](#chargebee-setup)\
&#x20;  [Create an API key](#create-an-api-key)\
&#x20;  [Find Subdomain](#find-subdomain)

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

To connect Chargebee to Drivetrain, you need:

* An active Chargebee account
* Admin privileges on Chargebee

### Chargebee Setup <a href="#chargebee-setup" id="chargebee-setup"></a>

#### Create an API key <a href="#create-an-api-key" id="create-an-api-key"></a>

1. Login to your [Chargebee account](https://app.chargebee.com/login)
2. Navigate to **Settings > Configure Chargebee**

<figure><img src="/files/iub3kgO8cOPi3VJA3cLm" alt=""><figcaption></figcaption></figure>

3. Scroll down to the **API Keys and Webhooks** section and Click **API Keys** tab

<figure><img src="/files/ykiYeIrtnu1eudh48vkx" alt=""><figcaption></figcaption></figure>

4. Click **Add API Key** to create a new API key

<figure><img src="/files/5TaBLl4l8NNMJ0uil6XY" alt=""><figcaption></figcaption></figure>

5. Select **Read-only Key**.
6. Select **All** and enter name as "**Drivetrain Integration**" for the API key, then click **Create Key**.

<figure><img src="/files/OliTll44qxkUxUykLDxv" alt=""><figcaption></figcaption></figure>

7. Find the API key you just created on the next page and make a note of it in a secure document

#### Find Subdomain <a href="#find-subdomain" id="find-subdomain"></a>

Find your account's subdomain in your Chargebee URL and make a note of it. For example, if your Chargebee URL is `https://drivetrain-test.chargebee.com`, then your subdomain is `drivetrain-test`.

{% hint style="info" %}
That’s it! Share the API key and Subdomain with your customer success manager or data integrations manager so that they can get started!
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://integrations.drivetrain.ai/integration-guide/integrate-with-drivetrain/billing-and-invoicing/integrating-with-chargebee.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
