Stream expansion events from a permissions index
The ReadExpansions API streams pre-computed permission expansion events and index freshness events from a permissions index.
Each expansion event represents the addition or removal of a resolved (subject, relation, object) tuple from the indexed FGA relationship.
When called without a from cursor, the stream first delivers the full current set of expansion events, then continues emitting events as the underlying index is updated. When resuming a previously-closed stream, clients should provide a from cursor. The ReadExpansions API will resume streaming from that previously checkpointed position, without replaying the full history.
Clients must provide the ID of the expected authorization model via the authorization_model_id parameter.
In addition to expansion events, the stream emits:
- Freshness events indicating how up-to-date the index is at a given point in the stream.
- Periodic heartbeat messages to keep the connection alive.
- A stream-closed message when the server terminates the connection, including the reason for closure. The server will terminate streams periodically for traffic management. Clients must be prepared to reconnect in order to receive further expansions.
Event deduplication
Each expansion event carries an id field. The same logical event always produces the same id regardless of how many times it is redelivered. Downstream consumers can use this field to deduplicate events.
Examples
Stream all expansions from the beginning
To stream all expansions for index 01YCP46JKYM8FJCQ37NMBYHE5X in store 01G5JAVJ41T49E9TT3SKVS7X1J, call the ReadExpansions API. The stream will emit events like
Resume a stream from a checkpoint
To resume streaming without replaying events already processed, pass the from cursor returned in the last received event. The stream will pick up from that position.
Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Query Parameters
Optional continuation token for resuming stream