Register a webhook
You can register a webhook in two ways:- In the Trio App, following Creating your first webhook.
- Through the API, with Create webhook. All examples use the sandbox base URL
https://api.sandbox.trio.com.br.
The response is the webhook, with its
id and a generated notification_key: the key Trio signs the events with. Store the key; you need it to verify every notification you receive.
Choose the payload version
api_version selects the version of the event payloads Trio sends to the webhook. The version belongs to the webhook, not to your API credential, so you can register a second webhook on v200 and compare its payloads with the ones you already handle before switching.
Both versions share the same envelope, described in Content and structure. Onboarding events (category
entity) have a single format and are sent to webhooks of both versions.
Choose which events you receive
By default a webhook receives every event of your organization. Three optional fields narrow it down:event_categories_allowedlists the categories and types you want. For example,{ "category": "boleto", "types": ["settled", "created"] }delivers only those two boleto events;"types": []delivers every type of the category. The types are the ones listed on the Events page. Inevent_categories_allowedthe four document categories still use their V1 names, even for av200webhook: writecollecting_documentforin_document,collecting_document_refundforin_document_refund,payment_documentforout_documentandpayment_document_refundforout_document_refund. The V2 document names are refused with422in this field; every other category uses the same name in the filter and in the notification.entity_idlimits the webhook to the events of one entity.group_idlimits it to the events of one group of that entity.
Delivery and retries
Trio delivers every notification as an HTTP POST with a JSON body tonotification_url, with the headers described in Webhook authentication. Your endpoint must accept that method and content type.
- Acknowledge fast. Trio waits 1 second for the response. A
200,201,202or204status marks the notification as delivered. - Errors are retried. When your endpoint answers any other status, refuses the connection or fails the TLS handshake, Trio queues the notification for retry. The first retry comes 5 seconds after the failure and the wait doubles at each new failure, up to 3 minutes between attempts. Trio stops after 24 attempts or 1 hour after the first failure, whichever comes first.
- Timeouts are not retried. A notification your endpoint does not answer within 1 second is logged as a timeout and is not sent again. Read the resource back from the API if you suspect you missed an event.
- Serve the endpoint over HTTPS so the payload is protected in transit.
Manage webhooks
Every webhook of the organization is managed through the API or the Trio App:- List webhooks returns every webhook in a single page; the list is not paginated.
- Get webhook returns one webhook, including its
notification_key. - Replace webhook replaces a webhook with the one you send. Send every field: an omitted field is cleared, so leaving out
entity_idorevent_categories_allowedremoves that filter. - Delete webhook stops the deliveries.
Next steps
- Webhook authentication: verify that a notification came from Trio.
- Content and structure: read the envelope every notification shares.
- Events: every category and type, with the
dataof each. - Creating your first webhook: register a webhook from the Trio App, step by step.

