Webhooks API Examples

Subscribe to receive pending transaction events for expenses made on Brex Card

  1. Register subscription to EXPENSE_PAYMENT_UPDATED webhook event
Copy
Copied
POST "https://platform.brexapis.com/v1/webhooks"
Requires "openid" and "offline_access" scopes to register webhook subscription
Requires "expenses.card.readonly" scope and "CARD_ADMIN" role to receive "EXPENSE_PAYMENT_UPDATED" event

REQUEST
{
    "event_types": ["EXPENSE_PAYMENT_UPDATED"],
    "url": "https://your-webhook.url/"
}

RESPONSE
{
    "id": "subscription-id",
    "url": "https://your-webhook.url/",
    "event_types": [
        "EXPENSE_PAYMENT_UPDATED"
    ],
    "status": "ACTIVE"
}
  1. Attempt a charge on any Brex card on the account and receive an event at the webhook url
Copy
Copied
WEBHOOK EVENT PAYLOAD
{
    "event_type": "EXPENSE_PAYMENT_UPDATED",
    "expense_id": "expense_cl3khzfnr00000k92bdjtmmes",
    "payment_status": "PENDING",
    "payment_type": "PURCHASE",
    "company_id": "cuacc_ckwodfq7h000801q48qqsae5k",
    "amount": {
        "amount": 1030,
        "currency": "string"
    },
    "payment_description": "Schrute Farms"
}
Copyright © Brex 2019–2022. All rights reserved.