Events
AuthRocket generates numerous events as part of normal operations. These events can be queried using the API or subscribed to using Webhooks.
Only events within your plan’s event history period are available. Older events are deleted. Upgrading your plan will not restore those events. On plans with a 0 day history, a subset of events may be briefly shown in the UI (only) to help with debugging.
Event types
Details on which event types are generated are listed in the context of the API calls that generate them. For example, Create an Org describes that it creates org.created
and sometimes others.
Webhooks
Webhooks may also deliver one additional event, ping
, which may be sent at any time to test if a webhook URL is functioning. This event will not be seen in the UI or API.
Webhooks URLs must acknowledge all webhooks with a 2xx status code. All non-2xx status codes are assumed to be a failure and will be retried at periodic intervals for about 2 days after which time the notification attempt is aborted.
Event Fields
Field | Value | Req/Default | Notes |
---|---|---|---|
id |
id | Auto-generated | Event ID. Starts with “ev_”. Example: |
event_type |
string | Type of event. | |
event_at |
time_t | Time of event (aka created_at). | |
token |
string | Token produced by action/event. Requires Write perms. | |
<resource>_id |
id | Associated resource IDs. (eg: |
|
request |
hash | Hash of request attributes provided at event creation. See notes. |
Notification fields
Field | Value | Req/Default | Notes |
---|---|---|---|
id |
id | Auto-generated | Notification ID. Starts with “ent_”. Example: |
attempts |
integer | Number of delivery attempts made. | |
state |
in_progress , completed , failed , canceled |
Current state of this notification. | |
hook_id |
hook_id | ID of Hook that triggered this Notification. | |
hook_type |
webhook , email |
Type of Hook. | |
last_attempt_at |
time_t | Time of most recent attempt. | |
last_destination |
string | Destination of most recent attempt. | |
last_result |
string | Result of most recent attempt. |
Required permissions
Method | Permissions |
---|---|
List, Get | read |
List events
List all events.
Parameters
Param | Value | Default | |
---|---|---|---|
auth_provider_id |
auth_provider_id | Filter by auth_provider_id | |
invitation_id |
invitation_id | Filter by invitation_id | |
membership_id |
membership_id | Filter by membership_id | |
org_id |
org_id | Filter by org_id | |
realm_id |
realm_id | Filter by realm_id | |
user_id |
user_id | Filter by user_id | |
created_at_after |
time_t | Include events >= this time (unix timestamp). | |
event_type |
event_type | Filter by event_type(s); may be full or partial (automatically left-anchored) | |
after |
event_id | ID of the last event you've seen | |
max_results |
integer | 100 |
Range: 1-1000 |
sort |
id |
id |
Equivalent to created_at. |
direction |
asc , desc |
desc |
|
expand |
notifications |
Include |
created_at_after
defaults to 30 days ago. Sending an empty value will clear this default.
Request
Example
GET /v2/events?max_results=1
AuthRocket::Event.all max_results: 1
Response
Example
Status: 200
{
"collection": [
{
"event_at": 1735689600.0,
"event_type": "user.created",
"id": "ev_sample123456",
"object": "event",
"realm_id": "rl_sample123456",
"request": {},
"user_id": "usr_sample123456"
}
],
"more_results": false
}
[AuthRocket::Event(
event_at: 2025-01-01 00:00:00 UTC,
event_type: "user.created",
id: "ev_sample123456",
realm_id: "rl_sample123456",
request: {},
user_id: "usr_sample123456"
)
]
Get an event
Retrieve a specific event.
Request
Example
GET /v2/events/:event_id
event = AuthRocket::Event.find "ev_sample123456"
Response
Example
Status: 200
{
"event_at": 1735689600.0,
"event_type": "user.created",
"id": "ev_sample123456",
"notifications": [
{
"attempts": 1,
"hook_id": "hk_sample123456",
"hook_type": "webhook",
"id": "ent_sample123456",
"last_attempt_at": 1735689600,
"last_destination": "https://example.com/webhooks/authrocket",
"last_result": "404",
"object": "notification",
"state": "in_progress"
}
],
"object": "event",
"realm_id": "rl_sample123456",
"request": {},
"user_id": "usr_sample123456"
}
AuthRocket::Event(
event_at: 2025-01-01 00:00:00 UTC,
event_type: "user.created",
id: "ev_sample123456",
notifications:
[AuthRocket::Notification(
attempts: 1,
hook_id: "hk_sample123456",
hook_type: "webhook",
id: "ent_sample123456",
last_attempt_at: 2025-01-01 00:00:00 UTC,
last_destination: "https://example.com/webhooks/authrocket",
last_result: "404",
state: "in_progress"
)],
realm_id: "rl_sample123456",
request: {},
user_id: "usr_sample123456"
)