Airwallex logo
Airwallex logoAirwallex logo

Partner Webhooks

Copy for LLMView as Markdown

Partner Webhooks API allows OAuth applications to receive real-time events originating from OAuth-authorized Airwallex accounts.

To receive webhook events on behalf of your users, first create a Webhook for your OAuth application and connect the target OAuth-authorized account to it. The types of events you can receive are limited by the Scopes set out in the OAuth authorization. During the consent flow, users will authorize your application for listening to their webhook events.

Partner Webhooks API requires HTTP Basic authorization for OAuth applications. The HTTP header must include Authorization: Basic [token] where token is a Base64 encoded string of [client_id]:[client_secret]. The client_id and client_secret are issued by Airwallex for your OAuth application.

Endpoints
POST /partner-api/v1/webhooks/create
GET /partner-api/v1/webhooks/{id}
POST /partner-api/v1/webhooks/{id}/update
POST /partner-api/v1/webhooks/{id}/delete
GET /partner-api/v1/webhooks
POST /partner-api/v1/webhooks/{id}/connect
POST /partner-api/v1/webhooks/{id}/disconnect

Create a webhook

POST /partner-api/v1/webhooks/create

Creates a new Webhook and subscribes to a list of webhook events from Airwallex.

Request body
urlrequiredstring

The endpoint where events are sent to.

eventsrequiredarray

A list of events subscribed by this webhook. Events cannot be modified after creation. Only events matching your API key scopes are allowed.

request_idrequiredstring

A unique request identifier specified by the client for idempotency. Up to 50 characters.

Response body - 200 OK
idstring

The unique identifier of the Webhook object.

urlstring

The endpoint where events are sent to.

secretstring

The secret to verify that events are sent from Airwallex. See this guide for details.

versionstring

The API version API which controls the event payload structure. It should be in YYYY-MM-DD format, e.g. 2022-11-11.

eventsarray

A list of events subscribed by this webhook. Events cannot be modified after creation. Only events matching your API key scopes are allowed.

created_atstring

The time when this webhook was created.

updated_atstring

The time when this webhook was last updated.

request_idstring

A unique request identifier specified by the client for idempotency. Up to 50 characters.

Errors
Error statusDescription
400

Possible errors: field_required, invalid_argument

401

Possible errors: credentials_invalid, credentials_expired

429

Too many requests

500

Service unavailable

POST /partner-api/v1/webhooks/create
$curl --request POST \
> --url 'https://api-demo.airwallex.com/partner-api/v1/webhooks/create' \
> --header 'Authorization: Basic {{BASIC_AUTH_TOKEN}}' \
> --header 'Content-Type: application/json' \
> --data '{
> "url": "https://www.airwallex.com",
> "version": "2022-11-11",
> "events": [
> "account.active",
> "account.connected",
> "account.suspended"
> ],
> "request_id": "c238a67b-75ae-446f-919c-e62c2a577631"
>}'
Response (200 OK)
1{
2 "created_at": "2022-12-23T02:57:29+0000",
3 "events": [
4 "account.active",
5 "account.connected",
6 "account.suspended"
7 ],
8 "id": "wh_E6JwepZbKpppjYftl3JUEXPI-ocQiSHS",
9 "request_id": "c238a67b-75ae-446f-919c-e62c2a577631",
10 "secret": "whsec_RBS_GKogxv5PAdFUPABg94kjjLGRW50I",
11 "updated_at": "2022-12-23T02:57:29+0000",
12 "url": "http://www.airwallex.com",
13 "version": "2022-11-11"
14}
Was this section helpful?

Retrieve a webhook

GET /partner-api/v1/webhooks/{id}

Retrieves the details of a Webhook.

Parameters
idrequiredstring

Unique identifier of the Webhook object.

Response body - 200 OK
idstring

The unique identifier of the Webhook object.

urlstring

The endpoint where events are sent to.

secretstring

The secret to verify that events are sent from Airwallex. See this guide for details.

versionstring

The API version API which controls the event payload structure. It should be in YYYY-MM-DD format, e.g. 2022-11-11.

eventsarray

A list of events subscribed by this webhook. Events cannot be modified after creation. Only events matching your API key scopes are allowed.

created_atstring

The time when this webhook was created.

updated_atstring

The time when this webhook was last updated.

request_idstring

A unique request identifier specified by the client for idempotency. Up to 50 characters.

Errors
Error statusDescription
400

