-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrex-webhooks-asyncapi.yml
More file actions
646 lines (634 loc) · 21.4 KB
/
Copy pathbrex-webhooks-asyncapi.yml
File metadata and controls
646 lines (634 loc) · 21.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
asyncapi: '2.6.0'
id: 'urn:com:brex:webhooks'
info:
title: Brex Webhooks API
version: '0.1'
description: >
AsyncAPI 2.6 description of the Brex Webhooks surface. Brex uses webhooks to
deliver real-time notifications when events happen in the accounts that you
manage. Subscribers register an HTTPS callback URL via the Webhooks API
(Subscriptions endpoints) and select one or more event types from the
`WebhookEventType` enum. Brex POSTs JSON payloads to the registered URL when
matching events occur; subscribers respond with a 200 status code to confirm
receipt. Incoming requests can be validated using the secrets returned from
`GET /v1/webhooks/secrets`.
contact:
name: Brex Developer Support
url: https://developer.brex.com/
email: developer-support@brex.com
license:
name: Proprietary
x-generated-from: https://developer.brex.com/openapi/webhooks_api/
x-source-bundle: https://developer.brex.com/_bundle/openapi/webhooks_api.yaml
x-generated-by: claude-crawl-2026-05-30
x-api-evangelist:
aid: brex:brex-webhooks
note: >
Only the event types and payload schemas that are explicitly documented in
the Brex Webhooks OpenAPI bundle are modeled here. The WebhookEventType
enum contains additional values used by the Brex Embedded program
(EMBEDDED_* and PARTNERSHIP_INTEGRATION_CONNECTION_UPDATED) for which Brex
does not publish public payload schemas; those values are kept in the enum
but not bound to dedicated channels.
defaultContentType: application/json
servers:
subscriber:
url: '{webhookUrl}'
protocol: https
description: >
The HTTPS endpoint that the subscriber registers with Brex via
`POST /v1/webhooks`. Brex delivers webhook events by sending HTTPS POST
requests to this URL. Must be a valid HTTPS URL.
variables:
webhookUrl:
default: https://example.com/webhook
description: The subscriber-controlled HTTPS callback URL.
channels:
accountingRecordReadyForExport:
description: >-
Fired when a list of accounting records is ready for export. Sent to the
subscriber callback URL via HTTPS POST.
publish:
operationId: onAccountingRecordReadyForExport
summary: Accounting Record Ready For Export Event
description: A list of accounting records are ready for export.
bindings:
http:
type: request
method: POST
bindingVersion: '0.3.0'
message:
$ref: '#/components/messages/AccountingRecordReadyForExport'
expensePaymentUpdated:
description: >-
Fired when an expense payment changes status on a Brex Card. Subscription
must be registered with a user with the CARD_ADMIN role.
publish:
operationId: onExpensePaymentUpdated
summary: Expense Payment Updated Event
description: Expense activity on Brex Cards.
bindings:
http:
type: request
method: POST
bindingVersion: '0.3.0'
message:
$ref: '#/components/messages/ExpensePaymentUpdated'
referralActivated:
description: Fired when a user signs up with the referral link.
publish:
operationId: onReferralActivated
summary: Referral Activated Event
description: A referral was activated.
bindings:
http:
type: request
method: POST
bindingVersion: '0.3.0'
message:
$ref: '#/components/messages/ReferralActivated'
referralApplicationStatusChanged:
description: Fired when the application status of a referral changes.
publish:
operationId: onReferralApplicationStatusChanged
summary: Referral Application Status Changed Event
description: A referral's application status changed.
bindings:
http:
type: request
method: POST
bindingVersion: '0.3.0'
message:
$ref: '#/components/messages/ReferralApplicationStatusChanged'
referralCreated:
description: Fired when a referral is created.
publish:
operationId: onReferralCreated
summary: Referral Created Event
description: A referral was created.
bindings:
http:
type: request
method: POST
bindingVersion: '0.3.0'
message:
$ref: '#/components/messages/ReferralCreated'
transferFailed:
description: >-
Fired when a transfer fails. Covers incoming and outgoing Brex Cash
transactions and supports ACH, DOMESTIC_WIRE, CHEQUE, INTERNATIONAL_WIRE,
BOOK_TRANSFER, STABLECOIN, and the ACH_RETURN / WIRE_RETURN /
CHEQUE_RETURN return types.
publish:
operationId: onTransferFailed
summary: Transfer Failed Event
description: >-
Transfer failed events for both incoming and outgoing Brex Cash
transactions.
bindings:
http:
type: request
method: POST
bindingVersion: '0.3.0'
message:
$ref: '#/components/messages/TransferFailed'
transferProcessed:
description: >-
Fired when a transfer is processed. Covers incoming and outgoing Brex Cash
transactions across the same payment types as `transferFailed`.
publish:
operationId: onTransferProcessed
summary: Transfer Processed Event
description: >-
Transfer processed events for both incoming and outgoing Brex Cash
transactions.
bindings:
http:
type: request
method: POST
bindingVersion: '0.3.0'
message:
$ref: '#/components/messages/TransferProcessed'
userUpdated:
description: >-
Fired when a Brex user is updated. The payload lists which user attributes
changed (STATUS, MANAGER_ID, DEPARTMENT_ID, LOCATION_ID).
publish:
operationId: onUserUpdated
summary: User Updated Event
description: Updates on Brex users.
bindings:
http:
type: request
method: POST
bindingVersion: '0.3.0'
message:
$ref: '#/components/messages/UserUpdated'
components:
messages:
AccountingRecordReadyForExport:
name: AccountingRecordReadyForExport
title: Accounting Record Ready For Export
summary: A list of accounting records are ready for export.
contentType: application/json
payload:
$ref: '#/components/schemas/AccountingRecordReadyForExport'
ExpensePaymentUpdated:
name: ExpensePaymentUpdated
title: Expense Payment Updated
summary: An expense payment changed status on a Brex Card.
contentType: application/json
payload:
$ref: '#/components/schemas/ExpensePaymentUpdated'
ReferralActivated:
name: ReferralActivated
title: Referral Activated
summary: A user signed up with a referral link.
contentType: application/json
payload:
$ref: '#/components/schemas/ReferralActivated'
ReferralApplicationStatusChanged:
name: ReferralApplicationStatusChanged
title: Referral Application Status Changed
summary: A referral's application status changed.
contentType: application/json
payload:
$ref: '#/components/schemas/ReferralApplicationStatusChanged'
ReferralCreated:
name: ReferralCreated
title: Referral Created
summary: A referral was created.
contentType: application/json
payload:
$ref: '#/components/schemas/ReferralCreated'
TransferFailed:
name: TransferFailed
title: Transfer Failed
summary: A Brex Cash transfer failed.
contentType: application/json
payload:
$ref: '#/components/schemas/TransferFailed'
TransferProcessed:
name: TransferProcessed
title: Transfer Processed
summary: A Brex Cash transfer was processed.
contentType: application/json
payload:
$ref: '#/components/schemas/TransferProcessed'
UserUpdated:
name: UserUpdated
title: User Updated
summary: A Brex user was updated.
contentType: application/json
payload:
$ref: '#/components/schemas/UserUpdated'
schemas:
WebhookEventType:
type: string
description: >-
The full set of webhook event type identifiers recognized by Brex. The
Brex Embedded program (EMBEDDED_* and
PARTNERSHIP_INTEGRATION_CONNECTION_UPDATED) extends this enum but does
not publish public payload schemas.
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
- EMBEDDED_CARD_SHIPPING_UPDATED
- EMBEDDED_DISPUTE_UPDATED
- PARTNERSHIP_INTEGRATION_CONNECTION_UPDATED
- EMBEDDED_CARD_AUTHORIZATION
- EMBEDDED_FRAUD_ALERT
- EMBEDDED_BILLING_GROUP_UPDATED
- EMBEDDED_LEGAL_ENTITY_UPDATED
- EMBEDDED_BILLING_STATEMENT_UPDATED
- EMBEDDED_USER_STATUS_UPDATED
- ACCOUNTING_RECORD_READY_FOR_EXPORT
ApplicationStatus:
type: string
description: >
Application status of a product.
`NO_ACCOUNT` - There is no active application, and the product account
is not provisioned.
`ACTIVE` - The application is approved, and the product account is
provisioned.
`NOT_SUBMITTED` - The application is started but not yet submitted.
`INFORMATION_PENDING` - The application is submitted and additional
information is requested.
`MANUAL_REVIEW` - The application is under manual review.
`PROCESSING` - The application is submitted and is under review.
`REJECTED` - The application is rejected.
`CLOSED` - The product account is closed.
enum:
- NO_ACCOUNT
- ACTIVE
- NOT_SUBMITTED
- INFORMATION_PENDING
- MANUAL_REVIEW
- PROCESSING
- REJECTED
- CLOSED
ProductApplication:
type: object
description: The product application details for the referral.
required:
- cash
properties:
cash:
$ref: '#/components/schemas/ApplicationStatus'
ExpensePaymentStatus:
type: string
description: >-
`PENDING`: The transaction is yet to be captured. It may be approved,
yet to be approved, or yet to be declined.
`DECLINED`: The transaction was declined.
enum:
- PENDING
- DECLINED
ExpensePaymentType:
type: string
description: >-
`PURCHASE`: A pending transaction for making a purchase.
`REFUND`: A pending transaction for a refund.
`WITHDRAWAL`: A pending transaction for a withdrawal.
`DECLINED`: A pending transaction that was declined and will not be
completed.
enum:
- PURCHASE
- REFUND
- WITHDRAWAL
- DECLINED
PaymentType:
type: string
description: >-
Only ACH, DOMESTIC_WIRE, CHEQUE, INTERNATIONAL_WIRE, BOOK_TRANSFER, and
STABLECOIN details can be retrieved from the Payments API.
enum:
- ACH
- DOMESTIC_WIRE
- CHEQUE
- INTERNATIONAL_WIRE
- BOOK_TRANSFER
- STABLECOIN
- ACH_RETURN
- WIRE_RETURN
- CHEQUE_RETURN
PaymentStatusReason:
type: string
description: The reason for the payment's status.
enum:
- OTHER
- APPROVED
- EXCEEDED_BUDGET_LIMIT
- BUDGET_EXPIRED
- NO_BUDGET
- BUDGET_NOT_YET_STARTED
- BUDGET_CATEGORY_RESTRICTION
- BUDGET_MERCHANT_RESTRICTION
- SUSPECTED_FRAUD
- EXCEEDED_GLOBAL_LIMIT
- EXCEEDED_USER_LIMIT
- EXCEEDED_CARD_LIMIT
- INVALID_EXPIRATION_DATE
- CARD_NOT_ACTIVE
- INVALID_CARD_CREDENTIALS
- INVALID_BILLING_ADDRESS
- CARD_SUSPENDED
- CARD_TERMINATED
- CARD_EXPIRED
- MCC_BLOCKED
- USER_SUSPENDED
- INVALID_PIN
- INVALID_CVV
- EXCEEDED_PIN_ATTEMPTS
- INSIDE_SANCTIONED_COUNTRY
- SOFT_EXPIRATION
- TRANSFERRED_CARD_NEW_MERCHANT
- EXCEEDED_ANCESTOR_BUDGET_LIMIT
- EXCEEDED_BUDGET_TRANSACTION_LIMIT
- TOS_BLOCKED
- COMPLIANCE_BLOCKED
UserAttributes:
type: string
description: A user attribute that can change and trigger USER_UPDATED.
enum:
- STATUS
- MANAGER_ID
- DEPARTMENT_ID
- LOCATION_ID
Money:
type: object
description: >
Money fields can be signed or unsigned. Fields are signed (an unsigned
value will be interpreted as positive). The amount of money will be
represented in the smallest denomination of the currency indicated. For
example, USD 7.00 will be represented in cents with an amount of 700.
required:
- amount
properties:
amount:
type: integer
format: int64
description: >-
The amount of money, in the smallest denomination of the currency
indicated by currency. For example, when currency is USD, amount is
in cents.
example: 700
currency:
type: string
description: The type of currency, in ISO 4217 format.
default: USD
example: USD
Merchant:
type: object
required:
- country
- mcc
- raw_descriptor
properties:
raw_descriptor:
type: string
description: Merchant descriptor, it can be the merchant name.
mcc:
type: string
description: >-
A four-digit number listed in ISO 18245 for retail financial
services, e.g. 4121 for Taxicabs and Rideshares.
country:
type: string
description: Merchant's country, in ISO 3166-1 alpha-3 format.
AccountingRecordReadyForExport:
type: object
description: A list of accounting records are ready for export.
required:
- accountingRecordIds
- companyId
- event_type
properties:
event_type:
allOf:
- $ref: '#/components/schemas/WebhookEventType'
example: ACCOUNTING_RECORD_READY_FOR_EXPORT
accountingRecordIds:
type: array
description: List of accounting record IDs ready for export.
items:
type: string
companyId:
type: string
description: >-
The `id` returned by the Get Company endpoint of the Team API. Use
it to determine which access token to use when fetching details.
ExpensePaymentUpdated:
type: object
description: >-
Sent when an expense payment changes status. Subscription must be
registered with a user with the CARD_ADMIN role.
required:
- card_id
- company_id
- event_type
- expense_id
- merchant
- payment_description
- payment_status
- payment_status_reason
- payment_type
- version
properties:
event_type:
allOf:
- $ref: '#/components/schemas/WebhookEventType'
example: EXPENSE_PAYMENT_UPDATED
expense_id:
type: string
description: Unique ID associated with the expense.
payment_status:
$ref: '#/components/schemas/ExpensePaymentStatus'
payment_type:
$ref: '#/components/schemas/ExpensePaymentType'
company_id:
type: string
description: >-
The `id` returned by the Get Company endpoint of the Team API. Use
it to determine which access token to use when fetching details.
purchased_at:
type: string
format: date-time
description: The time the purchase was made.
amount:
allOf:
- $ref: '#/components/schemas/Money'
description: Succeeded by the billing_amount field.
deprecated: true
original_amount:
allOf:
- $ref: '#/components/schemas/Money'
description: >-
The original amount of the expense is the amount that the employee
submitted or incurred for reimbursements or card spends.
billing_amount:
allOf:
- $ref: '#/components/schemas/Money'
description: >-
The billing amount of the expense is the amount that the entity is
charged, on the entity's currency, for reimbursements or card
spends.
payment_description:
type: string
description: Succeeded by the merchant::raw_descriptor field.
deprecated: true
card_id:
type: string
description: The ID of the card that is associated with the expense.
merchant:
allOf:
- $ref: '#/components/schemas/Merchant'
description: The merchant associated with the expense.
payment_status_reason:
$ref: '#/components/schemas/PaymentStatusReason'
payment_authorization_code:
type: string
description: The authorization code of the associated card expense.
version:
type: integer
format: int32
minimum: 1
description: >-
Version of this expense. This value starts at 1 and is incremented
by 1 with every update.
example: 1
ReferralActivated:
type: object
description: Sent when a user signs up with the referral link.
required:
- event_type
- referral_id
properties:
event_type:
allOf:
- $ref: '#/components/schemas/WebhookEventType'
example: REFERRAL_ACTIVATED
referral_id:
type: string
description: The referral ID.
ReferralApplicationStatusChanged:
type: object
description: Sent when the application status is changed for a referral.
required:
- application
- event_type
- referral_id
properties:
event_type:
allOf:
- $ref: '#/components/schemas/WebhookEventType'
example: REFERRAL_APPLICATION_STATUS_CHANGED
referral_id:
type: string
description: The referral ID.
application:
$ref: '#/components/schemas/ProductApplication'
ReferralCreated:
type: object
description: Sent when a referral is created.
required:
- event_type
- referral_id
properties:
event_type:
allOf:
- $ref: '#/components/schemas/WebhookEventType'
example: REFERRAL_CREATED
referral_id:
type: string
description: The referral ID.
TransferFailed:
type: object
description: Sent when a transfer failed.
required:
- company_id
- event_type
- payment_type
- transfer_id
properties:
event_type:
allOf:
- $ref: '#/components/schemas/WebhookEventType'
example: TRANSFER_FAILED
transfer_id:
type: string
description: The transfer ID.
payment_type:
$ref: '#/components/schemas/PaymentType'
return_for_id:
type: string
description: >-
The original transaction ID that is returned when the payment type
is ACH_RETURN, WIRE_RETURN, or CHEQUE_RETURN.
company_id:
type: string
description: >-
The `id` returned by the Get Company endpoint of the Team API. Use
it to determine which access token to use when fetching details.
TransferProcessed:
type: object
description: Sent when a transfer is processed.
required:
- company_id
- event_type
- payment_type
- transfer_id
properties:
event_type:
allOf:
- $ref: '#/components/schemas/WebhookEventType'
example: TRANSFER_PROCESSED
transfer_id:
type: string
description: The transfer ID.
payment_type:
$ref: '#/components/schemas/PaymentType'
return_for_id:
type: string
description: >-
The original transaction ID that is returned when the payment type
is ACH_RETURN, WIRE_RETURN, or CHEQUE_RETURN.
company_id:
type: string
description: >-
The `id` returned by the Get Company endpoint of the Team API. Use
it to determine which access token to use when fetching details.
UserUpdated:
type: object
description: Sent when a user is updated.
required:
- company_id
- event_type
- updated_attributes
- user_id
properties:
event_type:
allOf:
- $ref: '#/components/schemas/WebhookEventType'
example: USER_UPDATED
user_id:
type: string
description: The ID of the user that was updated.
company_id:
type: string
description: >-
The `id` returned by the Get Company endpoint of the Team API. Use
it to determine which access token to use when fetching details.
updated_attributes:
type: array
description: The set of user attributes that changed in this update.
items:
$ref: '#/components/schemas/UserAttributes'