Audit
Add an overview of the Admin - Audit API here. This block is preserved across regenerations.
Endpoints
GET /api/v1/audit-logs
Query audit logs with optional filtering by actor, resource, time range, and event type
Scoped secret API key — send an sk_live_… value (keys issued before the typed format carry a bare pk_<hex> prefix and are also secret; they still work). A publishable pk_live_…/pk_test_… key is browser-safe, carries no scopes, and is refused by every endpoint in this spec with publishable_key_not_allowed. Coarse scopes: read, commerce, admin (admin covers everything below). Narrow per-resource scopes: journeys|pages :read|write|publish|delete, productsets :read|write|publish|delete, components|rules :read|write|delete, context :read (read-only context tier), catalog :read|write-native. publish is never implied by write.
Max items to return (1–100, default 20)
20Number of items to skip (default 0)
0Sort direction
ascPossible values: Filter by user ID (actor) who performed the action
Filter by resource type (e.g. user, page, apiKey)
Filter by action substring (e.g. user.create, subscription)
Return logs created at or after this ISO 8601 timestamp
Return logs created at or before this ISO 8601 timestamp
Paginated list of audit log entries, newest first by default
An immutable record of a platform action
The user who performed the action (null for API key actions)
Namespaced action identifier (e.g. api.user.create)
Action-specific metadata
API key required
GET /api/v1/audit-logs HTTP/1.1
Host: api.peakcommerce.app
X-API-Key: YOUR_API_KEY
Accept: */*
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"userId": "123e4567-e89b-12d3-a456-426614174000",
"action": "text",
"resourceType": "text",
"resourceId": "text",
"details": {},
"ipAddress": "text",
"createdAt": "2026-01-01T00:00:00.000Z"
}Filtering, sorting (by createdAt), and pagination are applied in SQL, so the endpoint scales to tenants with very large audit histories — the server never loads the full table into memory. The action filter is a case-insensitive substring match (e.g. ?action=subscription matches subscription.create, subscription.cancel, etc.). since and until must be ISO 8601 timestamps; invalid values return 400 validation_failed. The response envelope reports pagination.total as the count of rows matching the filters, not the size of the returned page.
Last updated
Was this helpful?
