> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/b/brex.md).

# Brex

Brex is a spend management platform. OctoXLabs reads the users of your Brex account.

## Use cases

* List Brex users by email.

```
Adapters = brex AND Email = *
```

## Before you begin

### Network

| Source              | Destination           | Port | Protocol |
| ------------------- | --------------------- | ---- | -------- |
| OctoXLabs connector | platform.brexapis.com | 443  | HTTPS    |

### Required permissions

| Scope or role | Permission | Needed for |
| ------------- | ---------- | ---------- |
| Users scope   | Read       | Users      |

## Create credentials in Brex

{% stepper %}
{% step %}

### Sign in

Sign in to dashboard.brex.com as an account admin or card admin.
{% endstep %}

{% step %}

### Create a token

Go to **Developer > Settings** and click **Create Token**.
{% endstep %}

{% step %}

### Set name and scope

Choose a clear name and the data access level. Enable the **Users** scope.
{% endstep %}

{% step %}

### Confirm

Review the selections and select **Allow Access**.
{% endstep %}

{% step %}

### Copy the token

Copy the token and store it safely. Brex does not show it again.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter | Required | Type    | Default               | Description                        |
| --------- | -------- | ------- | --------------------- | ---------------------------------- |
| Domain    | Yes      | String  | platform.brexapis.com | API host.                          |
| API Token | Yes      | String  |                       | Sent as a Bearer token.            |
| Timeout   | No       | Integer | 30                    | Seconds to wait for API responses. |

## Troubleshooting

| Error message                                           | Cause                                                                                                                                  | Fix                                                                                                  |
| ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| Failed to fetch users:                                  | The users request did not return 200.                                                                                                  | Check the token and the Users scope.                                                                 |
| Invalid JSON response while fetching users (status=...) | The response is not JSON.                                                                                                              | Check the domain.                                                                                    |
| Request failed after 5 retries for url                  | The API kept answering 429.                                                                                                            | Wait and run the discovery again. The adapter sleeps 60 seconds per retry.                           |
| Status Code: `, URL, Method`                            | The API answered with an unexpected HTTP status. The shared request code raises it and logs the status, URL, method and response body. | Check the URL, the credentials and the permissions listed above, then run the connection test again. |

## Change history

{% hint style="info" %}
Available starting from version 5.6.12.
{% endhint %}
