Events

AuthRocket generates numerous events as part of normal operations. These events can be subscribed to using our Webhooks interface. Specific events are outlined throughout this API documentation in the context of the resources that generate such events. In addition, there is one generic event:

ping - May be generated at any time to test if a webhook URL is functioning.

Your webhooks URL 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 they are discarded.

Fields

FieldValueReq/DefaultNotes
id id Auto-generated

Event ID. Always starts with “ev_”. Example: ev_USwTtoqehlgsGgRYsJJt4

event_type string Type of event.
event_at time_t Time of event.
<resource>_id id

Associated resource IDs. (eg: user_id, org_id, etc.)

request hash Optional Hash of request attributes.
request.client string

Client info, if available.

request.ip string IP address that caused event, if available.

Permissions

MethodPermissions
List, Get read

List events

List all events.

Only events with your plan’s event history period are available. (Older events are deleted. Upgrading your plan will not restore those events.)

Parameters

ParamValueDefault
app_hook_id id Filter by app_hook_id
auth_provider_id id Filter by auth_provider_id
login_policy_id id Filter by login_policy_id
membership_id id Filter by membership_id
org_id id Filter by org_id
realm_id id Filter by realm_id
user_id 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
direction asc,
desc
desc
expand notifications Include notification (webhook) details in the response

created_at_after defaults to 30 days ago. Sending an empty (nil) value will clear this default.

Request

Example
GET /v1/events?max_results=1
AuthRocket::Event.all max_results: 1

Response

Example

Status: 200

{ "more_results" : false,
  "collection" : [
    { "id" : "ev_0v1zZ3fa5qSVcVSQMLeEhb",
      "event_type" : "app_hook.created",
      "object" : "event",
      "event_at" : 1408451772.426,
      "app_hook_id" : "hk_0v1zZ3fYjJSufWw6VfdI9f"
    }
  ]
}
[#<AuthRocket::Event:0x3fc21972f554>
  id: "ev_0v6O8Uk3deD4ToNejw9NJF",
  attribs: {
    "event_type"=>"user.login.succeeded",
    "object"=>"event",
    "event_at"=>1409375313.654,
    "realm_id"=>"rl_0v2FcFc5IN79xazvkgLhnX",
    "user_id"=>"usr_0v3e40oS2DfUUXe2sr8unp"
  },
  metadata: {
    "more_results"=>true
  }
]

Get an event

Retrieve a specific event.

Request

Example
GET /v1/events/:event_id
AuthRocket::Event.find 'ev_0v6O8Uk3deD4ToNejw9NJF'

Response

Example

Status: 200

{ "id" : "ev_0v1zZ3fa5qSVcVSQMLeEhb",
  "event_type" : "app_hook.created",
  "object" : "event",
  "event_at" : 1408451772.426,
  "app_hook_id" : "hk_0v1zZ3fYjJSufWw6VfdI9f",
  "notifications" : [
    { "app_hook_id" : "hk_0vBE0GGHLzeYW8IF6pWYEb",
      "attempts" : 1,
      "id" : "ent_0vCtFGc47IwQ9B21qnmgZU",
      "state" : "in_progress",
      "object" : "notification",
      "last_attempt_at" : 1408562764,
      "last_destination" : "http://example.com/",
      "last_result" : "404"
    }
  ]
}
#<AuthRocket::Event:0x3fc21972f554>
  id: "ev_0v6O8Uk3deD4ToNejw9NJF",
  attribs: {
    "event_type"=>"user.login.succeeded",
    "object"=>"event",
    "event_at"=>1409375313.654,
    "realm_id"=>"rl_0v2FcFc5IN79xazvkgLhnX",
    "user_id"=>"usr_0v3e40oS2DfUUXe2sr8unp",
    "notifications"=>[
      #<AuthRocket::Notification:0x3fc21aaf2a00>
        id: "ent_0vCtFGc47IwQ9B21qnmgZU",
        attribs: {
          "app_hook_id"=>"hk_0vBE0GGHLzeYW8IF6pWYEb",
          "attempts"=>12,
          "state"=>"in_progress",
          "object"=>"notification",
          "last_attempt_at"=>1408562764,
          "last_destination"=>"http://example.com/",
          "last_result"=>"404"
        }
    ]
  }

Questions? Find a Typo? Get in touch.