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.
Webhooks API (0.1)
- Productionhttps://api.brex.com/v1/webhooks
- Staging (Note: This is not a sandbox. It will not work with customer tokens.)https://api-staging.brex.com/v1/webhooks
- curl
- JavaScript
- Node.js
- Python
- Ruby
- Java
curl -i -X GET \
https://api.brex.com/v1/webhooks \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'Success
ID of the webhook group to which this subscription applies, if any.
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
List of event types that this webhook subscription listens to.
{ "next_cursor": "string", "items": [ { … } ] }
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
ID of the webhook group to which this subscription applies, if any. This is only available for partners.
A list of the webhook event types this subscription will listen to.
- Productionhttps://api.brex.com/v1/webhooks
- Staging (Note: This is not a sandbox. It will not work with customer tokens.)https://api-staging.brex.com/v1/webhooks
- curl
- JavaScript
- Node.js
- Python
- Ruby
- Java
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"
]
}'Success
ID of the webhook group to which this subscription applies, if any.
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
List of event types that this webhook subscription listens to.
{ "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.
- Productionhttps://api.brex.com/v1/webhooks/secrets
- Staging (Note: This is not a sandbox. It will not work with customer tokens.)https://api-staging.brex.com/v1/webhooks/secrets
- curl
- JavaScript
- Node.js
- Python
- Ruby
- Java
curl -i -X GET \
https://api.brex.com/v1/webhooks/secrets \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'Success
The payload of the secret to be used for webhook validation.
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" } ]
- Productionhttps://api.brex.com/v1/webhooks/{id}
- Staging (Note: This is not a sandbox. It will not work with customer tokens.)https://api-staging.brex.com/v1/webhooks/{id}
- curl
- JavaScript
- Node.js
- Python
- Ruby
- Java
curl -i -X GET \
'https://api.brex.com/v1/webhooks/{id}' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'Success
ID of the webhook group to which this subscription applies, if any.
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
List of event types that this webhook subscription listens to.
{ "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.
ID of the webhook group to which this subscription applies, if any. This is only available for partners.
A list of the webhook event types this subscription will listen to.
- Productionhttps://api.brex.com/v1/webhooks/{id}
- Staging (Note: This is not a sandbox. It will not work with customer tokens.)https://api-staging.brex.com/v1/webhooks/{id}
- curl
- JavaScript
- Node.js
- Python
- Ruby
- Java
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"
}'Success
ID of the webhook group to which this subscription applies, if any.
The URL to which webhook events will be sent. Must be a valid HTTPS URL.
List of event types that this webhook subscription listens to.
{ "id": "wsub_123", "group_id": "wg_123", "url": "https://example.com/webhook", "event_types": "[\"EXPENSE_PAYMENT_UPDATED\"]", "status": "ACTIVE" }
- Productionhttps://api.brex.com/v1/webhooks/{id}
- Staging (Note: This is not a sandbox. It will not work with customer tokens.)https://api-staging.brex.com/v1/webhooks/{id}
- curl
- JavaScript
- Node.js
- Python
- Ruby
- Java
curl -i -X DELETE \
'https://api.brex.com/v1/webhooks/{id}' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'