Quickstart

This guide will help you get up and running making your first Brex API call in just a few minutes. You will create a user token and make your first call against the Brex Team API to see the current user associated with that access token.

This guide assumes you are a Brex customer with admin access to your dashboard.

1. Generate your user token

First, you'll need to create a user token that let's you access the APIs.

  1. Go to Settings > Developer . You'll have to login as an account admin if you haven't already.
  2. Click Create Token .
  3. Create a name for your token such as Team API Quickstart . Next to "Users" select the "Read" option and then hit Create Token .
  4. The next screen will confirm your previous selections. Select Allow access .
  5. Your token is now created! Copy and store the token securely. You won't be able to see it again and you'll need it in the next step.

For more details, see the user authentication guide.

2. Make your first API Call

With your user token, you can now make an API call. For this example, we'll query the Get current user endpoint that returns the user associated with the user token.

To do so, add the header Authorization: Bearer <YOUR_TOKEN_FROM_STEP_1_HERE> and make a GET request to https://platform.brexapis.com/v2/users/me with your language/tool of choice.

Below are a few examples in different implementations.

curl

Copy
Copied
curl -i -X GET \
  https://platform.brexapis.com/v2/users/me \
  -H 'Authorization: Bearer <YOUR_TOKEN_FROM_STEP_1_HERE>'

Javascript

Copy
Copied
const resp = await fetch(
  `https://platform.brexapis.com/v2/users/me`,
  {
    method: 'GET',
    headers: {
      Authorization: 'Bearer <YOUR_TOKEN_FROM_STEP_1_HERE>'
    }
  }
);

const data = await resp.text();
console.log(data);

Postman

Postman is a browser or desktop app used for API testing. It gives you a UI to easily test API calls without writing code. See our Postman guide on how to get set up and start making a call.

Next steps

Congratulations, you've made your first Brex API request! You're ready to dive deeper.

Reading through the rest of the guides will familiarize you with important Brex API conventions and implementation concerns. The API references will give you a better understanding of what functionality is included in each API and whether they will meet the needs of your use case. If you need help, see our support page. Happy developing!

Copyright © Brex 2019–2022. All rights reserved.