curl --request GET \
--url https://{tenant_id}.hanko.io/admin/audit_logs \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant_id}.hanko.io/admin/audit_logs"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenant_id}.hanko.io/admin/audit_logs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant_id}.hanko.io/admin/audit_logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{tenant_id}.hanko.io/admin/audit_logs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{tenant_id}.hanko.io/admin/audit_logs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant_id}.hanko.io/admin/audit_logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
"type": "user_logged_out",
"meta_http_request_id": "0a2xsrhlhiQv49FIpq8KV8uQVq6ky9Bw",
"meta_source_ip": "172.27.0.1",
"meta_user_agent": "<string>",
"created_at": "2022-09-14T12:15:09.788784Z",
"error": "<string>",
"actor_user_id": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
"actor_email": "jsmith@example.com"
}
]{
"code": 500,
"message": "Internal Server Error"
}Get a list of audit logs
curl --request GET \
--url https://{tenant_id}.hanko.io/admin/audit_logs \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant_id}.hanko.io/admin/audit_logs"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenant_id}.hanko.io/admin/audit_logs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant_id}.hanko.io/admin/audit_logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{tenant_id}.hanko.io/admin/audit_logs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{tenant_id}.hanko.io/admin/audit_logs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant_id}.hanko.io/admin/audit_logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
"type": "user_logged_out",
"meta_http_request_id": "0a2xsrhlhiQv49FIpq8KV8uQVq6ky9Bw",
"meta_source_ip": "172.27.0.1",
"meta_user_agent": "<string>",
"created_at": "2022-09-14T12:15:09.788784Z",
"error": "<string>",
"actor_user_id": "c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c",
"actor_email": "jsmith@example.com"
}
]{
"code": 500,
"message": "Internal Server Error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your API key. Must only be used when using Hanko Cloud.
Query Parameters
The page which should be returned
The number of returned items
Date and time from which the logs are included
"2022-09-12T12:48:48.000Z"
Date and time to which the logs are included
"2022-09-15T12:48:48.000Z"
Only audit logs with the specified user_id are included
"c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c"
Only audit logs with the specified email are included
"example@example.com"
Only audit logs with the specified ip address are included
"127.0.0.1"
Only audit logs are included when the search string matches values in meta_source_ip or actor_user_id or actor_email
"example.com"
Only audit logs with the specified type are included
The type of the audit log
user_logged_out, password_set_succeeded, password_set_failed, password_login_succeeded, password_login_failed, passcode_login_init_succeeded, passcode_login_init_failed, passcode_login_final_succeeded, passcode_login_final_failed, webauthn_registration_init_succeeded, webauthn_registration_init_failed, webauthn_registration_final_succeeded, webauthn_registration_final_failed, webauthn_authentication_init_succeeded, webauthn_authentication_init_failed, webauthn_authentication_final_succeeded, webauthn_authentication_final_failed, webauthn_credential_updated, webauthn_credential_deleted, thirdparty_signup_succeeded, thirdparty_signin_succeeded, thirdparty_linking_succeeded, thirdparty_signin_signup_failed, token_exchange_succeeded, token_exchange_failed, user_created, email_created, email_verified, email_deleted, primary_email_changed, user_deleted, login_success, login_failure, otp_created, passkey_created, passkey_deleted, security_key_created, username_changed, username_deleted, password_changed, password_deleted "user_created"
Response
Details about audit logs
The ID of the audit log
"c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c"
The type of the audit log
user_logged_out, password_set_succeeded, password_set_failed, password_login_succeeded, password_login_failed, passcode_login_init_succeeded, passcode_login_init_failed, passcode_login_final_succeeded, passcode_login_final_failed, webauthn_registration_init_succeeded, webauthn_registration_init_failed, webauthn_registration_final_succeeded, webauthn_registration_final_failed, webauthn_authentication_init_succeeded, webauthn_authentication_init_failed, webauthn_authentication_final_succeeded, webauthn_authentication_final_failed, webauthn_credential_updated, webauthn_credential_deleted, thirdparty_signup_succeeded, thirdparty_signin_succeeded, thirdparty_linking_succeeded, thirdparty_signin_signup_failed, token_exchange_succeeded, token_exchange_failed, user_created, email_created, email_verified, email_deleted, primary_email_changed, user_deleted, login_success, login_failure, otp_created, passkey_created, passkey_deleted, security_key_created, username_changed, username_deleted, password_changed, password_deleted The ID of the corresponding http request
"0a2xsrhlhiQv49FIpq8KV8uQVq6ky9Bw"
The IP from where the http request came from
"172.27.0.1"
The user agent from where the http request came from
Time of creation of the audit log
"2022-09-14T12:15:09.788784Z"
A more detailed message why something failed
The userID from the actor
"c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c"
The email from the actor
Was this page helpful?