PlatformXeDocs
Get API Key

Audit Logs

Query permission decision logs, mutation change logs, and bulk export.

The audit system provides immutable logs of every permission decision and every mutation to authorization configuration. Logs are retained for 90 days.

Scope: permissions:audit

Rate limit: 100/hr

Decision logs

GET /api/v1/permissions/audit

Query permission check decisions — who checked what, when, and the result.

ParameterTypeDescription
adminIdstringFilter by user
pathstringFilter by permission path
actionstringFilter by action
allowedbooleanFilter by result
fromstringStart date (ISO 8601)
tostringEnd date (ISO 8601)
limitnumberResults per page (default 50, max 200)
cursorstringPagination cursor
curl "https://api.platformxe.com/api/v1/permissions/audit?adminId=user_xyz789&from=2026-04-01T00:00:00Z" \
  -H "x-api-key: pxk_live_your_api_key_here"
const logs = await px.permissions.auditDecisions({
  adminId: 'user_xyz789',
  from: '2026-04-01T00:00:00Z',
});

Response

{
  "success": true,
  "data": {
    "entries": [
      {
        "id": "aud_abc123",
        "adminId": "user_xyz789",
        "path": "articles",
        "action": "delete",
        "allowed": false,
        "source": "override_deny",
        "timestamp": "2026-04-05T14:30:00.000Z"
      }
    ],
    "cursor": "next_page_token"
  }
}

Change logs

GET /api/v1/permissions/audit/changes

Query mutations to roles, policies, overrides, and relationships.

curl "https://api.platformxe.com/api/v1/permissions/audit/changes?from=2026-04-01T00:00:00Z" \
  -H "x-api-key: pxk_live_your_api_key_here"
const changes = await px.permissions.auditChanges({
  from: '2026-04-01T00:00:00Z',
});

Bulk export

GET /api/v1/permissions/audit/export

Export audit logs in bulk for compliance or analysis.

ParameterTypeDescription
typestringdecisions or changes
fromstringStart date (ISO 8601)
tostringEnd date (ISO 8601)
formatstringjson or csv
curl "https://api.platformxe.com/api/v1/permissions/audit/export?type=decisions&from=2026-03-01T00:00:00Z&to=2026-04-01T00:00:00Z&format=csv" \
  -H "x-api-key: pxk_live_your_api_key_here"

Audit logs are retained for 90 days. A daily cleanup cron removes entries older than 90 days. Export logs before the retention window if you need long-term archival.

Error responses

CodeDescription
BAD_REQUESTInvalid date range or unknown format
FORBIDDENAPI key missing permissions:audit scope
RATE_LIMITEDExceeded 100/hr audit query limit