Audit log
6 operations in the WP Waterfall API.
- getExport the company audit log
- getList long audit log exports
- postAsk for a long export of the company audit log
- getRead the limits for long audit log exports
- getRead one long audit log export
- postGet a download link for a finished audit log export
Export the company audit log
get/audit/exportPermalink to Export the company audit log
- Scope:
activity:read - Permission:
activity.read
Streams the audit log of the active company for a date range as CSV (the default) or NDJSON (format=ndjson, one JSON object per line). Needs the activity.read permission, so a member limited to some sites cannot call it. The range starts at from and ends at to (default now), at most 92 days long: a longer span answers 422, and you read it in several requests. Rows come oldest first. Each row has the person or key, the action, the target, the address and browser, the stored details with secrets already removed, and its chain position and hashes (see the audit log help article for what the chain shows). The response is read from the database in steps, so a large log never sits in memory. At most 2 exports for one company run at once (429 past that). Every export writes an audit entry (audit.export) that names the range and format.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from required | query | string (date-time) | Start of the range, inclusive (RFC 3339). |
to | query | string (date-time) | End of the range, inclusive. Defaults to now. At most 92 days after from. |
format | query | string | One of: csv, ndjson. Default: csv. |
actor | query | string | Keep only what one person or API key did (the id on the activity list). |
action | query | string | Keep only one action name, such as POST /v1/sites. |
Responses
| Status | Body | Description |
|---|---|---|
200 | string | The rows as CSV, or as NDJSON when format is ndjson |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
List long audit log exports
get/audit/exportsPermalink to List long audit log exports
- Scope:
activity:read - Permission:
activity.read
The long exports the company asked for, newest first, with their state: queued, building, ready, failed, or expired.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
limit | query | integer | How many rows to return in one page: 1 to 200, and 50 when left out. Default: 50. Range: 1 to 200. |
cursor | query | string | The next_cursor of the page before. Leave it out for the first page. |
Responses
| Status | Body | Description |
|---|---|---|
200 | AuditExportRequestList | Export requests |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
data required | array of AuditExportRequest | |
data[].id required | string (uuid) | |
data[].status required | string | One of: queued, building, ready, failed, expired. |
data[].format required | string | One of: csv, ndjson. |
data[].from required | string | |
data[].to required | string | |
data[].actor required | string or null | |
data[].action required | string or null | |
data[].requested_by required | string | |
data[].requested_at required | string (date-time) | |
data[].ready_at required | string or null (date-time) | |
data[].expires_at required | string or null (date-time) | When the file leaves storage. Null until it is ready. |
data[].rows required | integer or null | |
data[].size_bytes required | integer or null | |
data[].truncated required | boolean | True when the file stopped at the row limit of the company's tier. |
data[].error required | string or null | Why a failed export failed, in plain words. |
data[].download_count required | integer | |
data[].job_id required | string or null (uuid) | |
next_cursor | string or null |
Ask for a long export of the company audit log
post/audit/exportsPermalink to Ask for a long export of the company audit log
- Scope:
activity:read - Permission:
activity.read
Builds the audit log of the active company for a range of up to 396 days (13 months, as long as the log is kept) into a CSV or NDJSON file in the background, for ranges longer than the 92 days GET /audit/export streams. Needs the activity.read permission, so a member limited to some sites cannot call it. Answers 202 with the request. When the file is ready the person who asked gets a notice (and an email, per their notification settings), and POST /audit/exports/{id}/download-link gives a short-lived link. The file stays 48 hours. A start before the retention window answers 422. Limits follow the size of the company: a row limit per file (the file says when it stopped there) and a number of long exports per 24 hours; one export is built at a time (429 past either limit). The export writes an audit.export entry and the job writes its own entries.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
Idempotency-Key required | header | string | Send a fresh unique value on every POST: a POST without it answers 422. The answer is stored for 24 hours, so a retry with the same key and body returns the first answer, and the same key with a different body returns 422. |
Request body application/json, required, StartAuditExportRequest
Fields
| Name | Type | Description |
|---|---|---|
from required | string (date-time) | Start of the range, inclusive (RFC 3339). Not before the retention window. |
to | string (date-time) | End of the range, inclusive. Defaults to now. |
format | string | One of: csv, ndjson. Default: csv. |
actor | string | Keep only what one person or API key did (the id on the activity list). |
action | string | Keep only one action name, such as POST /v1/sites. |
Responses
| Status | Body | Description |
|---|---|---|
202 | AuditExportRequest | The request that was queued |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
409 | Problem | The current state does not allow this: the same change is already running, or another change got there first. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
202 response fields
| Name | Type | Description |
|---|---|---|
id required | string (uuid) | |
status required | string | One of: queued, building, ready, failed, expired. |
format required | string | One of: csv, ndjson. |
from required | string | |
to required | string | |
actor required | string or null | |
action required | string or null | |
requested_by required | string | |
requested_at required | string (date-time) | |
ready_at required | string or null (date-time) | |
expires_at required | string or null (date-time) | When the file leaves storage. Null until it is ready. |
rows required | integer or null | |
size_bytes required | integer or null | |
truncated required | boolean | True when the file stopped at the row limit of the company's tier. |
error required | string or null | Why a failed export failed, in plain words. |
download_count required | integer | |
job_id required | string or null (uuid) |
Read the limits for long audit log exports
get/audit/exports/limitsPermalink to Read the limits for long audit log exports
- Scope:
activity:read - Permission:
activity.read
The tier of the company (from the number of sites), the row limit of one file, the long exports allowed in 24 hours and used so far, the retention in days, and how long a finished file stays.
Responses
| Status | Body | Description |
|---|---|---|
200 | AuditExportLimits | The limits |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
tier required | string | One of: small, medium, large. |
max_rows required | integer | |
per_day required | integer | |
used_today required | integer | |
retention_days required | integer | |
file_hours required | integer |
Read one long audit log export
get/audit/exports/{id}Permalink to Read one long audit log export
- Scope:
activity:read - Permission:
activity.read
Returns one long export of the audit log: its status (queued, building, ready, failed, or expired), the range and filters, the row count and size, truncated when the file stopped at the row limit, and expires_at, when the file leaves storage. Get the file with POST /audit/exports/{id}/download-link. A Site Admin or Site Developer gets 403.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string (uuid) | The id of the audit log export. |
Responses
| Status | Body | Description |
|---|---|---|
200 | AuditExportRequest | The export request |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
404 | Problem | The thing in the path does not exist, or it belongs to another company. The answer is the same for both. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
id required | string (uuid) | |
status required | string | One of: queued, building, ready, failed, expired. |
format required | string | One of: csv, ndjson. |
from required | string | |
to required | string | |
actor required | string or null | |
action required | string or null | |
requested_by required | string | |
requested_at required | string (date-time) | |
ready_at required | string or null (date-time) | |
expires_at required | string or null (date-time) | When the file leaves storage. Null until it is ready. |
rows required | integer or null | |
size_bytes required | integer or null | |
truncated required | boolean | True when the file stopped at the row limit of the company's tier. |
error required | string or null | Why a failed export failed, in plain words. |
download_count required | integer | |
job_id required | string or null (uuid) |
Get a download link for a finished audit log export
post/audit/exports/{id}/download-linkPermalink to Get a download link for a finished audit log export
- Scope:
activity:read - Permission:
activity.read
A signed link that works for 15 minutes and downloads the file. Answers 409 until the export is ready, 410 once it expired, and 503 where the server has no download storage. Each call is written to the audit log.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string (uuid) | The id of the audit log export. |
Idempotency-Key required | header | string | Send a fresh unique value on every POST: a POST without it answers 422. The answer is stored for 24 hours, so a retry with the same key and body returns the first answer, and the same key with a different body returns 422. |
Responses
| Status | Body | Description |
|---|---|---|
200 | AuditExportDownloadLink | The link |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
404 | Problem | The thing in the path does not exist, or it belongs to another company. The answer is the same for both. |
409 | Problem | The current state does not allow this: the same change is already running, or another change got there first. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
url required | string (uri) | |
expires_at required | string (date-time) | |
filename required | string |