See api-docs Menu

Get Events

The call returns up to 50 events per page.

For details about using the pagination element to easily “page” through events, see Query Parameters.

For details about each element in the Event resource and a list of event type IDs, see Event Resource and Types.

Resource URL

https://api.<us_or_eu>.onelogin.com/api/1/events

Header Parameter

Authorization

required

string

Set to bearer:<access_token>.

Set <access_token> to the access token you generated using the Generate Token API.

The access token must have been generated using an API credential pair created using the scope required to call this API. This API can be called using any one of the following scopes: Read Users, Manage users, Read All, or Manage All.

Query Parameters

For more information about how to search for events using these query parameters, see Search.

  • client_id

  • created_at

  • directory_id

  • event_type_id

  • id

  • resolution

  • since

  • until

  • user_id

The following examples illustrate how to use various query parameters to return subsets of events:

  • Return events whose event_type_id value equals 13

    https://api.us.onelogin.com/api/1/events?event_type_id=13

  • Return a limited number of events:

    https://api.us.onelogin.com/api/1/events?limit=10

  • Return events sorted by id. Use + to sort in ascending order or - to sort in descending order:

    https://api.us.onelogin.com/api/1/events?sort=+id

  • Return events displaying only selected fields per event:

    https://api.us.onelogin.com/api/1/events?fields=created_at, event_type_id, user_id

  • Combine use of multiple query parameters using an &:

    https://api.us.onelogin.com/api/1/events?event_type_id=13&sort=+id&fields= created_at, event_type_id, user_id

  • Return events created within a window of time bound by specific created_at values using the since and until parameters:

    https://api.us.onelogin.com/api/1/events?since=2010-11-01T19:44:55.681Z&until=2011-11-01T19:44:55.681Z

    This will return events created after 2010-11-01T19:44:55.681Z, but before 2011-11-01T19:44:55.681Z.

For more details, see Using Query Parameters.

Sample Response

{
    "status": {
        "error": false,
        "code": 200,
        "type": "success",
        "message": "Success"
    },
    "pagination": {
        "before_cursor": null,
        "after_cursor": "xWNjb3VudF9pZDo6OjUzNDEzLS0jI2lkOjo6OTA0MjU3NTQ2",
        "previous_link": null,
        "next_link": "https://api.us.onelogin.com/api/1/events?
        after_cursor=xWNjb3VudF9pZDo6OjUzNDEzLS0jI2lkOjo6OTA0MjU3NTQ2"
    },
    "data": [
        {
            "id": 999999999,
            "created_at": "2014-12-19T02:02:39.276Z",
            "account_id": 55555,
            "user_id": 88888888,
            "event_type_id": 13,
            "notes": null,
            "ipaddr": "11.111.11.111",
            "actor_user_id": 7777777,
            "assuming_acting_user_id": null,
            "role_id": null,
            "app_id": null,
            "group_id": null,
            "otp_device_id": null,
            "policy_id": null,
            "actor_system": "",
            "custom_message": null,
            "role_name": null,
            "app_name": null,
            "group_name": null,
            "actor_user_name": "Xavier Wong",
            "user_name": "Xavier Wong",
            "policy_name": null,
            "otp_device_name": null,
            "operation_name": null,
            "directory_sync_run_id": null,
            "directory_id": null,
            "resolution": null,
            "client_id": null,
            "resource_type_id": null,
            "error_description": null,
            "proxy_ip": null
        },
      ...
        {
            "id": 888888888,
            "created_at": "2014-12-19T03:38:19.899Z",
            "account_id": 55555,
            "user_id": 77777777,
            "event_type_id": 5,
            "notes": "Authentication method: password.",
            "ipaddr": "22.222.22.222",
            "actor_user_id": 11111111,
            "assuming_acting_user_id": null,
            "role_id": null,
            "app_id": null,
            "group_id": null,
            "otp_device_id": null,
            "policy_id": null,
            "actor_system": "",
            "custom_message": null,
            "role_name": null,
            "app_name": null,
            "group_name": null,
            "actor_user_name": "Jimena Xie",
            "user_name": "Jimena Xie",
            "policy_name": null,
            "otp_device_name": null,
            "operation_name": null,
            "directory_sync_run_id": null,
            "directory_id": null,
            "resolution": null,
            "client_id": null,
            "resource_type_id": null,
            "error_description": null,
            "proxy_ip": null
        }
    ]
}

Typically, this error means that your Authorization header value is missing or incorrectly formatted. The Authorization header value should use this format: bearer:<access_token>.

{
    "status": {
        "error": true,
        "code": 400,
        "type": "bad request",
        "message": "Authorization Information is incorrect"
    }
}

Typically, this error means that your access token value is invalid.

{
    "status": {
        "error": true,
        "code": 401,
        "type": "Unauthorized",
        "message": "Authentication Failure"
    }
}

Postman Collection

Be sure to set Postman-specific environment variables indicated by {{ }}.

Download for the Events API

Sample Code

cURL

Replace sample values indicated by < > with your actual values.

Get Events

curl 'https://api.<us_or_eu>.onelogin.com/api/1/events' \
-X GET \
-H "Authorization: bearer:<access_token>" 

Get Events Created within Date/Time Range

curl 'https://api.<us_or_eu>.onelogin.com/api/1/events?since=<since>&until=<until>' \
-X GET \
-H "Authorization: bearer:<access_token>" 

Get Events by Event Type ID

curl 'https://api.<us_or_eu>.onelogin.com/api/1/events?event_type_id=<event_type_id>' \
-X GET \
-H "Authorization: bearer:<access_token>" 

Python

See Get Events.


Have a Question?

Have a how-to question? Seeing a weird error? Ask us about it on StackOverflow.

Found a bug? Submit a support ticket.

Have a product idea or request? Share it with us in our Ideas Portal.