Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/auth0_event-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Events are a way for Auth0 customers to synchronize, correlate or orchestrate ch
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream

1 change: 1 addition & 0 deletions docs/auth0_event-streams_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ auth0 event-streams create [flags]
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream

Expand Down
1 change: 1 addition & 0 deletions docs/auth0_event-streams_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ auth0 event-streams delete [flags]
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream

Expand Down
1 change: 1 addition & 0 deletions docs/auth0_event-streams_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ auth0 event-streams list [flags]
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream

Expand Down
1 change: 1 addition & 0 deletions docs/auth0_event-streams_redeliver-many.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ auth0 event-streams redeliver-many [stream-id] [flags]
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream

Expand Down
1 change: 1 addition & 0 deletions docs/auth0_event-streams_redeliver.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ auth0 event-streams redeliver [stream-id] [comma-separated-delivery-ids] [flags]
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream

Expand Down
1 change: 1 addition & 0 deletions docs/auth0_event-streams_show.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ auth0 event-streams show [flags]
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream

Expand Down
1 change: 1 addition & 0 deletions docs/auth0_event-streams_stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ auth0 event-streams stats [stream-id] [flags]
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream

Expand Down
75 changes: 75 additions & 0 deletions docs/auth0_event-streams_subscribe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
layout: default
parent: auth0 event-streams
has_toc: false
---
# auth0 event-streams subscribe

Subscribe to events emitted by your tenant via Server-Sent Events (SSE).

By default, every received event is rendered as a single, color-coded summary line:
TIME TYPE SOURCE EVENT-ID

Use --verbose to also print the full JSON payload after each summary, or --json / --json-compact to emit raw JSON suitable for piping into `jq`.

Heartbeat (`offset-only`) messages are suppressed by default and surfaced via a periodic faint indicator and a final cursor on disconnect; pass --show-heartbeats to render each one. Press Ctrl+C to disconnect; a per-type summary and the latest cursor will be printed so you can resume with --from.

## Usage
```
auth0 event-streams subscribe [flags]
```

## Examples

```
auth0 event-streams subscribe
auth0 event-streams subscribe --event-type user.created
auth0 event-streams subscribe --event-type user.created --event-type user.updated
auth0 event-streams subscribe --from-timestamp 2026-05-01T00:00:00Z
auth0 event-streams subscribe --from <cursor>
auth0 event-streams subscribe -v
auth0 event-streams subscribe --show-heartbeats
auth0 event-streams subscribe --output-file events.jsonl
auth0 event-streams subscribe --json | jq .
```


## Flags

```
--event-type strings Event type(s) to listen for. Specify multiple times for multiple types (e.g. --event-type user.created --event-type user.updated). If not provided, all event types are streamed.
--from offset Opaque cursor token representing the position in the stream. If not provided, the stream starts from the latest events. Use the offset printed when the connection ends to resume from where you left off.
--from-timestamp string RFC-3339 timestamp indicating where to start streaming events from. Use this on the initial query when no cursor (--from) is available; prefer --from on subsequent runs as it is more accurate.
--json Output each event as JSON (one indented object per event).
--json-compact Output each event as compact, single-line JSON (newline-delimited).
--output-file string Append every received event as a JSON line to this file (raw payload). Independent of the stdout format.
--show-heartbeats offset-only Show every offset-only heartbeat as its own line. By default heartbeats are silently tracked and only the latest cursor is reported on disconnect.
-v, --verbose Print the full JSON payload after each event summary line.
```


## Inherited Flags

```
--debug Enable debug mode.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```


## Related Commands

- [auth0 event-streams create](auth0_event-streams_create.md) - Create a new event stream
- [auth0 event-streams delete](auth0_event-streams_delete.md) - Delete an event stream
- [auth0 event-streams deliveries](auth0_event-streams_deliveries.md) - Manage event stream deliveries
- [auth0 event-streams list](auth0_event-streams_list.md) - List your event streams
- [auth0 event-streams redeliver](auth0_event-streams_redeliver.md) - Retry one or more event deliveries for a given stream
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream


1 change: 1 addition & 0 deletions docs/auth0_event-streams_trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ auth0 event-streams trigger <event-id> [flags]
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream

Expand Down
1 change: 1 addition & 0 deletions docs/auth0_event-streams_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ auth0 event-streams update [flags]
- [auth0 event-streams redeliver-many](auth0_event-streams_redeliver-many.md) - Bulk retry failed event deliveries using filters
- [auth0 event-streams show](auth0_event-streams_show.md) - Show an event stream
- [auth0 event-streams stats](auth0_event-streams_stats.md) - View delivery stats for an event stream
- [auth0 event-streams subscribe](auth0_event-streams_subscribe.md) - Subscribe to live events via Server-Sent Events (SSE)
- [auth0 event-streams trigger](auth0_event-streams_trigger.md) - Trigger a test event for an event stream
- [auth0 event-streams update](auth0_event-streams_update.md) - Update an event stream

Expand Down
2 changes: 1 addition & 1 deletion internal/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ var RequiredScopes = []string{
"create:organizations", "delete:organizations", "read:organizations", "update:organizations", "read:organization_members", "read:organization_member_roles", "read:organization_connections",
"read:prompts", "update:prompts",
"read:attack_protection", "update:attack_protection",
"read:event_streams", "create:event_streams", "update:event_streams", "delete:event_streams",
"read:event_streams", "create:event_streams", "update:event_streams", "delete:event_streams", "read:events",
"read:network_acls", "create:network_acls", "update:network_acls", "delete:network_acls",
"read:token_exchange_profiles", "create:token_exchange_profiles", "update:token_exchange_profiles", "delete:token_exchange_profiles",
"read:organization_invitations", "create:organization_invitations", "delete:organization_invitations",
Expand Down
2 changes: 2 additions & 0 deletions internal/auth0/auth0.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ func NewAPI(m *management.Management) *API {

type APIV2 struct {
AttackProtectionBotDetection AttackProtectionBotDetectionAPIV2
Events EventsAPIV2
PhoneNotificationTemplate PhoneNotificationTemplateAPI
}

func NewAPIV2(m *managementv2.Management) *APIV2 {
return &APIV2{
AttackProtectionBotDetection: m.AttackProtection.BotDetection,
Events: m.Events,
PhoneNotificationTemplate: m.Branding.Phone.Templates,
}
}
Expand Down
24 changes: 24 additions & 0 deletions internal/auth0/events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package auth0

import (
"context"

managementv2 "github.com/auth0/go-auth0/v2/management"
"github.com/auth0/go-auth0/v2/management/core"
"github.com/auth0/go-auth0/v2/management/option"
)

// EventsAPIV2 is the V2 SDK interface for the /events endpoint
// (Server-Sent Event subscription stream).
type EventsAPIV2 interface {
// Subscribe to events via Server-Sent Events (SSE).
//
// Required scope: `read:events`
//
// See: https://auth0.com/docs/api/management/v2/events/get-events
Subscribe(
ctx context.Context,
request *managementv2.SubscribeEventsRequestParameters,
opts ...option.RequestOption,
) (*core.Stream[managementv2.EventStreamSubscribeEventsResponseContent], error)
}
1 change: 1 addition & 0 deletions internal/cli/event_streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func eventStreamsCmd(cli *cli) *cobra.Command {
cmd.AddCommand(redeliverEventStreamCmd(cli))
cmd.AddCommand(redeliverManyEventStreamCmd(cli))
cmd.AddCommand(statsEventStreamCmd(cli))
cmd.AddCommand(subscribeEventStreamCmd(cli))
return cmd
}

Expand Down
Loading
Loading