Usage Events
A Usage Event represents a customer's usage of a product at a specific timestamp.
POST /api/v1/usage_events/ingestPOST /api/v1/usage_events/batch_ingestPOST /api/v1/usage_events/void
Ingest a usage event
POST /api/v1/usage_events/ingest
Ingest a single usage event. The event is validated synchronously, but is processed asynchronously. For higher rate limits, please use the Batch Ingest Usage Events API instead.
ID of the Billing Customer related to this usage event.
The name of the event. Corresponds with the event_name field on a meter.
Time when this event happened. Must be within the past 35 days or up to 5 minutes in the future. Defaults to now.
A unique identifier for the event. This value must be unique within a rolling 35-day period and is limited to a maximum of 64 characters.
The payload of events, which contains arbitrary key-value pairs storing properties of the event.
ID of the Billing Customer related to this usage event.
The name of the event. Corresponds with the event_name field on a meter.
Time when this event happened.
Time when this usage event was ingested.
Unique identifier of this event in the merchant's system. Maximum length is 64.
The payload of events, which contains arbitrary key-value pairs storing properties of the event.
Indicates the status of the event. If true, it means the event has been voided and would not be counted into meter result calculation.
Time when this usage event was voided.
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 404 | Not Found. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$curl --request POST \> --url 'https://api-demo.airwallex.com/api/v1/usage_events/ingest' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json' \> --data '{> "billing_customer_id": "bcus_hkpd7fedfgb004apkvs",> "event_name": "api_call",> "happened_at": "<date-time>",> "merchant_event_id": "merchant_event_12345",> "properties": {> "quantity": "1",> "region": "us-east-1",> "userId": "userA"> }>}'
1{2 "billing_customer_id": "bcus_hkpd7fedfgb004apkvs",3 "event_name": "api_call",4 "happened_at": "<date-time>",5 "ingested_at": "<date-time>",6 "merchant_event_id": "merchant_event_12345",7 "properties": {8 "quantity": "1",9 "region": "us-east-1",10 "userId": "userA"11 },12 "voided": false,13 "voided_at": "2025-08-03T00:00:00+0000"14}
Batch ingest usage events
POST /api/v1/usage_events/batch_ingest
Ingest new usage events in a batch. The events are validated and processed asynchronously. If errors occur, webhook events will be published. Maximum 10 events per request.
List of usage events to ingest. Maximum 10 events per request.
ID of the Billing Customer related to this usage event.
The name of the event. Corresponds with the event_name field on a meter.
Time when this event happened. Must be within the past 35 days or up to 5 minutes in the future. Defaults to now.
A unique identifier for the event. This value must be unique within a rolling 35-day period and is limited to a maximum of 64 characters.
The payload of events, which contains arbitrary key-value pairs storing properties of the event.
Accepted
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 404 | Not Found. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$curl --request POST \> --url 'https://api-demo.airwallex.com/api/v1/usage_events/batch_ingest' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json' \> --data '{> "events": [> {> "billing_customer_id": "bcus_hkpd7fedfgb004apkvs",> "event_name": "api_call",> "merchant_event_id": "merchant_event_12345",> "properties": {> "quantity": "1",> "region": "us-east-1",> "userId": "userA"> }> }> ]>}'
Void a usage event
POST /api/v1/usage_events/void
Void a previous usage event ingested within 35 days.
Unique identifier of a previous event.
Accepted
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 404 | Not Found. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$curl --request POST \> --url 'https://api-demo.airwallex.com/api/v1/usage_events/void' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json' \> --data '{> "merchant_event_id": "merchant_event_12345">}'