See api-docs Menu

Create Event

Use to create an event in the OneLogin event log.

From individual user actions, to administrative operations, provisioning, and OTP device registration, everything that happens within your OneLogin account can be tracked.

For details about the event resource and available event types, see Event Resource and Types.

Resource URL

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

Header Parameters

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 either the Manage users or Manage All scope.

Content-Type

required

string

Set to application/json.

Request Parameters

event_type_id

required

string

Set to the ID of the event type you want to create. For a list of valid event type IDs, see Event Resource and Types.

account_id

required

string

Set to your account ID.

actor_system

string

*

actor_user_id

string

Value must exist in OneLogin.

actor_user_name

string

*

app_id

string

*

assuming_acting_user_id

string

Value must exist in OneLogin

custom_message

string

*

directory_sync_run_id

string

*

group_id

string

*

group_name

string

*

ipaddr

string

*

otp_device_id

string

*

otp_device_name

string

*

policy_id

string

*

policy_name

string

*

role_id

string

*

role_name

string

*

user_id

string

Value must exist in OneLogin.

user_name

string

*

Sample Request Body

{
    "event_type_id": 19,
    "account_id": 55555
}

Sample Response

{
    "status": {
        "error": false,
        "code": 200,
        "type": "success",
        "message": "Success"
    }
}
{
    "status": {
        "error": true,
        "code": 400,
        "type": "bad request",
        "message": "account_id should be -> <your account ID>"
    }
}

{
    "status": {
        "error": true,
        "code": 400,
        "type": "bad request",
        "message": "account_id is a mandatory attribute"
    }
}

{
    "status": {
        "error": true,
        "code": 400,
        "type": "bad request",
        "message": "event_type_id should be a subset of this array => 
                    [<array of valid event type ID values>]"
    }
}

{
    "status": {
        "error": true,
        "code": 400,
        "type": "bad request",
        "message": "event_type_id is a mandatory attribute"
    }
}

Typically, the following 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"
    }
}

{
    "status": {
        "error": true,
        "code": 400,
        "type": "bad request",
        "message": "Content Type is not specified or specified incorrectly. 
                    Content-Type header must be set to application/json"
    }
}

{
    "status": {
        "error": true,
        "code": 400,
        "type": "bad request",
        "message": "Input JSON is not valid"
    }
}

Typically, the following error means that the access token used to make the call was generated using API credentials that have insufficient permissions. This API can be called using the Manage users or Manage All scope.

{
    "status": {
        "error": true,
        "code": 401,
        "type": "Unauthorized",
        "message": "Insufficient Permission"
    }
}

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

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

Postman Collection

Replace sample variables indicated by < > in the sample request body with your actual values. Also, be sure to set Postman-specific environment variables indicated by {{ }}.

Download for the Events API

Sample cURL Request

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

curl "https://api.<us_or_eu>.onelogin.com/api/1/events" \
-X POST \
-H "Authorization: bearer:<access_token>" \
-H "Content-Type: application/json" \
-d '{
    "event_type_id": <event_type_id>,
    "account_id": <account_id>
}'

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.