Connecting to Brex
Using OAuth Authentication
Brex uses OAuth 2.0 for partner authentication. To set up OAuth authentication, you'll need to register your application with Brex and obtain OAuth client credentials.
To register your application:
- Log in to your Brex account
- Navigate to the Developer Portal at dashboard.brex.com
- Create a new application and obtain your Client ID and Client Secret
- Configure your redirect URI (typically http://localhost:33333 for desktop applications)
After setting the following connection properties, you are ready to connect:
- AuthScheme: Set this to OAuth.
- OAuthClientId: Set this to your OAuth Client ID obtained from Brex.
- OAuthClientSecret: Set this to your OAuth Client Secret obtained from Brex.
- Scope: Set this to the appropriate scopes for your application. The default includes read access to companies, users, cards, transactions, and accounting data.
- CallbackURL: Set this to your registered redirect URI (defaults to http://localhost:33333).
Available Tables
The Brex API Profile provides access to comprehensive financial and business expense management data across 26 specialized tables:
- AccountingRecords - Access accounting records and financial data synchronization.
- BudgetPrograms - Query budget program configurations and hierarchies.
- Budgets - Retrieve budget definitions, limits, and spending controls.
- CardAccounts - Access card account information and account details.
- Cards - Query card information, status, and spending controls.
- CardTransactions - Retrieve detailed card transaction history and merchant data.
- CashAccounts - Access cash account information and balances.
- CashAccountStatements - Query cash account statement data and transaction summaries.
- CashTransactions - Retrieve cash transaction records and payment details.
- Companies - Access company profile information and business details.
- Departments - Query department structures and organizational hierarchy.
- Expenses - Retrieve expense records, approvals, and reimbursement data.
- Fields - Access custom field definitions and form configurations.
- FieldValues - Query custom field values and user-defined data.
- LegalEntities - Access legal entity information and corporate structure.
- LinkedAccounts - Query linked external account connections and integrations.
- Locations - Retrieve location data and address information.
- PrimaryCardStatements - Access primary card statement data and billing cycles.
- PrimaryCashAccount - Query primary cash account details and main account information.
- Referrals - Access referral program data and invitation tracking.
- SpendLimits - Query spending limit configurations and control settings.
- Titles - Retrieve job titles and organizational role definitions.
- Transfers - Access transfer records and fund movement history.
- TripBookings - Query travel booking information and expense tracking.
- Trips - Retrieve trip records and travel expense management data.
- Users - Access user information, profiles, and account details.
- Vendors - Query vendor information and supplier management data.
Usage Examples
Query all users:
SELECT * FROM Users
Query all companies:
SELECT * FROM Companies
Query all cards:
SELECT * FROM Cards
Query card transactions by user:
SELECT * FROM CardTransactions WHERE UserId = 'user_123456'
Query expenses by status:
SELECT * FROM Expenses WHERE Status = 'APPROVED'
Query budgets by budget program:
SELECT * FROM Budgets WHERE BudgetProgramId = 'program_123456'
Query budget programs by parent:
SELECT * FROM BudgetPrograms WHERE ParentBudgetProgramId = 'parent_123456'
Query all departments:
SELECT * FROM Departments
Query all locations:
SELECT * FROM Locations
Query all vendors:
SELECT * FROM Vendors
Query all titles:
SELECT * FROM Titles
Query all cash accounts:
SELECT * FROM CashAccounts
Query primary cash account:
SELECT * FROM PrimaryCashAccount
Query cash transactions by account:
SELECT * FROM CashTransactions WHERE CashAccountId = 'cash_account_123456'
Query cash account statements by account:
SELECT * FROM CashAccountStatements WHERE CashAccountId = 'cash_account_123456'
Query all card accounts:
SELECT * FROM CardAccounts
Query primary card statements by account:
SELECT * FROM PrimaryCardStatements WHERE CardAccountId = 'card_account_123456'
Query transfers by type:
SELECT * FROM Transfers WHERE TransferType = 'DEPOSIT'
Query all trips:
SELECT * FROM Trips
Query trip bookings by trip:
SELECT * FROM TripBookings WHERE TripId = 'trip_123456'
Query spend limits by policy:
SELECT * FROM SpendLimits WHERE PolicyId = 'policy_123456'
Query all referrals:
SELECT * FROM Referrals
Query all legal entities:
SELECT * FROM LegalEntities
Query linked accounts by provider:
SELECT * FROM LinkedAccounts WHERE ProviderType = 'QUICKBOOKS'
Query accounting records by account:
SELECT * FROM AccountingRecords WHERE RemoteAccountId = 'account_123456'
Query all custom fields:
SELECT * FROM Fields
Query field values by field:
SELECT * FROM FieldValues WHERE FieldId = 'field_123456'
Connection Properties
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.
| Property | Description |
| AuthScheme | The scheme used for authentication. Accepted entries are OAuth, or None. Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT |
| CallbackURL | Identifies the URL users return to after authenticating to API via OAuth (Custom OAuth applications only). |
| InitiateOAuth | Specifies the process for obtaining or refreshing the OAuth access token, which maintains user access while an authenticated, authorized user is working. Allowed values are: OFF, GETANDREFRESH, REFRESH |
| OAuthClientId | Specifies the client ID (also known as the consumer key) assigned to your custom OAuth application. This ID is required to identify the application to the OAuth authorization server during authentication. |
| OAuthClientSecret | Specifies the client secret assigned to your custom OAuth application. This confidential value is used to authenticate the application to the OAuth authorization server. (Custom OAuth applications only.). |
| Scope | Scope(s) to use when authenticating, that control access to specific information. |