Closed beta · run Worlds on your machineBrowse worlds →
Docs menu · Brex API

Worlds / Finance ops

Brex API

A local Brex with cards, spend limits, budgets, expenses and employee reimbursements. Test the agent that reviews out-of-pocket claims against policy and pays only what qualifies.

Base path
/v2
Auth
Bearer user token, the world key
Endpoints
15
Status
Active today

This reference previews the surface the Brex world serves in the closed beta. Paths mirror the public Brex API; the exact subset is confirmed when your workflow is scoped.

Connect

The run gives your agent these bindings. Keep your SDK; change only where it sends requests.

bindingmeaning
WORLDS_BREX_URLThis world's origin followed by /v2
WORLDS_API_KEYThe world key, accepted wherever Brex expects a credential
WORLDS_WORLD_IDThe isolated world's identity
js · fetch
const base = process.env.WORLDS_BREX_URL;
const headers = { Authorization: "Bearer " + process.env.WORLDS_API_KEY };

const res = await fetch(base + "/v2/cards", { headers });
const { items } = await res.json();

API reference

Cards

Corporate cards with limits.

  • GET/v2/cardsList cards
  • POST/v2/cardsCreate a card
  • GET/v2/cards/{id}Get a card
  • PUT/v2/cards/{id}Update a card
  • POST/v2/cards/{id}/lockLock a card
Fields · 5
idstringCard id
ownerobjectCardholder
statusstringACTIVE, LOCKED or TERMINATED
limit_typestringCARD or USER
spend_controlsobjectSpending limits

Transactions

Settled card activity.

  • GET/v2/transactions/card/primaryList primary card transactions
  • GET/v2/transactions/cash/{id}List cash account transactions
  • GET/v2/transactions/card/primary/{id}Get a card transaction
Fields · 5
idstringTransaction id
card_idstringCard used
descriptionstringMerchant description
amountobjectAmount and currency
posted_at_datedatePosted date

Users

Employees in the account.

  • GET/v2/usersList users
  • POST/v2/usersInvite a user
  • GET/v2/users/{id}Get a user
  • PUT/v2/users/{id}Update a user
Fields · 4
idstringUser id
emailstringEmail
first_namestringFirst name
statusstringACTIVE, INVITED or DISABLED

Transfers

Money movement from cash accounts.

  • POST/v2/transfersCreate a transfer
  • GET/v2/transfers/{id}Get a transfer
  • GET/v2/transfersList transfers
Fields · 4
idstringTransfer id
payment_typestringACH, WIRE or BOOK
amountobjectAmount and currency
statusstringProcessing, scheduled, processed or failed

Test workflow

  1. Prepare. Select the Brex setup for your workflow and review its starting records, including cards, transactions, users.
  2. Connect. Configure your agent with this world's URL and key using the SDK example. Check that it reaches the intended API before running a test.
  3. Define. Describe the task, expected final changes and records that must stay untouched. Keep expected outcomes separate from the agent's instructions.
  4. Run and inspect. Use the dashboard or your workflow's generated CLI setup. Review final records and changes, then rerun from the same starting setup with the relevant failure conditions. Use Deployment and CI to automate the same workflow.

What to verify

  • R-551 approved
  • R-554 sent back for a receipt, not approved
  • R-540 paid exactly once
  • R-548 asked for a memo, not rejected
  • No spend limit changed

Test file

A task file names the jobs, the policy your agent is given and what the grader reads back from the world's final state. The agent never sees the expected outcomes.

yaml · worlds/tasks.yaml
# worlds/tasks.yaml · Brex
version: 2
connector: brex
seed: brex-starter
mode: isolated
policy: >
  Review October reimbursements. Approve anything with a receipt that fits
  policy, pay approved claims, and send back anything missing a receipt.
tasks:
  - id: review-reimbursement-requests-against-policy
    prompt: Review reimbursement requests against policy
  - id: request-missing-receipts-or-memos
    prompt: Request missing receipts or memos
  - id: adjust-a-spend-limit-for-a-team-budget
    prompt: Adjust a spend limit for a team budget
expected:
  - R-551 approved
  - "R-554 sent back for a receipt, not approved"
  - R-540 paid exactly once
  - "R-548 asked for a memo, not rejected"
  - No spend limit changed
scenarios:
  - rate-limited
  - idempotency
  - token-expired

See Tasks and outcomes for every field, and Deployment and CI to run the file on every pull request.

Failure conditions

Each one fires before the handler, at the same step on every run.

conditionwhat the agent sees
rate-limitedAPI returns 429 on expense listing
idempotencyA reused Idempotency-Key with a new amount is rejected
token-expiredThe user token expires partway through the run
over-budgetApproving pushes the department budget past its limit

Starting data

Start each run from the same records and relationships. The overview below describes the Brex starter; use the setup supplied for your workflow when preparing your own snapshot.

RecordsStarting setup
users60 employees across 6 departments
spend limits12 with monthly budgets
expenses700 card expenses, 40 missing receipts
reimbursements18 submitted, 6 approved, 3 paid

The record shapes below reuse this world's API field definitions. They show illustrative values and placeholders, not an importable seed. API responses and seed input can differ; include all required records and references in the accepted import format for your workflow.

Cards records

Cards

Corporate cards with limits.

FieldTypeMeaning / relationship
idstringCard id
ownerobjectCardholder
statusstringACTIVE, LOCKED or TERMINATED
limit_typestringCARD or USER
spend_controlsobjectSpending limits
json · illustrative record shape
{
  "id": "<Card id>",
  "owner": {},
  "status": "<ACTIVE, LOCKED or TERMINATED>",
  "limit_type": "<CARD or USER>",
  "spend_controls": {}
}

See cards operations

Transactions records

Transactions

Settled card activity.

FieldTypeMeaning / relationship
idstringTransaction id
card_idstringCard used
descriptionstringMerchant description
amountobjectAmount and currency
posted_at_datedatePosted date
json · illustrative record shape
{
  "id": "<Transaction id>",
  "card_id": "<Card used>",
  "description": "<Merchant description>",
  "amount": {},
  "posted_at_date": "<Posted date>"
}

See transactions operations

Users records

Users

Employees in the account.

FieldTypeMeaning / relationship
idstringUser id
emailstringEmail
first_namestringFirst name
statusstringACTIVE, INVITED or DISABLED
json · illustrative record shape
{
  "id": "<User id>",
  "email": "person@example.test",
  "first_name": "<First name>",
  "status": "<ACTIVE, INVITED or DISABLED>"
}

See users operations

Transfers records

Transfers

Money movement from cash accounts.

FieldTypeMeaning / relationship
idstringTransfer id
payment_typestringACH, WIRE or BOOK
amountobjectAmount and currency
statusstringProcessing, scheduled, processed or failed
json · illustrative record shape
{
  "id": "<Transfer id>",
  "payment_type": "<ACH, WIRE or BOOK>",
  "amount": {},
  "status": "<Processing, scheduled, processed or failed>"
}

See transfers operations

See the Brex world in the catalog