FreshBooks and Brex integration
FreshBooks runs your books: invoices, expenses, bills, and the chart of accounts. Brex runs corporate cards and spend management. Connecting the two brings coded card spend into FreshBooks without re-keying. After Brex finishes coding a card transaction with a GL account and any custom dimensions, ml-connector posts it into FreshBooks as an expense on the matching category, and keeps vendor records aligned across both systems. ml-connector handles the different authentication and data shapes on each side and moves records on a schedule you control.
What moves between them
The main flow runs from Brex into FreshBooks. Once Brex has coded a card transaction, ml-connector reads the Brex expense and accounting record and posts it into FreshBooks as an expense, mapped to the matching FreshBooks chart-of-accounts category and to the merchant or vendor. Vendor records are aligned so Brex vendors match FreshBooks bill vendors, and the FreshBooks chart of accounts is used to validate the GL account on every posted expense. Brex transactions are read-only, so ml-connector never writes card activity or accounting state back into Brex except to mark a record exported once it has landed in FreshBooks.
How ml-connector handles it
ml-connector stores both credential sets encrypted. It sends the Brex bearer token on every request and, for partner installs, refreshes the OAuth access token before its roughly one-hour expiry; for the static token it tracks the 90-day inactivity window so an idle token does not silently die. On the FreshBooks side it runs the OAuth authorization-code flow, rotates and re-stores the single refresh token on every refresh, and resolves the account ID and business ID from the /users/me call so each path is built correctly. Coded Brex card spend becomes a FreshBooks expense, with the GL account and any Brex custom dimensions mapped to a FreshBooks chart-of-accounts category that is aligned first so every expense lands on a valid account. Merchant names from Brex rarely match FreshBooks vendor names exactly, so a fuzzy match and cache resolves the vendor. Brex Svix-signed webhooks are verified, and the ACCOUNTING_RECORD_READY_FOR_EXPORT event triggers a pull the moment a record is coded; a scheduled poll backfills anything a webhook missed. Both sides return HTTP 429 under load, so ml-connector backs off with jitter, and every record carries a full audit trail and can be replayed if a FreshBooks write fails.
A real-world example
A 60-person digital agency runs FreshBooks for client invoicing, expenses, and its books, and gives its team Brex corporate cards for software, travel, and ad spend. Before the integration, a bookkeeper exported the Brex transaction feed each week and typed every card charge into FreshBooks by hand, guessing at the expense category and chasing receipts, then reconciled the card balance against the ledger at month-end. With FreshBooks and Brex connected, each coded Brex expense posts into FreshBooks automatically on the right category with its receipt attached, and the vendor list stays aligned. The weekly re-keying is gone and month-end close starts from card spend that is already categorized.
What you can do
- Post coded Brex card expenses into FreshBooks as expenses on the matching chart-of-accounts category.
- Carry Brex receipts and custom GL dimensions through to the FreshBooks expense record.
- Keep Brex vendors aligned with FreshBooks bill vendors using a fuzzy merchant match and cache.
- Bridge the Brex bxt_ token or OAuth access token with the FreshBooks OAuth authorization-code flow and rotating refresh token.
- React to the Brex accounting-record-ready webhook, with scheduled polling, retries, error replay, and a full audit trail.
Questions
- Which direction does data move between FreshBooks and Brex?
- The main flow is Brex into FreshBooks. Coded card expenses and accounting records move from Brex into FreshBooks as expenses, while vendor records are aligned so both lists match. Brex transactions are read-only, so ml-connector does not write card activity back into Brex, other than marking a Brex accounting record exported once it has posted to FreshBooks.
- How does the integration bridge the Brex token and FreshBooks OAuth?
- ml-connector stores both credential sets encrypted. It sends the Brex bxt_ user token, or an OAuth access token for partner installs, as a bearer header on every call, and runs the FreshBooks OAuth authorization-code flow separately. Because FreshBooks issues a single refresh token that rotates on every refresh, ml-connector re-stores the new one each time so the connection does not break.
- Does the integration use webhooks or polling?
- Both. Brex pushes the Svix-signed ACCOUNTING_RECORD_READY_FOR_EXPORT event when a transaction is coded, which ml-connector verifies and uses to pull the record right away. Because Brex webhook delivery and the matching FreshBooks events are not guaranteed in real time, a scheduled poll over the cursor-paged Brex lists backfills anything a webhook missed.
Related integrations
More FreshBooks integrations
Other systems that connect to Brex
Connect FreshBooks and Brex
Free to use. Add your credentials, ping your real systems, and see if we fit.
Get started