RealTimeX
Sign inStart for free
RealTimeXAPI Documentationv1
IntroductionAuthenticationBase URLHeadersError codes
GETList ReportsPATCHResolve ReportsPATCHMute/Unmute UserPATCHBan/Unban UserGETAudit Logs
Sample requestsSample responsesStatus codesAppendixChangelog
API ReferenceAPI endpointsModeration

Audit Logs

Overview

Fetch a paginated audit trail of tenant moderation and governance actions - bans, mutes, report resolutions, settings changes, and related events - for the Platform Moderation → Audit view.

Each log entry records who acted (actorType / actorName), what happened (action), and an optional target plus structured details.

When to use this endpoint?

Use Audit Logs when:

  • Opening Platform → Moderation → Audit to review recent actions.
  • Confirming a ban, mute, unban, or report resolution was recorded.
  • Building a timeline table with actor, action slug, target, and timestamp.
  • Reading pagination to page through a long history.

Part of the client Platform Moderation module. This endpoint is read-only - actions themselves are performed via List/Resolve Reports, Mute, Ban, and Settings endpoints.

Response Data

data.list is an array of audit entries. data.pagination describes the current page.

Log entry fields

FieldDescription
_idAudit log entry id.
actorTypeWho performed the action: client (workspace admin), superadmin, or user.
actorId / actorNameActor identity when available (for example the Platform admin who banned a user).
actionAction slug such as moderation.user-banned, moderation.user-muted, or report / settings actions. Display as a human label in the UI (for example "User banned").
targetType / targetIdOptional resource the action applied to (for example user + user id).
detailsOptional structured context (for example userName). Shape varies by action.
createdAt / updatedAtISO timestamps for the log row.

pagination

FieldDescription
currentPageCurrent 1-based page.
totalCountTotal audit log entries.
pageSizeItems returned per page (for example 20).
hasNextPage / hasPreviousPageWhether adjacent pages are available.
GET{baseUrl}/api/{apiVersion}/client/audit-logs
Authentication
Required (Bearer token)
Tenant-scoped
Yes (tenant DB - requires x-client-id)

Request Headers

HeaderValueDescription
AuthorizationBearer <access_token>Client Access Token with tenant admin privileges (Platform panel).
is-tenanttrueTargets the tenant DB ("true", needs x-client-id).
x-client-id{{clientId}}Tenant (client) id. Required when is-tenant=true.

This endpoint has no request body. Call it with tenant headers only; pagination metadata is returned using server defaults.

Success Response (HTTP 200 OK)

On success, the API returns a paginated list of audit log entries.

json
1{2  "success": true,3  "message": "Audit logs fetched successfully",4  "data": {5    "list": [6      {7        "_id": "6a589c09c43829ebc51a80ed",8        "actorType": "client",9        "actorId": "6a589b96cfa34ab66e35b2a9",10        "actorName": "Mod Test",11        "action": "moderation.user-banned",12        "targetType": "user",13        "targetId": "6a589b96cfa34ab66e35b2ab",14        "details": {15          "userName": "Bad Actor"16        },17        "createdAt": "2026-07-16T08:53:29.542Z",18        "updatedAt": "2026-07-16T08:53:29.542Z",19        "__v": 020      }21    ],22    "pagination": {23      "currentPage": 1,24      "totalCount": 4,25      "hasNextPage": false,26      "hasPreviousPage": false,27      "pageSize": 2028    }29  },30  "error": null31}

Common Errors

Fetch fails when the token is missing/invalid or the caller is not a tenant admin.

HTTP 401 Unauthorized - No token

json
1{2  "success": false,3  "message": "No token, authorization denied",4  "data": null,5  "error": "Unauthorized"6}

HTTP 403 Forbidden - Tenant admin required

json
1{2  "success": false,3  "message": "Access denied: tenant admin privileges required",4  "data": null,5  "error": null6}
CodeReason
401 UnauthorizedAccess Token is missing, invalid, or expired.
403 ForbiddenTenant admin privileges required for Platform Moderation.
500 Internal Server ErrorAn unexpected error occurred while fetching audit logs.

Best Practices

  • Humanize action slugs in the UI (for example moderation.user-banned → "User banned").
  • Expand details on demand - shapes differ by action.
  • Badge actorType so workspace admin, super admin, and end-user actions are easy to scan.
  • Refetch after Mute, Ban, or Resolve so new entries appear promptly.
  • Restrict audit content to trusted Platform admins - it can include user names and moderation decisions.

Audit trail ready

Use the list to verify moderation actions. To change state, go back to List Reports, Mute / Unmute User, or Ban / Unban User.

PreviousBan/Unban UserNextPresigned URLs

On this page

OverviewWhen to use this endpoint?Response DataRequest HeadersSuccess ResponseCommon ErrorsBest Practices
Back to top