API key events
Receive notifications to monitor all actions and state changes that occur on your API keys, increasing the security and operational visibility of your account
Use API key events to track creations, enablements, disablements, deletions and expirations without periodically querying the state of your keys.
Notifications are also sent when the change is made through the web interface. In operations with subaccounts, use the event data to identify which account had its key changed.
Available events
| Event | When it occurs | Handling in the integration |
|---|---|---|
ACCESS_TOKEN_CREATED | A new API key is created. | Record the key by its accessToken.id and sync its state. |
ACCESS_TOKEN_ENABLED | A disabled key is reactivated. | Update the key as enabled. |
ACCESS_TOKEN_DISABLED | A key is disabled manually or by the automatic lifecycle. | Update the key as disabled and check accessToken.disableReason. |
ACCESS_TOKEN_DELETED | A key is permanently removed. | Remove or invalidate the key reference in your system. |
ACCESS_TOKEN_EXPIRING_SOON | A key is close to expiring due to inactivity. | Notify or take the necessary actions before expiration. |
ACCESS_TOKEN_EXPIRED | A key expires permanently due to inactivity or the configured expiration date. | Consider the key invalid for new authentications. |
ACCESS_TOKEN_EXPIRING_SOON is related to the inactivity lifecycle and is not sent for keys that have a manually configured expiration date.
To learn about the deadlines and rules for expiration due to inactivity, see API keys.
Event payload
The notification is sent via POST with the event and the current key data.
{
"id": "evt_6561b631fa5580caadd00bbe3b858607&9193",
"event": "ACCESS_TOKEN_CREATED",
"dateCreated": "2026-05-19 12:25:15",
"account": {
"id": "47ed0d25-f9fb-4b35-b23a-d8895caf92b7",
"ownerId": null
},
"accessToken": {
"id": "cf7662a4-a7dd-40ec-b8de-d28617729501",
"name": "TEST Key",
"enabled": false,
"dateCreated": "2026-05-19 12:25:15",
"disableReason": "MANUAL",
"expirationDate": null,
"projectedExpirationDateByLackOfUse": null
}
}Important payload fields
| Field | Description |
|---|---|
id | Unique identifier of the event. Use it for idempotence. |
event | Identifies the change made to the key. |
account.id | Identifier of the account related to the event. |
accessToken.id | Key identifier. |
accessToken.enabled | Indicates whether the key is enabled. |
accessToken.disableReason | Reason for disabling, when applicable. |
accessToken.expirationDate | Manually configured expiration date. |
accessToken.projectedExpirationDateByLackOfUse | Projected expiration date due to inactivity. |
Use event to identify the change that originated the notification and the accessToken data to update the key's state in your system.
Possible values of accessToken.disableReason
accessToken.disableReason| Value | Scenario |
|---|---|
MANUAL | Manually disabled through the web application or the API. |
LACK_OF_USE | Automatically disabled due to inactivity. |
How to handle the events
To receive these events, configure an account Webhook with the ACCESS_TOKEN_* events your integration needs.
When receiving a notification:
- identify the account through the
account.idfield; - identify the change through the
eventfield; - persist the
idto prevent duplicate processing; - use
accessToken.idto find the key in your system; - update the key's state with the data received;
- respond
HTTP 200after confirming persistence and process additional rules asynchronously.
Webhooks follow the at least once model, so the same event may be sent more than once. The same event keeps the same id across redeliveries.
See how to implement idempotence in Webhooks.
When using authToken in the Webhook, validate the asaas-access-token header to authenticate the notifications received.
Attention
- As new products and features are added to Asaas, new attributes may be included in the Webhook. It is very important that your code is prepared not to throw exceptions if Asaas returns new attributes that your application does not handle, as this may interrupt the sync queue.
- We will send an email and announce on our Discord when new fields are added to the Webhook. The email will be sent to the notification email address defined in the webhook settings.
Next steps
Updated 16 days ago
