Brex uses webhooks to send real-time notifications when events happen in the accounts that you manage. Use webhook subscriptions to subscribe to different webhook events.
Webhook Subscriptions
Webhooks API (0.1)
Staging (Note: This is not a sandbox. It will not work with customer tokens.)
https://api-staging.brex.com
Manage webhook subscriptions.
curl -i -X GET \
https://api.brex.com/v1/webhooks \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'itemsArray of objects(Webhook Subscription)required
items[].group_idstring or null
ID of the webhook group to which this subscription applies, if any.
Example: "wg_123"
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
Example: "https://example.com/webhook"
items[].event_typesArray of strings(WebhookEventType)required
List of event types that this webhook subscription listens to.
Items Enum"REFERRAL_CREATED""REFERRAL_ACTIVATED""REFERRAL_APPLICATION_STATUS_CHANGED""TRANSFER_PROCESSED""TRANSFER_FAILED""EXPENSE_PAYMENT_UPDATED""USER_UPDATED""EMBEDDED_CARD_TRANSACTION_UPDATED""EMBEDDED_CARD_UPDATED""EMBEDDED_ACCOUNT_UPDATED"
Example: "[\"EXPENSE_PAYMENT_UPDATED\"]"
{
"next_cursor": "string",
"items":
[
{
…
}
]
}
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
Example: "https://example.com/webhook"
ID of the webhook group to which this subscription applies, if any. This is only available for partners.
Example: "wg_123"
event_typesArray of strings(WebhookEventType)non-emptyrequired
A list of the webhook event types this subscription will listen to.
Items Enum"REFERRAL_CREATED""REFERRAL_ACTIVATED""REFERRAL_APPLICATION_STATUS_CHANGED""TRANSFER_PROCESSED""TRANSFER_FAILED""EXPENSE_PAYMENT_UPDATED""USER_UPDATED""EMBEDDED_CARD_TRANSACTION_UPDATED""EMBEDDED_CARD_UPDATED""EMBEDDED_ACCOUNT_UPDATED"
curl -i -X POST \
https://api.brex.com/v1/webhooks \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: string' \
-d '{
"url": "https://example.com/webhook",
"group_id": "wg_123",
"event_types": [
"REFERRAL_CREATED"
]
}'ID of the webhook group to which this subscription applies, if any.
Example: "wg_123"
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
Example: "https://example.com/webhook"
event_typesArray of strings(WebhookEventType)required
List of event types that this webhook subscription listens to.
Items Enum"REFERRAL_CREATED""REFERRAL_ACTIVATED""REFERRAL_APPLICATION_STATUS_CHANGED""TRANSFER_PROCESSED""TRANSFER_FAILED""EXPENSE_PAYMENT_UPDATED""USER_UPDATED""EMBEDDED_CARD_TRANSACTION_UPDATED""EMBEDDED_CARD_UPDATED""EMBEDDED_ACCOUNT_UPDATED"
Example: "[\"EXPENSE_PAYMENT_UPDATED\"]"
{
"id": "wsub_123",
"group_id": "wg_123",
"url": "https://example.com/webhook",
"event_types": "[\"EXPENSE_PAYMENT_UPDATED\"]",
"status": "ACTIVE"
}
Request
This endpoint returns a set of webhook signing secrets used to validate the webhook. Usually only one key will be returned in the response. After key rotation, this endpoint will return two keys: the new key, and the key that will be revoked soon. There will also be two signatures in the 'Webhook-Signature' request header. Your application should use all keys available to validate the webhook request. If validation passes for any of the keys returned, the webhook payload is valid.
curl -i -X GET \
https://api.brex.com/v1/webhooks/secrets \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'The payload of the secret to be used for webhook validation.
Example: "whsec_123"
The status of a webhook secret.
| Enum Value | Description |
|---|---|
| ACTIVE | The webhook secret is active and can be used to validate webhooks from Brex. |
| PENDING_REVOKE | The webhook secret is still active, but it will soon be revoked. This may happen during key rotations. |
| REVOKED | The webhook secret is no longer active. It cannot be used to validate webhooks from Brex. |
]
[
{
"secret": "whsec_123",
"status": "ACTIVE"
}
]
curl -i -X GET \
'https://api.brex.com/v1/webhooks/{id}' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'ID of the webhook group to which this subscription applies, if any.
Example: "wg_123"
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
Example: "https://example.com/webhook"
event_typesArray of strings(WebhookEventType)required
List of event types that this webhook subscription listens to.
Items Enum"REFERRAL_CREATED""REFERRAL_ACTIVATED""REFERRAL_APPLICATION_STATUS_CHANGED""TRANSFER_PROCESSED""TRANSFER_FAILED""EXPENSE_PAYMENT_UPDATED""USER_UPDATED""EMBEDDED_CARD_TRANSACTION_UPDATED""EMBEDDED_CARD_UPDATED""EMBEDDED_ACCOUNT_UPDATED"
Example: "[\"EXPENSE_PAYMENT_UPDATED\"]"
{
"id": "wsub_123",
"group_id": "wg_123",
"url": "https://example.com/webhook",
"event_types": "[\"EXPENSE_PAYMENT_UPDATED\"]",
"status": "ACTIVE"
}
Request
Update a webhook. You can update the endpoint url, event types that the endpoint receives, or temporarily deactivate the webhook.
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
Example: "https://example.com/webhook"
ID of the webhook group to which this subscription applies, if any. This is only available for partners.
Example: "wg_123"
event_typesArray of strings(WebhookEventType)required
A list of the webhook event types this subscription will listen to.
Items Enum"REFERRAL_CREATED""REFERRAL_ACTIVATED""REFERRAL_APPLICATION_STATUS_CHANGED""TRANSFER_PROCESSED""TRANSFER_FAILED""EXPENSE_PAYMENT_UPDATED""USER_UPDATED""EMBEDDED_CARD_TRANSACTION_UPDATED""EMBEDDED_CARD_UPDATED""EMBEDDED_ACCOUNT_UPDATED"
curl -i -X PUT \
'https://api.brex.com/v1/webhooks/{id}' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com/webhook",
"group_id": "wg_123",
"event_types": [
"REFERRAL_CREATED"
],
"status": "ACTIVE"
}'ID of the webhook group to which this subscription applies, if any.
Example: "wg_123"
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
Example: "https://example.com/webhook"
event_typesArray of strings(WebhookEventType)required
List of event types that this webhook subscription listens to.
Items Enum"REFERRAL_CREATED""REFERRAL_ACTIVATED""REFERRAL_APPLICATION_STATUS_CHANGED""TRANSFER_PROCESSED""TRANSFER_FAILED""EXPENSE_PAYMENT_UPDATED""USER_UPDATED""EMBEDDED_CARD_TRANSACTION_UPDATED""EMBEDDED_CARD_UPDATED""EMBEDDED_ACCOUNT_UPDATED"
Example: "[\"EXPENSE_PAYMENT_UPDATED\"]"
{
"id": "wsub_123",
"group_id": "wg_123",
"url": "https://example.com/webhook",
"event_types": "[\"EXPENSE_PAYMENT_UPDATED\"]",
"status": "ACTIVE"
}
curl -i -X DELETE \
'https://api.brex.com/v1/webhooks/{id}' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'