API reference
Audit logs
The console activity log of your WeGuard account: who did what and when, newest first.
Use the audit log to feed a SIEM or to review administrative changes. It is the activity log of the whole account, the same one an account admin (customer_admin) sees in the console.
The console records the entries, so event, message and level are free-form text, not a fixed set. The API never returns the request and response payloads recorded internally, and it replaces credentials in a message, such as API keys, with [redacted].
The audit log object
idstring- Unique id of the entry.
objectstring- Always
audit_log. occurredAttimestamp- When WeGuard recorded the entry.
since/untilfilter on this time. actorobjectnullable- The console user who performed the action.
nullwhen the recorded actor is not an email address. actor.emailstring- Login email of the console user at the time of the action.
eventstringnullable- Event category recorded by the console, for example
Policy,Roles and PermissionsorSSO. Free-form text, not a closed set. messagestringnullable- Human-readable description of the action. Credentials in the text are replaced with
[redacted]. levelstringnullable- Severity in lowercase, for example
info,warnorerror. Free-form text, not a closed set. sourceIpstringnullable- The public IP address the action came from: the nearest public address in the recorded forwarding chain. Best effort and for information only.
nullwhen no valid public IP address was recorded. policyIdstringnullable- Id of the policy the action concerns.
nullunless a valid policy id was recorded.
{
"id": "6702a4b8c9d0e1f2a3b4c5d6",
"object": "audit_log",
"occurredAt": "2026-10-07T08:15:02Z",
"actor": {
"email": "admin@acme.example"
},
"event": "Policy",
"message": "Kiosk: Scanners updated",
"level": "info",
"sourceIp": "203.0.113.7",
"policyId": "64ff0a1b2c3d4e5f60718293"
}List audit log entries
/ v1/ audit-logsReturns audit log entries between since and until, newest first, as a paginated list. If you omit both since and until, you get the last 7 days. See Time ranges.
Audit log entries contain email addresses and IP addresses of your console users. Grant audit_logs:read only to systems that need it.
Query parameters
sincetimestampoptionaldefault 7 days before until- Start of the time range (inclusive), as an ISO-8601 timestamp with a UTC offset, for example
2026-10-01T00:00:00Z. Must be earlier thanuntil. The range can span at most 93 days. See Time ranges. untiltimestampoptionaldefault now- End of the time range (exclusive), as an ISO-8601 timestamp with a UTC offset. If you omit it, the first page fixes “now” and every
nextCursorcarries that value, so all pages cover the same window. In that case the maximum span of 93 days allows 5 minutes of clock tolerance. actorstringoptional- Only return entries by this console user. Pass an email address of at most 254 characters. The match is exact and case-sensitive, and a value that is not an email address is rejected.
limitintegeroptionaldefault 25- Maximum number of items to return, from
1to100. cursorstringoptional- The
nextCursorfrom the previous page. Send it unchanged, together with the same filters. See Pagination. includeTotalbooleanoptionaldefault false- Set to
trueto also returntotalCount. It runs an extra count, so request it only when you need it.
Example request
curl "https://api-gw.weguard.ai/core/v1/audit-logs?since=2026-10-01T00:00:00Z&until=2026-10-08T00:00:00Z&actor=admin@acme.example&limit=1" \
-H "Authorization: Bearer $WEGUARD_API_KEY"const response = await fetch("https://api-gw.weguard.ai/core/v1/audit-logs?since=2026-10-01T00:00:00Z&until=2026-10-08T00:00:00Z&actor=admin@acme.example&limit=1", {
headers: { Authorization: `Bearer ${process.env.WEGUARD_API_KEY}` },
});
const body = await response.json();
if (!response.ok) {
throw new Error(`${body.code}: ${body.detail} (requestId ${body.requestId})`);
}
console.log(body);import os
import requests
response = requests.get(
"https://api-gw.weguard.ai/core/v1/audit-logs",
params={
"since": "2026-10-01T00:00:00Z",
"until": "2026-10-08T00:00:00Z",
"actor": "admin@acme.example",
"limit": 1,
},
headers={"Authorization": f"Bearer {os.environ['WEGUARD_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
print(response.json())Response
A list object whose data holds audit log objects, newest first.
{
"object": "list",
"data": [
{
"id": "6702a4b8c9d0e1f2a3b4c5d6",
"object": "audit_log",
"occurredAt": "2026-10-07T08:15:02Z",
"actor": {
"email": "admin@acme.example"
},
"event": "Policy",
"message": "Kiosk: Scanners updated",
"level": "info",
"sourceIp": "203.0.113.7",
"policyId": "64ff0a1b2c3d4e5f60718293"
}
],
"hasMore": true,
"nextCursor": "dDE6MTc5MTQxNDAwMDAwMDo2NzAxYzJlNWYxYTJiM2M0ZDVlNmY3ODk"
}Errors
sinceoruntilis not an ISO-8601 timestamp with an offset, or is outside the range 1970-01-01T00:00:00Z to 9999-12-31T23:59:59.999Z;sinceis not earlier thanuntil; the range is longer than 93 days;limitorincludeTotalis invalid; or a parameter was sent twice. Also returned whenactoris not an email address.The request includes a query parameter this endpoint does not accept.
The cursor is malformed, or was issued for a different listing: another path, other filters, or another
since/until.The key lacks
audit_logs:read.
Common errors
Besides the errors listed for each endpoint, any request can fail authentication, exceed the rate limit, ask for a format other than JSON, or fail with a server error. See Errors for the response format and retry guidance.
The request has no
Authorizationheader.The
Authorizationheader does not use theBearerscheme, or has no key after it. TheWWW-Authenticateheader carrieserror="invalid_request".The key is malformed, does not exist, or its secret does not match. The
WWW-Authenticateheader carrieserror="invalid_token".The key is past its
expiresAt.An account admin revoked the key. Revocation takes effect immediately and cannot be undone.
The WeGuard account that owns the key has been deleted or disabled.
The
Acceptheader excludes JSON.The key has used up its request budget. See Rate limits.
An unexpected error occurred on our side.
A service WeGuard depends on is temporarily unavailable, or reading the data took longer than the time WeGuard allows for it. This can also happen while your key is being checked, so it can be returned before authentication completes. The response carries
Retry-After.