The Brex API offers a powerful avenue for automating financial operations, providing programmatic access to a company's Brex account. Through the API, you can manage cards, view transactions, and handle rewards programmatically. When combined with Pipedream, the API's capabilities expand, allowing users to integrate Brex data with other apps, trigger workflows based on financial events, and streamline financial reporting and reconciliation processes.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
brex: {
type: "app",
app: "brex",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://platform.brexapis.com/v2/cards`,
headers: {
Authorization: `Bearer ${this.brex.$auth.oauth_access_token}`,
},
})
},
})
Expense Management Automation: Trigger a Pipedream workflow whenever a new transaction is posted to a Brex account. Automatically categorize the transaction, send a Slack message to the relevant department head for review, and update a Google Sheet used for expense tracking.
Receipt Collection Workflow: Send an email or a Slack prompt to employees using a Pipedream workflow when a new Brex card transaction lacks a receipt. This can be set up to run periodically and check for transactions that are missing documentation, ensuring compliance with company expense policies.
Real-Time Financial Dashboard: Use Pipedream to feed Brex transaction data into a BI tool like Tableau or Looker. Set up a webhook that triggers a workflow on each new transaction, which then processes the data and sends it to the BI tool, providing up-to-date financial insights.
Lists all settled transactions for the primary card account. See the docs here.
Lists all transactions for the specified cash account. See the docs here.
Brex uses OAuth authentication. When you connect your Brex account, Pipedream will open a popup window where you can sign into Brex and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Brex API.
Pipedream requests the following authorization scopes when you connect your account:
openid
offline_access
users
cards
locations
departments
vendors
transactions.card.readonly
transactions.cash.readonly
accounts.cash.readonly
transfers
https://onboarding.brexapis.com/referrals
budgets
GET
https://accounts.brex.com/oauth2/v1/auth
?
client_id={{oauth.client_id}}
&
redirect_uri={{oauth.redirect_uri}}
&
state={{oauth.state}}
&
response_type=code
&
scope={{oauth.space_separated_scopes}}
POST
https://accounts.brex.com/oauth2/v1/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
redirect_uri={{oauth.redirect_uri}}
&
grant_type=authorization_code
&
code={{oauth.code}}
POST
https://accounts.brex.com/oauth2/v1/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{oauth.client_id}}
&
client_secret={{oauth.client_secret}}
&
grant_type=refresh_token
&
refresh_token={{oauth.refresh_token}}