Brex: Query accounting records
Brex accounting.accountingQueryAccountingRecords: arguments, response, policy and SDK examples.
← Accounting operations · Get started
Operation brex.accounting_queryaccountingrecords
Provider route: GET /v3/accounting/records. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/brex with npm, or alter-sdk-brex with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { BrexIntegration } from "@alter-ai/brex";
async function execute(input: Parameters<BrexIntegration["accounting"]["accountingQueryAccountingRecords"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new BrexIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.accounting.accountingQueryAccountingRecords(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_brex import BrexIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = BrexIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.accounting.accounting_query_accounting_records(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
query | object | Optional | Additional keys: not allowed |
query.cursor | string | Optional | |
query.erp_posting_date | Model | Optional | Expand Query accounting records — request body — query erp posting date |
query.ids | array | Optional | |
query.ids[] | string | Each item | |
query.limit | number | Optional | Default: 10 Maximum: 100 Minimum: 1 |
query.review_status | string | Optional | One of: PREPARE, REVIEW, EXPORTED, READY_FOR_EXPORT |
query.single_entry | boolean | Optional | |
query.source_type | string | Optional | One of: CARD, REIMBURSEMENT, BILL |
query.updated_at | Model | Optional | Expand Query accounting records — request body — query updated at |
Referenced models: Query accounting records — request body — query erp posting date, Query accounting records — request body — query updated at
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Query accounting records — response body |
Referenced models: Query accounting records — response body
Schemas
Section titled “Schemas”22 more schemas are linked from the tables above, on the schema pages.
Query accounting records — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
has_next_page | boolean | Required within parent | Whether there are more results available |
items | array | Required within parent | The items in the response |
items[] | Model | Each item | Expand Get accounting record by ID — response body |
next_cursor | JSON | Required within parent | |
next_cursor (anyOf 1) | string | Alternative | The next cursor |
next_cursor (anyOf 2) | null | Alternative | |
total_count | JSON | Optional | |
total_count (anyOf 1) | JSON | Alternative | |
total_count (anyOf 1) (anyOf 1) | number | Alternative | Total count of records matching the query Format: int32 |
total_count (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
total_count (anyOf 2) | null | Alternative |
Referenced models: Get accounting record by ID — response body
Query accounting records — request body — query erp posting date
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
from | string | Optional | Inclusive start of the ERP posting date range - ISO 8601 UTC datetime format Format: date-time |
to | string | Optional | Inclusive end of the ERP posting date range - ISO 8601 UTC datetime format Format: date-time |
Query accounting records — request body — query updated at
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
gt | string | Optional | Minimum value to filter by (exclusive) - ISO 8601 format Format: date-time |
gte | string | Optional | Minimum value to filter by (inclusive) - ISO 8601 format Format: date-time |
lt | string | Optional | Maximum value to filter by (exclusive) - ISO 8601 format Format: date-time |
lte | string | Optional | Maximum value to filter by (inclusive) - ISO 8601 format Format: date-time |
Get accounting record by ID — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
amount | JSON | Required within parent | Amount of the accounting record |
amount (allOf 1) | Model | All variants apply | Expand Get accounting record by ID — response body — amount amount, currency |
billing_amount | JSON | Optional | |
billing_amount (anyOf 1) | object | Alternative | Billing/settlement amount in the account's home currency. For multi-currency transactions (e.g., EUR bill paid from USD account), this represents the actual amount debited. Use billing_amount / original_amount to derive the effective FX rate. |
billing_amount (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get accounting record by ID — response body — amount amount, currency |
billing_amount (anyOf 2) | null | Alternative | |
due_at | JSON | Optional | |
due_at (anyOf 1) | string | Alternative | Source due at in UTC timezone. For bills only Format: date-time |
due_at (anyOf 2) | null | Alternative | |
erp_posting_date | string | Required within parent | ERP impact date in UTC timezone Format: date-time |
id | string | Required within parent | Unique identifier for the accounting record |
invoice_number | JSON | Optional | |
invoice_number (anyOf 1) | string | Alternative | Invoice number. For bills only |
invoice_number (anyOf 2) | null | Alternative | |
line_items | array | Required within parent | Line items for double-entry bookkeeping |
line_items[] | Model | Each item | Expand Get accounting record by ID — response body — line items item |
memo | JSON | Optional | |
memo (anyOf 1) | string | Alternative | Memo/description |
memo (anyOf 2) | null | Alternative | |
original_amount | JSON | Optional | |
original_amount (anyOf 1) | object | Alternative | Original amount if different from current |
original_amount (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get accounting record by ID — response body — amount amount, currency |
original_amount (anyOf 2) | null | Alternative | |
posted_at | string | Required within parent | Source posted date in UTC timezone Format: date-time |
receipts | JSON | Optional | |
receipts (anyOf 1) | array | Alternative | Associated receipts |
receipts (anyOf 1)[] | Model | Each item | Expand Get accounting record by ID — response body — receipts Associated receipts item |
receipts (anyOf 2) | null | Alternative | |
review_status | string | Required within parent | Review status Known values: READY_FOR_EXPORT, PREPARE, REVIEW, EXPORTED |
source_id | JSON | Optional | |
source_id (anyOf 1) | string | Alternative | Source transaction ID |
source_id (anyOf 2) | null | Alternative | |
source_type | string | Required within parent | Source type Known values: CARD, REIMBURSEMENT, BILL |
status | JSON | Optional | |
status (anyOf 1) | string | Alternative | The source expense's approval/lifecycle status. For bills this reflects the bill's approval state (e.g. SUBMITTED = pending approval, APPROVED = approved), which is not derivable from review_status (always READY_FOR_EXPORT when polling). Known values: APPROVED, CANCELED, DRAFT, OUT_OF_POLICY, SETTLED, SPLIT, SUBMITTED, VOID |
status (anyOf 2) | null | Alternative | |
type | string | Required within parent | Types of accounting records representing different financial transactions: **Card-related transactions:** - `CARD_EXPENSE_POST`: Records when a card expense is posted and settled - `CARD_EXPENSE_REFUND`: Records when a merchant issues a refund for a card transaction - `CARD_EXPENSE_REPAYMENT`: Records when an employee repays money to the company for a card expense - `CARD_PAYMENT`: Records payments from customer to Brex for card balances - `CARD_PAYMENT_REFUND`: Records refunds from Brex to customer for overpayments - `REWARD_REDEMPTION`: Records when a reward is redeemed **Bill-related transactions:** - `BILL_EXPENSE`: Records when a bill expense is created - `BILL_EXPENSE_PAYMENT`: Records when a bill is paid through ACH/wire transfer - `BILL_EXPENSE_CARD_PAYMENT`: Records when a bill is paid using a Brex card **Reimbursement-related transactions:** - `REIMBURSEMENT_EXPENSE_APPROVAL`: Records approval of reimbursement (accrual basis) - `REIMBURSEMENT_EXPENSE_POST`: Records when reimbursement is fulfilled (cash basis) - `REIMBURSEMENT_EXPENSE_REPAYMENT`: Records repayment of a reimbursement expense - `REIMBURSEMENT_EXPENSE_MONEY_MOVEMENT_PAYOUT`: Records payout to employee/third party - `REIMBURSEMENT_EXPENSE_MONEY_MOVEMENT_PAYOUT_REVERSAL`: Records reversal of payout - `REIMBURSEMENT_EXPENSE_MONEY_MOVEMENT_PAYIN`: Records payment from customer to Brex - `REIMBURSEMENT_EXPENSE_MONEY_MOVEMENT_REFUND`: Records refund to customer's bank Known values: CARD_EXPENSE_POST, CARD_EXPENSE_REPAYMENT, REIMBURSEMENT_EXPENSE_REPAYMENT, REIMBURSEMENT_EXPENSE_APPROVAL, REIMBURSEMENT_EXPENSE_MONEY_MOVEMENT_PAYOUT, REIMBURSEMENT_EXPENSE_MONEY_MOVEMENT_PAYIN, REIMBURSEMENT_EXPENSE_POST, CARD_PAYMENT, REWARD_REDEMPTION, REIMBURSEMENT_EXPENSE_MONEY_MOVEMENT_REFUND, CARD_EXPENSE_REFUND, CARD_PAYMENT_REFUND, REIMBURSEMENT_EXPENSE_MONEY_MOVEMENT_PAYOUT_REVERSAL, INVOICE, INVOICE_PAYMENT, BILL_EXPENSE, BILL_EXPENSE_PAYMENT, BILL_EXPENSE_CARD_PAYMENT, BILL_MONEY_MOVEMENT_PAYIN |
updated_at | string | Required within parent | Last update timestamp in UTC timezone Format: date-time |
user | JSON | Optional | |
user (anyOf 1) | object | Alternative | User associated with the record |
user (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get accounting record by ID — response body — user User associated with the record account id, brex assistant, department id, department name, email, first name, id, last name, location id, location name, manager first name, manager id, manager last name, manager title id, manager title name, metadata, notification preferences, phone number, role, status, title id, title name |
user (anyOf 2) | null | Alternative | |
vendor | JSON | Optional | |
vendor (anyOf 1) | object | Alternative | Vendor information |
vendor (anyOf 1) (allOf 1) | Model | All variants apply | Expand Get accounting record by ID — response body — vendor Vendor information contact name, customer account id, customer dba name, email, id, name, payment config, phone, rail account details, website |
vendor (anyOf 2) | null | Alternative | |
version | JSON | Required within parent | |
version (anyOf 1) | number | Alternative | Version number |
version (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Referenced models: Get accounting record by ID — response body — receipts Associated receipts item, Get accounting record by ID — response body — line items item, Get accounting record by ID — response body — amount amount, currency, Get accounting record by ID — response body — user User associated with the record account id, brex assistant, department id, department name, email, first name, id, last name, location id, location name, manager first name, manager id, manager last name, manager title id, manager title name, metadata, notification preferences, phone number, role, status, title id, title name, Get accounting record by ID — response body — vendor Vendor information contact name, customer account id, customer dba name, email, id, name, payment config, phone, rail account details, website
Get accounting record by ID — response body — amount amount, currency
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
amount | JSON | Required within parent | |
amount (anyOf 1) | number | Alternative | The amount |
amount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
currency | string | Required within parent | The currency |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: brex.accounting_queryaccountingrecords. Catalog operation: accounting:queryAccountingRecords. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["accounting.record.read", "accounting.record.write"]