Skip to main content

Overview

The events client provides real-time streaming of authorization events via Server-Sent Events (SSE). Consume events with an async generator via stream(), or use the subscribe() convenience wrapper for callback-based consumption. Access the events client via client.events.

Stream

Open an SSE connection and yield authorization events as an async generator. The connection remains open until you break out of the loop or the server closes it.

Parameters

GrantexEvent

Subscribe

Subscribe to events with a callback function. Returns an unsubscribe callable to close the connection. This is a convenience wrapper around stream().

Parameters

Returns

Returns a callable. Call it to close the SSE connection and stop receiving events.

Event types

grant.created

Emitted when a new grant is created after user consent.

grant.revoked

Emitted when a grant is revoked.

token.issued

Emitted when a grant token is issued (via exchange or refresh).

budget.threshold

Emitted when a grant’s budget consumption crosses 50% or 80%.

budget.exhausted

Emitted when a grant’s budget is fully consumed.

Example: Budget Alert Monitor

Last modified on March 8, 2026