Skip to content

Admin API: Audit logs

Operations to get the records of operations for a space and for the whole environment, and to export them as CSV. Common rules (authentication, error format, dates and times) are in the Admin API reference.

In the examples, replace <hostname> with the hostname of your environment and <access token> with an access token that starts with hako_pat_. Replace other values in angle brackets, such as <slug>, with the values described in each operation’s parameter table.

Operation Method and path
Audit logs not tied to a space (environment admins only) GET /admin/api/audit-logs
Export audit logs not tied to a space as CSV (environment admins only) GET /admin/api/audit-logs.csv
Space audit logs GET /admin/api/spaces/{slug}/audit-logs
Export space audit logs as CSV GET /admin/api/spaces/{slug}/audit-logs.csv

Audit logs not tied to a space (environment admins only)

Section titled “Audit logs not tied to a space (environment admins only)”

Logins, user operations, and so on.

GET /admin/api/audit-logs
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
from query string Start of the period (ISO 8601 with a time zone offset). Includes this time
to query string End of the period (ISO 8601 with a time zone offset). Excludes this time
action query string Action name. If it ends with ., it matches by prefix (entry. matches all entry actions)
actorId query string ID of the actor (a user or an API key)
targetType query string Target type (for example, entry)
targetId query string Target ID
limit query integer 0 or more
cursor query string

Responses:

Status Body Reason
200 AuditLogList (application/json)
400 Error (application/json) An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl "https://<hostname>.hakocms.net/admin/api/audit-logs" \
-H "Authorization: Bearer <access token>"

Export audit logs not tied to a space as CSV (environment admins only)

Section titled “Export audit logs not tied to a space as CSV (environment admins only)”
GET /admin/api/audit-logs.csv
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
from query string Start of the period (ISO 8601 with a time zone offset). Includes this time
to query string End of the period (ISO 8601 with a time zone offset). Excludes this time
action query string Action name. If it ends with ., it matches by prefix (entry. matches all entry actions)
actorId query string ID of the actor (a user or an API key)
targetType query string Target type (for example, entry)
targetId query string Target ID
limit query integer 0 or more
cursor query string

Responses:

Status Body Reason
200 File (text/csv)
400 Error (application/json) An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl "https://<hostname>.hakocms.net/admin/api/audit-logs.csv" \
-H "Authorization: Bearer <access token>"

Audit logs of the space. Requires audit_logs.read.

GET /admin/api/spaces/{slug}/audit-logs
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space
from query string Start of the period (ISO 8601 with a time zone offset). Includes this time
to query string End of the period (ISO 8601 with a time zone offset). Excludes this time
action query string Action name. If it ends with ., it matches by prefix (entry. matches all entry actions)
actorId query string ID of the actor (a user or an API key)
targetType query string Target type (for example, entry)
targetId query string Target ID
limit query integer 0 or more
cursor query string

Responses:

Status Body Reason
200 AuditLogList (application/json)
400 Error (application/json) An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found. A space you are not a member of also returns 404

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/audit-logs" \
-H "Authorization: Bearer <access token>"
GET /admin/api/spaces/{slug}/audit-logs.csv
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space
from query string Start of the period (ISO 8601 with a time zone offset). Includes this time
to query string End of the period (ISO 8601 with a time zone offset). Excludes this time
action query string Action name. If it ends with ., it matches by prefix (entry. matches all entry actions)
actorId query string ID of the actor (a user or an API key)
targetType query string Target type (for example, entry)
targetId query string Target ID
limit query integer 0 or more
cursor query string

Responses:

Status Body Reason
200 File (text/csv)
400 Error (application/json) An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found. A space you are not a member of also returns 404

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/audit-logs.csv" \
-H "Authorization: Bearer <access token>"