CONNECT APP
Build with Brex
Business Management
- OAuth
MCP
Give your agent Brex tools
Every Brex action is exposed as an MCP tool on Pipedream's remote server. Point a client at it with your end user's ID and Connect resolves that user's Brex account for each tool call — you store no tokens.
// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "brex",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// e.g. run Cancel Card:
const result = await mcp.callTool({
name: "brex-cancel-card",
arguments: {
cardId: "Card ID",
reason: "Reason",
},
})# access_token: mint a short-lived token with the Connect SDK — see the MCP guide
headers = {
"Authorization": f"Bearer {access_token}",
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", # any stable ID for this user in your system
"x-pd-app-slug": "brex",
}
async with streamablehttp_client("https://remote.mcp.pipedream.net/v3", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
# e.g. run Cancel Card:
result = await session.call_tool("brex-cancel-card", {
"cardId": "Card ID",
"reason": "Reason",
})API PROXY
Call the Brex API directly
For an endpoint with no pre-built tool, the Connect proxy forwards your request to the Brex API with the connected user's credentials attached. You store no tokens and write no refresh logic.
const resp = await pd.proxy.get({
externalUserId: "{external_user_id}", // any stable ID for this user in your system
accountId: "apn_xxxxxxx",
url: "https://platform.brexapis.com/v2/cards",
})
// Any allowed Brex endpoint works here. Pipedream attaches the
// connected account's credentials to the outgoing request.# The path segment is the target URL, URL-safe base64 encoded:
# https://platform.brexapis.com/v2/cards
curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9wbGF0Zm9ybS5icmV4YXBpcy5jb20vdjIvY2FyZHM?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
-H "Authorization: Bearer {access_token}" \
-H "x-pd-environment: production"SDK
Run Brex actions from your backend
Connect a user's Brex account once, then run Cancel Card on their behalf from your own code — TypeScript, Python, or plain HTTP.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "brex-cancel-card",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
brex: { authProvisionId: "apn_xxxxxxx" },
cardId: "Card ID",
reason: "Reason",
},
})from pipedream import Pipedream
pd = Pipedream(
client_id="{oauth_client_id}",
client_secret="{oauth_client_secret}",
project_id="{project_id}",
project_environment="production",
)
result = pd.actions.run(
id="brex-cancel-card",
external_user_id="{external_user_id}", # any stable ID for this user in your system
configured_props={
"brex": {"authProvisionId": "apn_xxxxxxx"},
"cardId": "Card ID",
"reason": "Reason",
},
)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "brex-cancel-card",
"configured_props": {
"brex": { "authProvisionId": "apn_xxxxxxx" },
"cardId": "Card ID",
"reason": "Reason"
}
}'TOOLS
Brex actions
On-demand operations your product or agent can configure and run on behalf of a connected user.
-
Cancel Card
actionCancels (terminates) a card permanently. This cannot be undone — use Freeze Card to block a card temporarily instead. See the documentationWritev0.0.1 -
Create Card
actionIssues a new virtual card to a Brex user. Physical cards are not supported — Brex requires a mailing address to ship one and this action does not collect it. A vendor card (Limit Type=CARD) carries its own spend limit set here; a corporate card (Limit Type=USER) draws on the cardholder's monthly limit instead, which Set Limit for User controls. Use List Users to find the cardholder. The returned card ID is what Get Card, Freeze Card, Cancel Card, and Update Card Limit take. See the documentationWritev0.1.3 -
Freeze Card
actionFreezes (locks) a card so it declines new purchases. Reversible with Unfreeze Card. See the documentationWritev0.0.1 -
Get Card
actionRetrieves one card by ID, including its status, last four digits, and — for vendor cards — its spend limit and remaining available balance. Corporate cards returnspend_controls: nullbecause they draw on the cardholder's limit, which Get User Limit reports. See the documentationRead-onlyv0.0.1 -
Get Expense
actionRetrieves one expense and its receipts. Receipt download links expire 15 minutes after the response, so download rather than store them. Use Search Expenses to find an expense ID. See the documentationRead-onlyv0.0.1 -
Get User
actionRetrieves one person in the Brex account, including their status, manager, department, location, and title. Use List Users to find a user ID by email address. See the documentationRead-onlyv0.0.3 -
Get User Limit
actionRetrieves a person's monthly spend limit and how much of it is still available. Change it with Set Limit for User. See the documentationRead-onlyv0.0.3 -
Invite User
actionInvites a person to the Brex account as an employee, emailing them to finish onboarding. Returns the new Brex user ID, which Create Card, Set Limit for User, and Get User take. See the documentationWritev0.1.3 -
List Card Accounts
actionLists the Brex card accounts, each with its current balance, available balance, account limit, and current statement period. These are account-level limits, not a single card's — use Get Card for that. Results are capped atmaxResults(default100) — check$summaryfor a truncation notice and raisemaxResultsif it's truncated. See the documentationRead-onlyv0.0.1 -
List Cards
actionLists the cards in the Brex account, each with its status, last four digits, cardholder, and spend limit. Filter by cardholder (userId) or status (ACTIVE,SHIPPED,LOCKED,TERMINATED) — status has no server-side filter, so it's applied after fetching, which can leave results truncated before every match is scanned; raisemaxResults(default100) or drop the status filter if that happens. This is how you find the card ID that Get Card, Freeze Card, Cancel Card, and Update Card Limit require. See the documentationRead-onlyv0.0.1 -
List Cash Accounts
actionLists the Brex cash accounts with their balances, account and routing numbers, and which one is primary. Results are capped atmaxResults(default100) — check$summaryfor a truncation notice and raisemaxResultsif it's truncated. This is how you find the account ID that List Transactions for Selected Cash Account requires. See the documentationRead-onlyv0.0.3 -
List Departments
actionLists the departments configured in the Brex account with their ID and name. Results are capped atmaxResults(default100) — check$summaryfor a truncation notice and raisemaxResultsif it's truncated. This is how you turn a department name into the department ID that Invite User requires. See the documentationRead-onlyv0.0.1 -
List Locations
actionLists the office locations configured in the Brex account with their ID and name. Results are capped atmaxResults(default100) — check$summaryfor a truncation notice and raisemaxResultsif it's truncated. This is how you turn a location name into the location ID that Invite User requires. See the documentationRead-onlyv0.0.1 -
List Transactions for Primary Card Account
actionLists settled card transactions, unfiltered. Despite the action name, Brex returns transactions across all card accounts rather than the primary one alone, and non-admin users only ever see their own purchases, refunds, and chargebacks. Use Search Card Transactions instead to filter by merchant, amount, date, or cardholder and to get each transaction'sexpense_id. See the documentationRead-onlyv0.1.3 -
List Transactions for Selected Cash Account
actionLists transactions on one Brex cash account — transfers, deposits, and fees — rather than card spend. Use List Cash Accounts to find the account ID. For card activity use Search Card Transactions or List Transactions for Primary Card Account. See the documentationRead-onlyv0.1.3 -
List Users
actionLists the people in the Brex account with their ID, name, email, status, manager, department, and location. Filter to one person withemail, or setincludeLimitsto include each person's monthly spend limit. Results are capped atmaxResults(default100) — check$summaryfor a truncation notice and raisemaxResultsor add theemailfilter if it's truncated. This is how you turn an email address into the user ID that Get User, Get User Limit, and Set Limit for User require. See the documentationRead-onlyv0.0.3 -
Search Card Transactions
actionSearches settled card transactions across all card accounts by merchant, amount, date, or cardholder, and returns each transaction'sexpense_id, the handle Brex uses for the matching expense and its receipt. Non-admin users only ever see their own purchases, refunds, and chargebacks. Unlike List Transactions for Primary Card Account, which returns the same transactions unfiltered, this action applies filters and expandsexpense_id. See the documentationRead-onlyv0.0.3 -
Search Expenses
actionSearches expenses across card, bill pay, and reimbursement spend by merchant, amount, date, person, type, or status. Covers every payment method and carries receipt and approval state; use Search Card Transactions for settled card postings only. See the documentationRead-onlyv0.0.1 -
Set Limit for User
actionSets a user's recurring monthly spend limit, replacing any limit already in place. This governs corporate cards (Limit Type=USER); vendor cards carry their own limit set on the card itself. Use List Users to find the user ID and Get User Limit to read the current limit. See the documentationWritev0.1.3 -
Unfreeze Card
actionUnfreezes (unlocks) aLOCKEDcard so it can be used again. Cards cancelled with Cancel Card cannot be unfrozen. See the documentationWritev0.0.1 -
Update Card Limit
actionUpdates the spend limit on a vendor card (limit_type: CARD). This sends a completespend_controlsobject, so treat it as a replacement: supply every spend control you want the card to keep, because Brex does not document whether omitted fields are preserved or cleared. Corporate cards draw on their cardholder's limit instead — use Set Limit for User for those. See the documentationWritev0.0.1
MULTI-APP
Use Brex with other popular apps
Most products don't stop at one integration. Pair Brex with the other apps your users rely on, and ship use cases that span both.
- App slug
- brex
- Authentication
- OAuth
- Categories
- Business Management
- Actions
- 21
- Triggers
- 1
- API proxy
- Available
OAuth scopes
These are the scopes Pipedream's managed Brex OAuth client requests when one of your users connects an account. Supply your own OAuth client to request a different set.
- openid
- offline_access
- users
- cards
- locations
- departments
- vendors
- transactions.card.readonly
- transactions.cash.readonly
- accounts.cash.readonly
- transfers
- https://onboarding.brexapis.com/referrals
- budgets