Partner Webhooks
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.
POST /partner-api/v1/webhooks/createGET /partner-api/v1/webhooks/{id}POST /partner-api/v1/webhooks/{id}/updatePOST /partner-api/v1/webhooks/{id}/deleteGET /partner-api/v1/webhooksPOST /partner-api/v1/webhooks/{id}/connectPOST /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.
The endpoint where events are sent to.
The API version API which controls the event payload structure. It should be in YYYY-MM-DD format, e.g. 2022-11-11.
A list of events subscribed by this webhook. Events cannot be modified after creation. Only events matching your API key scopes are allowed.
A unique request identifier specified by the client for idempotency. Up to 50 characters.
The unique identifier of the Webhook object.
The endpoint where events are sent to.
The secret to verify that events are sent from Airwallex. See this guide for details.
The API version API which controls the event payload structure. It should be in YYYY-MM-DD format, e.g. 2022-11-11.
A list of events subscribed by this webhook. Events cannot be modified after creation. Only events matching your API key scopes are allowed.
The time when this webhook was created.
The time when this webhook was last updated.
A unique request identifier specified by the client for idempotency. Up to 50 characters.
| Error status | Description |
|---|---|
| 400 | Possible errors: |
| 401 | Possible errors: |
| 429 | Too many requests |
| 500 | Service unavailable |
$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">}'
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}
Retrieve a webhook
GET /partner-api/v1/webhooks/{id}
Retrieves the details of a Webhook.
Unique identifier of the Webhook object.
The unique identifier of the Webhook object.
The endpoint where events are sent to.
The secret to verify that events are sent from Airwallex. See this guide for details.
The API version API which controls the event payload structure. It should be in YYYY-MM-DD format, e.g. 2022-11-11.
A list of events subscribed by this webhook. Events cannot be modified after creation. Only events matching your API key scopes are allowed.
The time when this webhook was created.
The time when this webhook was last updated.
A unique request identifier specified by the client for idempotency. Up to 50 characters.
| Error status | Description |
|---|---|
| 400 | Possible errors: |
| 401 | Possible errors: |
| 404 | The requested resource doesn't exist |
| 429 | Too many requests |
| 500 | Service unavailable |
$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'
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}
Update a webhook
POST /partner-api/v1/webhooks/{id}/update
Updates the attributes of an existing Webhook. Only updates to url are currently supported.
Unique identifier of the Webhook object.
The endpoint where events are sent to.
The unique identifier of the Webhook object.
The endpoint where events are sent to.
The secret to verify that events are sent from Airwallex. See this guide for details.
The API version API which controls the event payload structure. It should be in YYYY-MM-DD format, e.g. 2022-11-11.
A list of events subscribed by this webhook. Events cannot be modified after creation. Only events matching your API key scopes are allowed.
The time when this webhook was created.
The time when this webhook was last updated.
A unique request identifier specified by the client for idempotency. Up to 50 characters.
| Error status | Description |
|---|---|
| 400 | Possible errors: |
| 401 | Possible errors: |
| 404 | The requested resource doesn't exist |
| 429 | Too many requests |
| 500 | Service unavailable |
$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">}'
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}
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.
Unique identifier of the Webhook object.
| Error status | Description |
|---|---|
| 400 | Possible errors: |
| 401 | Possible errors: |
| 404 | The requested resource doesn't exist |
| 429 | Too many requests |
| 500 | Service unavailable |
$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'
Get a list of webhooks
GET /partner-api/v1/webhooks
Retrieves a list of Webhooks.
Page number starting from 0. Defaults to 0.
Number of Webhooks per page. Defaults to 20.
A flag which identifies whether there are more results.
Paged results.
The unique identifier of the Webhook object.
The endpoint where events are sent to.
The secret to verify that events are sent from Airwallex. See this guide for details.
The API version API which controls the event payload structure. It should be in YYYY-MM-DD format, e.g. 2022-11-11.
A list of events subscribed by this webhook. Events cannot be modified after creation. Only events matching your API key scopes are allowed.
The time when this webhook was created.
The time when this webhook was last updated.
A unique request identifier specified by the client for idempotency. Up to 50 characters.
| Error status | Description |
|---|---|
| 400 | Possible errors: |
| 401 | Possible errors: |
| 429 | Too many requests |
| 500 | Service unavailable |
$curl --request GET \> --url 'https://api-demo.airwallex.com/partner-api/v1/webhooks' \> --header 'Authorization: Basic {{BASIC_AUTH_TOKEN}}' \> --header 'Content-Type: application/json'
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}
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.
Unique identifier of the Webhook object.
The unique identifier of the OAuth-authorized Airwallex account, which can be found in the response of the token endpoint.
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.
| Error status | Description |
|---|---|
| 400 | Possible errors: |
| 401 | Possible errors: |
| 404 | The requested resource doesn't exist |
| 429 | Too many requests |
| 500 | Service unavailable |
$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">}'
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.
Unique identifier of the Webhook object.
The unique identifier of the OAuth-authorized Airwallex account, which can be found in the response of the token endpoint.
| Error status | Description |
|---|---|
| 400 | Possible errors: |
| 401 | Possible errors: |
| 404 | The requested resource doesn't exist |
| 429 | Too many requests |
| 500 | Service unavailable |
$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">}'