Possible errors: field_required, invalid_argument

401

Possible errors: credentials_invalid, credentials_expired

404

The requested resource doesn't exist

429

Too many requests

500

Service unavailable

GET /partner-api/v1/webhooks/{id}
$curl --request GET \
> --url 'https://api-demo.airwallex.com/partner-api/v1/webhooks/webhook_id' \
> --header 'Authorization: Basic {{BASIC_AUTH_TOKEN}}' \
> --header 'Content-Type: application/json'
Response (200 OK)
1{
2 "created_at": "2022-12-23T02:57:29+0000",
3 "events": [
4 "account.active",
5 "account.connected",
6 "account.suspended"
7 ],
8 "id": "wh_E6JwepZbKpppjYftl3JUEXPI-ocQiSHS",
9 "request_id": "c238a67b-75ae-446f-919c-e62c2a577631",
10 "secret": "whsec_RBS_GKogxv5PAdFUPABg94kjjLGRW50I",
11 "updated_at": "2022-12-23T02:57:29+0000",
12 "url": "http://www.airwallex.com",
13 "version": "2022-11-11"
14}
Was this section helpful?

Update a webhook

POST /partner-api/v1/webhooks/{id}/update

Updates the attributes of an existing Webhook. Only updates to url are currently supported.

Parameters
idrequiredstring

Unique identifier of the Webhook object.

Request body
urlrequiredstring

The endpoint where events are sent to.

Response body - 200 OK
idstring

The unique identifier of the Webhook object.

urlstring

The endpoint where events are sent to.

secretstring

The secret to verify that events are sent from Airwallex. See this guide for details.

versionstring

The API version API which controls the event payload structure. It should be in YYYY-MM-DD format, e.g. 2022-11-11.

eventsarray

A list of events subscribed by this webhook. Events cannot be modified after creation. Only events matching your API key scopes are allowed.

created_atstring

The time when this webhook was created.

updated_atstring

The time when this webhook was last updated.

request_idstring

A unique request identifier specified by the client for idempotency. Up to 50 characters.

Errors
Error statusDescription
400

Possible errors: field_required, invalid_argument

401

Possible errors: credentials_invalid, credentials_expired

404

The requested resource doesn't exist

429

Too many requests

500

Service unavailable

POST /partner-api/v1/webhooks/{id}/update
$curl --request POST \
> --url 'https://api-demo.airwallex.com/partner-api/v1/webhooks/webhook_id/update' \
> --header 'Authorization: Basic {{BASIC_AUTH_TOKEN}}' \
> --header 'Content-Type: application/json' \
> --data '{
> "url": "https://www.airwallex.com"
>}'
Response (200 OK)
1{
2 "created_at": "2022-12-23T02:57:29+0000",
3 "events": [
4 "account.active",
5 "account.connected",
6 "account.suspended"
7 ],
8 "id": "wh_E6JwepZbKpppjYftl3JUEXPI-ocQiSHS",
9 "request_id": "c238a67b-75ae-446f-919c-e62c2a577631",
10 "secret": "whsec_RBS_GKogxv5PAdFUPABg94kjjLGRW50I",
11 "updated_at": "2022-12-23T02:57:29+0000",
12 "url": "http://www.airwallex.com",
13 "version": "2022-11-11"
14}
Was this section helpful?

Delete a webhook

POST /partner-api/v1/webhooks/{id}/delete

Deletes a Webhook. A deleted webhook will no longer receive webhook events of any connected OAuth-authorized accounts.

Parameters
idrequiredstring

Unique identifier of the Webhook object.

Response body - 200 OK
No response body
Errors
Error statusDescription
400

Possible errors: field_required, invalid_argument

401

Possible errors: credentials_invalid, credentials_expired

404

The requested resource doesn't exist

429

Too many requests

500

Service unavailable

POST /partner-api/v1/webhooks/{id}/delete
$curl --request POST \
> --url 'https://api-demo.airwallex.com/partner-api/v1/webhooks/webhook_id/delete' \
> --header 'Authorization: Basic {{BASIC_AUTH_TOKEN}}' \
> --header 'Content-Type: application/json'
Was this section helpful?

Get a list of webhooks

GET /partner-api/v1/webhooks

Retrieves a list of Webhooks.

Parameters
page_numrequiredinteger

Page number starting from 0. Defaults to 0.

page_sizerequiredinteger

Number of Webhooks per page. Defaults to 20.

