Calling the Audit Log API

How to use the Audit lof API

The Audit Logs API is RESTful, read-only and uses a single HTTP GET to query and retrieve information.
The method will return standard HTTP status codes to indicate success or failure.

Full details on the Audit Log entry can be found on the API Reference.

To integrate Klaxoon AuditLog API with your event management tool, you need to:

Filtering by action

You can pass the action query parameter with the endpoint to retrieve Audit Log results associated with a specific action.

ParameterDescription
actionAction Type requested

The example below returns only events associated with USER_SIGN_IN_FAILED actions:

curl --request GET \
     --url 'https://api.klaxoon.com/v1/auditlogs?action=USER_SIGN_IN_FAILED' \
     --header 'Accept: application/json'

Filtering by action can be combined with filtering by time range.

Filtering by time range

By default, only events from the past seven days are displayed. To view older events or another time range you must specify a date range with the from and to query parameters.

ParameterDescription
fromReturn results with an earliest date of (YYYY-MM-DDTHH:mm:ss)
toReturn results with a latest date of (YYYY-MM-DDTHH:mm:ss)

The example below returns events that occur between the 8.20pm and 9.20pm on June 20th 2022

curl --request GET \
     --url 'https://api.klaxoon.com/v1/auditlogs?from=2022-06-20T20%3A20%3A00&to=2022-06-20T21%3A00%3A20' \
     --header 'Accept: application/json'

You can retrieve up to 30 consecutive days.

Pagination

A lot of the time, when you're making calls to the Audit Log API, there'll be a lot of results to return. For that reason, we paginate the results to make sure responses are easier to handle.

To limit, or page the data that is returned in the API response you can use the the page and perPage query parameter query parameters:

ParameterDescription
pageThe page number indicating which set of Audit Logs events will be returned in the response.
The combination of page=1 and perPage=50 returns the first 50 events.
The combination of page=2 and perPage=50 returns items 51 through 100.
perPageThe number of Audit Logs events to return in the response.

By default page is set to 1 and perPage to 50.

Each response payload contains a self, first, prev and next string attributes.

As an example if you request:

curl --request GET \
     --url 'https://api.klaxoon.com/v1/auditlogs?page=3' \
     --header 'Accept: application/json'

The response will show:

{
  "items": [
    {
      "..."
    }
  ],
  "self": "https://api.klaxoon.com/v1/auditlogs?page=3",
  "first": "https://api.klaxoon.com/v1/auditlogs",
  "prev": "https://api.klaxoon.com/v1/auditlogs?page=2",
  "next": "https://api.klaxoon.com/v1/auditlogs?page=4"
}

You can use these attribute values to retrieve the next or previous page of results.