/** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. */ export interface paths { '/v1/webhooks': { /** * List Webhooks * @description List the webhooks you have registered */ get: operations['listSubscription'] /** * Register Webhook * @description Register an endpoint to start receiving selected webhook events */ post: operations['createSubscription'] } '/v1/webhooks/secrets': { /** * List Webhook Secrets * @description * 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. */ get: operations['listSecrets'] } '/v1/webhooks/{id}': { /** * Get Webhook * @description Get details of a webhook */ get: operations['getSubscriptionById'] /** * Update Webhook * @description Update a webhook. * You can update the endpoint url, event types that the endpoint receives, or temporarily deactivate the webhook. */ put: operations['updateSubscription'] /** * Unregister Webhook * @description Unregister a webhook if you want to stop receiving webhook events */ delete: operations['deleteSubscription'] } } export type webhooks = Record export interface components { schemas: { /** * @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 {string} */ ApplicationStatus: | 'NO_ACCOUNT' | 'ACTIVE' | 'NOT_SUBMITTED' | 'INFORMATION_PENDING' | 'MANUAL_REVIEW' | 'PROCESSING' | 'REJECTED' | 'CLOSED' CreateWebhookSubscriptionRequest: { url: string /** * @description The Brex API sends webhooks for the events listed below. * For more details, see the [webhook guide](/docs/webhooks/#webhook-event-catalog) and * [webhook events API reference](/openapi/webhooks_api/#tag/Webhook-Events). */ event_types: components['schemas']['WebhookEventType'][] } ExpensePaymentEvent: components['schemas']['ExpensePaymentStatusUpdatedEvent'] /** * @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 {string} */ ExpensePaymentStatus: 'PENDING' | 'DECLINED' /** * @description The reason for the payment's status. * @enum {string} */ ExpensePaymentStatusReason: | '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' /** * @description The webhook will be sent when an expense payment changes status. * Account must be on Brex Empower to receive these events. Subscription must be registered with a user with the CARD_ADMIN role. */ ExpensePaymentStatusUpdatedEvent: { event_type: components['schemas']['WebhookEventType'] /** @description Unique ID associated with the expense. */ expense_id: string payment_status: components['schemas']['ExpensePaymentStatus'] payment_status_reason: components['schemas']['ExpensePaymentStatusReason'] payment_type: components['schemas']['ExpensePaymentType'] /** * @description * This is the `id` returned in the [Get Company](/openapi/team_api/#operation/getCompany) endpoint. * You can use the `company_id` to determine which access token to use when you get the details from our API endpoints. */ company_id?: string /** * Format: date-time * @description The time the purchase was made. */ purchased_at?: string /** @description The original amount of the expense is the amount that the employee submitted or incurred for reimbursements or card spends. */ original_amount?: 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. */ billing_amount?: components['schemas']['Money'] /** @description The ID of the card that is associated with the expense. */ card_id?: string /** @description The merchant associated with the expense. */ merchant?: components['schemas']['Merchant'] /** @description The authorization code of the associated card expense. */ payment_authorization_code?: string /** * @deprecated * @description Succeeded by the billing_amount field. */ amount?: components['schemas']['Money'] /** * @deprecated * @description Succeeded by the merchant::raw_descriptor field. */ payment_description?: 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 {string} */ ExpensePaymentType: 'PURCHASE' | 'REFUND' | 'WITHDRAWAL' | 'DECLINED' Merchant: { /** @description Merchant descriptor, it can be the merchant name. */ raw_descriptor: string /** @description A four-digit number listed in ISO 18245 for retail financial services, e.g. 4121 for Taxicabs and Rideshares. Please refer to https://en.wikipedia.org/wiki/Merchant_category_code for more details. */ mcc: string /** @description Merchant's country, in ISO 3166-1 alpha-3 format. */ country: string } /** * @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. */ Money: { /** * 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. */ amount?: number /** @description The type of currency, in ISO 4217 format. Default to USD if not specified */ currency?: string | null } Page_WebhookSubscription_: { next_cursor?: string | null items: components['schemas']['WebhookSubscription'][] } /** * @description Only ACH, DOMESTIC_WIRE, CHEQUE, INTERNATIONAL_WIRE and BOOK_TRANSFER details can be retrieved from the Payments API. * @enum {string} */ PaymentType: | 'ACH' | 'DOMESTIC_WIRE' | 'CHEQUE' | 'INTERNATIONAL_WIRE' | 'BOOK_TRANSFER' | 'ACH_RETURN' | 'WIRE_RETURN' | 'CHEQUE_RETURN' ProductApplication: { cash: components['schemas']['ApplicationStatus'] } /** @description The webhook will be sent when a user signs up with the referral link. */ ReferralActivatedEvent: { event_type: components['schemas']['WebhookEventType'] referral_id: string } /** @description The webhook will be sent when the application status is changed. */ ReferralApplicationStatusChangedEvent: { event_type: components['schemas']['WebhookEventType'] referral_id: string application: components['schemas']['ProductApplication'] } /** @description The webhook will be sent when a referral is created. */ ReferralCreatedEvent: { event_type: components['schemas']['WebhookEventType'] referral_id: string } ReferralEvent: | components['schemas']['ReferralCreatedEvent'] | components['schemas']['ReferralActivatedEvent'] | components['schemas']['ReferralApplicationStatusChangedEvent'] TransferEvent: { company_id: string payment_type: components['schemas']['PaymentType'] return_for_id?: string | null } & ( | components['schemas']['TransferProcessedEvent'] | components['schemas']['TransferFailedEvent'] ) /** @description The webhook will be sent when a transfer failed. */ TransferFailedEvent: { event_type: components['schemas']['WebhookEventType'] transfer_id: string payment_type: components['schemas']['PaymentType'] /** @description The original transaction ID that is returned when the payment type is ACH_RETURN, WIRE_RETURN and CHEQUE_RETURN. */ return_for_id?: string | null /** * @description * This is the `id` returned in the [Get Company](/openapi/team_api/#operation/getCompany) endpoint. * You can use the `company_id` to determine which access token to use when you get the details from our API endpoints. */ company_id?: string } /** @description The webhook will be sent when a transfer is processed. */ TransferProcessedEvent: { event_type: components['schemas']['WebhookEventType'] transfer_id: string payment_type: components['schemas']['PaymentType'] /** @description The original transaction ID that is returned when the payment type is ACH_RETURN, WIRE_RETURN and CHEQUE_RETURN. */ return_for_id?: string | null /** * @description * This is the `id` returned in the [Get Company](/openapi/team_api/#operation/getCompany) endpoint. * You can use the `company_id` to determine which access token to use when you get the details from our API endpoints. */ company_id?: string } UpdateWebhookSubscriptionRequest: { url: string event_types: components['schemas']['WebhookEventType'][] status: components['schemas']['UpdateWebhookSubscriptionStatus'] } /** @enum {string} */ UpdateWebhookSubscriptionStatus: 'ACTIVE' | 'INACTIVE' /** @enum {string} */ UserAttributes: 'STATUS' | 'MANAGER_ID' | 'DEPARTMENT_ID' | 'LOCATION_ID' UserEvent: components['schemas']['UserUpdatedEvent'] /** @description The webhook will be sent when a user is updated. */ UserUpdatedEvent: { event_type: components['schemas']['WebhookEventType'] user_id: string company_id: string updated_attributes: components['schemas']['UserAttributes'][] } /** @enum {string} */ WebhookEventType: | 'REFERRAL_CREATED' | 'REFERRAL_ACTIVATED' | 'REFERRAL_APPLICATION_STATUS_CHANGED' | 'TRANSFER_PROCESSED' | 'TRANSFER_FAILED' | 'EXPENSE_PAYMENT_UPDATED' | 'USER_UPDATED' WebhookSecret: { secret: string status: components['schemas']['WebhookSecretStatus'] } /** @enum {string} */ WebhookSecretStatus: 'ACTIVE' | 'PENDING_REVOKE' WebhookSubscription: { id: string url: string event_types: components['schemas']['WebhookEventType'][] status: components['schemas']['WebhookSubscriptionStatus'] } /** @enum {string} */ WebhookSubscriptionStatus: 'ACTIVE' | 'INACTIVE' | 'ERROR' } responses: never parameters: never requestBodies: never headers: never pathItems: never } export type $defs = Record export type external = Record export interface operations { /** * List Webhooks * @description List the webhooks you have registered */ listSubscription: { parameters: { query?: { cursor?: string | null limit?: number | null } } responses: { /** @description listSubscription 200 response */ 200: { content: { 'application/json': components['schemas']['Page_WebhookSubscription_'] } } /** @description Bad request */ 400: { content: never } /** @description Unauthorized */ 401: { content: never } /** @description Forbidden */ 403: { content: never } /** @description Internal server error */ 500: { content: never } } } /** * Register Webhook * @description Register an endpoint to start receiving selected webhook events */ createSubscription: { parameters: { header: { 'Idempotency-Key': string } } requestBody: { content: { 'application/json': components['schemas']['CreateWebhookSubscriptionRequest'] } } responses: { /** @description createSubscription 200 response */ 200: { content: { 'application/json': components['schemas']['WebhookSubscription'] } } /** @description Bad request */ 400: { content: never } /** @description Unauthorized */ 401: { content: never } /** @description Forbidden */ 403: { content: never } /** @description Internal server error */ 500: { content: never } } } /** * List Webhook Secrets * @description * 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. */ listSecrets: { responses: { /** @description listSecrets 200 response */ 200: { content: { 'application/json': components['schemas']['WebhookSecret'][] } } /** @description Bad request */ 400: { content: never } /** @description Unauthorized */ 401: { content: never } /** @description Forbidden */ 403: { content: never } /** @description Internal server error */ 500: { content: never } } } /** * Get Webhook * @description Get details of a webhook */ getSubscriptionById: { parameters: { path: { id: string } } responses: { /** @description getSubscriptionById 200 response */ 200: { content: { 'application/json': components['schemas']['WebhookSubscription'] } } /** @description Bad request */ 400: { content: never } /** @description Unauthorized */ 401: { content: never } /** @description Forbidden */ 403: { content: never } /** @description Internal server error */ 500: { content: never } } } /** * Update Webhook * @description Update a webhook. * You can update the endpoint url, event types that the endpoint receives, or temporarily deactivate the webhook. */ updateSubscription: { parameters: { path: { id: string } } requestBody: { content: { 'application/json': components['schemas']['UpdateWebhookSubscriptionRequest'] } } responses: { /** @description updateSubscription 200 response */ 200: { content: { 'application/json': components['schemas']['WebhookSubscription'] } } /** @description Bad request */ 400: { content: never } /** @description Unauthorized */ 401: { content: never } /** @description Forbidden */ 403: { content: never } /** @description Internal server error */ 500: { content: never } } } /** * Unregister Webhook * @description Unregister a webhook if you want to stop receiving webhook events */ deleteSubscription: { parameters: { path: { id: string } } responses: { /** @description deleteSubscription 200 response */ 200: { content: never } /** @description Bad request */ 400: { content: never } /** @description Unauthorized */ 401: { content: never } /** @description Forbidden */ 403: { content: never } /** @description Internal server error */ 500: { content: never } } } } export interface oasTypes { components: components external: external operations: operations paths: paths webhooks: webhooks } export default oasTypes