Response body - 200 OK
has_moreboolean

A flag which identifies whether there are more results.

itemsarray

Paged results.

items.idstring

The unique identifier of the Webhook object.

items.urlstring

The endpoint where events are sent to.

items.secretstring

The secret to verify that events are sent from Airwallex. See this guide for details.

items.versionstring

The API version API which controls the event payload structure. It should be in YYYY-MM-DD format, e.g. 2022-11-11.

items.eventsarray

A list of events subscribed by this webhook. Events cannot be modified after creation. Only events matching your API key scopes are allowed.

items.created_atstring

The time when this webhook was created.

items.updated_atstring

The time when this webhook was last updated.

items.request_idstring

A unique request identifier specified by the client for idempotency. Up to 50 characters.

Errors
Error statusDescription
400

Possible errors: field_required, invalid_argument

401

Possible errors: credentials_invalid, credentials_expired

429

Too many requests

500

Service unavailable

GET /partner-api/v1/webhooks
$curl --request GET \
> --url 'https://api-demo.airwallex.com/partner-api/v1/webhooks' \
> --header 'Authorization: Basic {{BASIC_AUTH_TOKEN}}' \
> --header 'Content-Type: application/json'
Response (200 OK)
1{
2 "has_more": true,
3 "items": [
4 {
5 "created_at": "2022-12-23T02:57:29+0000",
6 "events": [
7 "account.active",
8 "account.connected",
9 "account.suspended"
10 ],
11 "id": "wh_E6JwepZbKpppjYftl3JUEXPI-ocQiSHS",
12 "request_id": "c238a67b-75ae-446f-919c-e62c2a577631",
13 "secret": "whsec_RBS_GKogxv5PAdFUPABg94kjjLGRW50I",
14 "updated_at": "2022-12-23T02:57:29+0000",
15 "url": "http://www.airwallex.com",
16 "version": "2022-11-11"
17 }
18 ]
19}
Was this section helpful?

Connect an OAuth-authorized entity to a Webhook

POST /partner-api/v1/webhooks/{id}/connect

Start receiving webhook events from an OAuth-authorized account or organization by connecting it to an existing Webhook.

Parameters
idrequiredstring

Unique identifier of the Webhook object.

Request body
account_idstring

The unique identifier of the OAuth-authorized Airwallex account, which can be found in the response of the token endpoint.

org_idstring

The ID of the OAuth-authorized Airwallex organization, which can be found in the response of token endpoint. Required when listening to Billing or Spend webhook events.

Response body - 200 OK
No response body
Errors
Error statusDescription
400

Possible errors: field_required, invalid_argument

401

Possible errors: credentials_invalid, credentials_expired

404

The requested resource doesn't exist

429

Too many requests

500

Service unavailable

POST /partner-api/v1/webhooks/{id}/connect
$curl --request POST \
> --url 'https://api-demo.airwallex.com/partner-api/v1/webhooks/webhook_id/connect' \
> --header 'Authorization: Basic {{BASIC_AUTH_TOKEN}}' \
> --header 'Content-Type: application/json' \
> --data '{
> "account_id": "acct_oSEKcGK_N1qtjYByZ1i3FQ",
> "org_id": "org_1QJuNBuwTj-yMH_NZkE1OA"
>}'
Was this section helpful?

Disconnect an OAuth-authorized account from a webhook

POST /partner-api/v1/webhooks/{id}/disconnect

Stop receiving webhook events from an OAuth-authorized account by disconnecting it from an existing Webhook.

Parameters
idrequiredstring

Unique identifier of the Webhook object.

Request body
account_idrequiredstring

The unique identifier of the OAuth-authorized Airwallex account, which can be found in the response of the token endpoint.

Response body - 200 OK
No response body
Errors
Error statusDescription
400

Possible errors: field_required, invalid_argument

401

Possible errors: credentials_invalid, credentials_expired

404

The requested resource doesn't exist

429

Too many requests

500

Service unavailable

POST /partner-api/v1/webhooks/{id}/disconnect
$curl --request POST \
> --url 'https://api-demo.airwallex.com/partner-api/v1/webhooks/webhook_id/disconnect' \
> --header 'Authorization: Basic {{BASIC_AUTH_TOKEN}}' \
> --header 'Content-Type: application/json' \
> --data '{
> "account_id": "acct_oSEKcGK_N1qtjYByZ1i3FQ"
>}'
Was this section helpful?