> For the complete documentation index, see [llms.txt](https://integrations.drivetrain.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://integrations.drivetrain.ai/integration-guide/readme/others/integrating-with-brex.md).

# Integrating with Brex

Sync Brex spend and corporate card data with Drivetrain to track expenses in financial models. Covers authorization, required permissions, and setup.

Drivetrain connects to Brex with a Brex user token. Your Drivetrain team sets up the connection with the token you share.

### Before you start <a href="#prerequisites" id="prerequisites"></a>

* A Brex **account admin** or **card admin** login. Only these roles can create tokens.

### Brex setup <a href="#brex-setup" id="brex-setup"></a>

#### Generate a user token <a href="#generate-a-user-token" id="generate-a-user-token"></a>

1. Log in to your Brex account.
2. Go to **Developer** > **Settings**, then click **Create Token**. Accept the developer agreement if Brex asks.
3. Enter "Drivetrain Integration" as the **Token Name**.
4. Grant **Read** access to every data area below. Drivetrain syncs all of them, and a missing one fails the sync with a missing-scope error:

   * Users (`users.readonly`)
   * Cards (`cards.readonly`)
   * Departments (`departments.readonly`)
   * Expenses (`expenses.card.readonly`)
   * Card transactions (`transactions.card.readonly`)
   * Vendors (`vendors.readonly`)

   <figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2Fgit-blob-3203f327ecc5d45e564b63a15e2a5c6279c202f2%2Fbrex-create-api-token-drivetrain.png?alt=media" alt=""><figcaption></figcaption></figure>
5. Click **Create Token**, then **Allow Access**.<br>

   <figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2Fgit-blob-55232f3bdd53e13a33db1667706aaf5133065843%2Fbrex-drivetrain-allow-access.png?alt=media" alt=""><figcaption></figcaption></figure>
6. Copy the token and store it securely. Brex won't show it again.

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2Fgit-blob-4255ab68064680779729b8849baecf1da1451b2b%2Fbrex-token-drivetrain.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Share the token with your customer success manager through a secure channel. They set up the connection.
{% endhint %}

### What data comes in

Six tables: users, cards, departments, expenses, card account transactions and vendors. Each sync reloads them in full.

### Keep the connection working

* Brex expires a token that isn't used for 90 days, and tokens of deactivated users stop working. Create the token as a user who will stay active.
* If you change the token's access or create a new one, send the new token to your customer success manager.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://integrations.drivetrain.ai/integration-guide/readme/others/integrating-with-brex.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
