Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Brex

Scalekit connector
Open markdown

The Brex connector lets your AI agent act in each user's Brex account. Each user signs in to Brex once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 68 tools.

Tools
68
What they doRead · write · destructive
45 · 23 · 045 read23 write0 destructive
Users sign in with
OAuth app
Your own Brex app

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Brex connection

    In AgentKit > Connections, create a Brex connection and copy its redirect URI. The name you give it is the connection_name your code passes. See Configure connections.

  4. Register an OAuth app

    Brex connections use your own OAuth app. Register one with Brex and add the redirect URI you copied.

    Then enter the app's Client ID and Client Secret on the Brex connection.

  5. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'brex'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Brex:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'brex_current_user_get',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user signs in once. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • brex_budget_getGet one Brex budget by ID.Read-only

    Get Budget

    Get one Brex budget by ID. Returns its name, description, parent budget, owners, period, start and end dates, amount, status and limit type. Use this for a known budget. Use brex_budget_list to find IDs. Requires a budget ID from brex_budget_list.

    Inputs

    budget_idstringrequired
    ID of the budget. Get it from brex_budget_list. Example: budget_cl9rh1n8g001e0j84w6fb4fd1.
  • brex_budget_listList Brex budgets on the account.Read-only

    List Budgets

    List Brex budgets on the account. Returns a page of budgets with budget ID, name, description, parent budget, owners, period, start and end dates, amount, status and limit type, plus next_cursor. Use this to find a budget ID or review budgets. Use brex_spend_limit_list for spend limits that control card authorizations, and brex_budget_get for one budget.

    Inputs

    cursorstring
    Pagination cursor for the budget list. Pass the next_cursor value from the previous response to fetch the next page; omit it to start from the first page. A null next_cursor in a response means there are no more pages. Example: dXNlcl9jdXJzb3JfMTIz.
    limitinteger
    Maximum number of budgets to return in one page. Leave empty to use the Brex default page size. Example: 50.
  • brex_budget_program_getGet one Brex budget program by ID.Read-only

    Get Budget Program

    Get one Brex budget program by ID. Returns its name, description, budget blueprints, existing budget IDs, employee filter, status, creator and timestamps. Use this for a known budget program. Use brex_budget_program_list to find IDs. Requires a budget program ID from brex_budget_program_list.

    Inputs

    budget_program_idstringrequired
    ID of the budget program. Get it from brex_budget_program_list. Example: bprog_cl9rh1n8g001e0j84w6fb4fd1.
  • brex_budget_program_listList Brex budget programs, which create budgets automatically for employees who match a filter.Read-only

    List Budget Programs

    List Brex budget programs, which create budgets automatically for employees who match a filter. Returns a page of budget programs with ID, name, description, budget blueprints, existing budget IDs, employee filter, status and creator, plus next_cursor. Use this to see how per-employee budgets are provisioned. Use brex_budget_list for the budgets themselves.

    Inputs

    cursorstring
    Pagination cursor for the budget program list. Pass the next_cursor value from the previous response to fetch the next page; omit it to start from the first page. A null next_cursor in a response means there are no more pages. Example: dXNlcl9jdXJzb3JfMTIz.
    limitinteger
    Maximum number of budget programs to return in one page. Leave empty to use the Brex default page size. Example: 50.
  • brex_card_account_listList the Brex card accounts on the account.Read-only

    List Card Accounts

    List the Brex card accounts on the account. Returns each card account with its ID, status, current balance, available balance, account limit and statement period. Use this to check card balances and limits. Use brex_cash_account_list for Brex business (cash) accounts.

    Inputs

    This tool takes no inputs.

  • brex_card_getGet one Brex card by ID.Read-only

    Get Card

    Get one Brex card by ID. Returns the card's owner, status, last four digits, name, card type, limit type, spend controls (vendor cards only), billing and mailing addresses, expiration date, budget ID and metadata. Use this for the details of a known card. Use brex_card_list to find card IDs. Requires a card ID from brex_card_list.

    Inputs

    card_idstringrequired
    ID of the card. Get it from brex_card_list (or the response of brex_card_create). Example: card_cl9rh1n8g001e0j84w6fb4fd1.
  • brex_card_listList Brex cards, optionally only the cards owned by one user.Read-only

    List Cards

    List Brex cards, optionally only the cards owned by one user. Returns a page of cards with id, owner, status, last four digits, card name and type, limit type, spend controls (vendor cards only), addresses, expiration date and metadata, plus next_cursor for paging. Use this to find a card ID or review a user's cards. Use brex_card_get for one known card.

    Inputs

    cursorstring
    Pagination cursor for the card list. Pass the next_cursor value from the previous response to fetch the next page; omit it to start from the first page. A null next_cursor in a response means there are no more pages. Example: dXNlcl9jdXJzb3JfMTIz.
    limitinteger
    Maximum number of cards to return in one page. Leave empty to use the Brex default page size. Example: 50.
    user_idstring
    Only return cards owned by this Brex user. Leave empty to list cards across the account. Get user IDs from brex_user_list or brex_current_user_get. Example: cuuser_cky0xs54b004h01pidi0pcuz1.
  • brex_card_statement_listList finalized statements for the primary Brex card account.Read-only

    List Card Statements

    List finalized statements for the primary Brex card account. Returns a page of statements with ID, start and end balances, and statement period, plus next_cursor. Use this for monthly card statement totals. Use brex_cash_statement_list for cash account statements.

    Inputs

    cursorstring
    Pagination cursor for the statement list. Pass the next_cursor value from the previous response to fetch the next page; omit it to start from the first page. A null next_cursor in a response means there are no more pages. Example: dXNlcl9jdXJzb3JfMTIz.
    limitinteger
    Maximum number of statements to return in one page. Leave empty to use the Brex default page size. Example: 50.