GET
Admin audit-log search

Overview

The audit_logs collection is the append-only record of every consequential action performed by an admin, an automated system actor, or (for high-stakes user actions) a user. This endpoint exposes a paginated, filterable read of that trail. Authorization is role-scoped at the service layer, not the middleware. Any admin role (SUPER, MODERATOR, FINANCE) passes the identity gate, but the query itself must be anchored unless the caller is SUPER: A non-SUPER admin issuing a broad, unanchored query receives 403 FORBIDDEN. This prevents a moderator from trawling the trail; they can ask “what did I do” or “what happened to this user/listing” but not “what did everyone do today.”
Reads are themselves audited. Every call to this endpoint writes an audit-log.read row whose payload.filters echoes the query that was issued. Audit-log queries leave a trail.

Authentication

Bearer <accessToken> with scope: 'admin' required (requireAdmin). The role-scoping above is enforced by the service after identity is established.

Path parameters

None.

Query parameters

All filters are optional except where the role-scoping rule kicks in (see overview). Multiple filters are combined with AND.

Allowed query examples

Request body

None.

Response — 200 OK

Audit-log entry

Pagination follows the cursor convention. The cursor is opaque — never decode it client-side. Items within a page are ordered most-recent-first; a row appended mid-pagination will surface on subsequent pages without disrupting the cursor.

Error responses

Example error — 403 FORBIDDEN

Side effects

  • Meta-audit row written. Each successful read appends an audit-log.read row with the requesting admin as actorId, targetType: 'audit-log', and the requested filters echoed into payload.filters. The read is loggable retroactively.

See also

curl

Postman

See docs/postman/swappr.postman_collection.json → Admin → Audit log → Search.