.png)
Brex Integration Guide
Connect Brex financial data and selected event notifications with enterprise systems through REST APIs, webhooks, and Martini workflows.
Brex integration options at a glance
Brex primarily integrates with enterprise systems through authenticated REST APIs for Users, Cards, Card transactions, Expenses, Reimbursements, Payments, Receipts, and Spend programs. Brex also provides webhook-style notifications for selected products and events, although coverage varies by resource and lifecycle event. Martini can consume Brex JSON APIs, manage cursor-based pagination and incremental checkpoints, receive supported webhook requests through an exposed REST API, and orchestrate downstream processing. OAuth 2.0, bearer access tokens, scopes, and organization permissions govern access. Receipt-related APIs can support metadata and file workflows, while scheduled Martini workflows provide reconciliation, backfill, and recovery processing.
Common Brex integration patterns
Common Brex data objects used in integrations
Authentication and security considerations
OAuth and bearer tokens
Brex APIs use authenticated HTTPS requests with OAuth-based authorization and bearer access tokens. Scopes and organization permissions restrict the resources and operations available to an integration.
Secure environment configuration
Store Brex client credentials, access tokens, refresh data, endpoint configuration, and webhook verification data in Martini environment configuration rather than workflow source or logs.
Webhook protection
Restrict the Martini endpoint that receives Brex callbacks and validate the authentication or signing mechanism documented for the selected Brex product and event type before processing payloads.
Data minimization
- Use least-privilege Brex scopes and permissions.
- Mask tokens, receipt contents, full card numbers, and unnecessary personal data in diagnostic output.
- Define retention and deletion controls for receipts and financial data.
Operational considerations for Brex integrations
Rate limits and pagination
Confirm limits for each Brex endpoint, use bounded concurrency and exponential backoff for transient failures, and implement the pagination method documented for each resource. Commit cursors only after the corresponding page is processed successfully.
Idempotency and event delivery
Webhook deliveries may be retried or arrive out of order. Store event identifiers where available, use stable Brex object identifiers for polling, and use supported idempotency keys for create operations.
Financial and lifecycle data
Preserve original currencies and amounts, confirm whether each endpoint uses decimal values or minor units, and distinguish pending, approved, posted, rejected, declined, canceled, reversed, and corrected states.
Receipts and schema changes
Process receipt metadata separately from binary content, validate file properties, and maintain durable attachment references. Treat Brex responses as versioned external contracts and monitor status values, enum changes, pagination fields, and nested objects.
Testing and monitoring
- Test representative pending, completed, rejected, reversed, and corrected objects.
- Use reconciliation totals and source-to-target identifiers to detect omissions.
- Monitor retries, webhook acceptance, downstream failures, and checkpoint progress.
Why use Martini instead of scripts or point-to-point integrations?
Separate transport from business logic
Martini workflows can isolate Brex authentication, pagination, webhook reception, mappings, accounting rules, and target writes instead of embedding all behavior in a single script.
Support multiple execution models
The same integration design can combine REST API consumption, exposed Martini APIs, supported Brex webhook events, scheduled synchronization, backfills, and reconciliation workflows.
Improve maintainability
Reusable workflows, mappings, secure environment configuration, validation, checkpoints, and structured error handling make changes easier to test and operate than independent point-to-point scripts.
Preserve operational control
- Apply idempotency and retry policies consistently.
- Route invalid records and downstream failures for review.
- Maintain audit references across Brex objects and target-system documents.
- Monitor workflow execution and troubleshoot without coupling every target to Brex transport logic.