Skip to main content
Grantex provides real-time event streaming endpoints that push authorization lifecycle events as they happen. Combined with the @grantex/destinations package, you can forward events to SIEMs, data warehouses, and message brokers without writing custom plumbing.

Architecture

The EventSource class connects to the SSE stream and dispatches each event to one or more destinations you configure. Destinations buffer events and flush them in batches for efficiency.

Event Types

Each event has the same envelope:

SSE Endpoint

GET /v1/events/stream returns a Server-Sent Events stream. Authenticate with your API key as a Bearer token.

curl

Filter by event type with the types query parameter (comma-separated):

TypeScript

Python

WebSocket Endpoint

GET /v1/events/ws upgrades to a WebSocket connection. Each message is a JSON-encoded event.

TypeScript

Python

@grantex/destinations Package

The @grantex/destinations package provides a high-level EventSource class that connects to the SSE stream and dispatches events to one or more destinations. Install it with:

Basic Usage

Available Destinations

Shared Configuration

All destinations accept these base options:

Graceful Shutdown

Always call stop() to flush pending events and close connections:

Custom Destinations

Implement the EventDestination interface to build your own:

Next Steps

Last modified on March 1, 2026