NapX PMS Docs

Activity Logs

Immutable audit trail for tenant operations in NapX PMS.

Activity Logs

NapX PMS maintains an immutable activity audit trail for every significant platform event. Logs are written automatically by the ActivityLogListenerService, which subscribes to 18 domain events across reservations, guests, properties, access codes, tasks, transactions, and notifications.

Endpoints

MethodPathDescription
GET/v1/activity-logsList audit log entries; filterable by entity, actor, action, and date

Response Shape

Each activity log entry includes:

FieldTypeDescription
iduuidLog entry ID
tenantIduuidOwning tenant
actorIduuid | nullUser who performed the action; null for system-generated entries
actionstringEvent action (e.g. reservation.created)
targetTypestringType of entity affected (e.g. reservation)
targetIduuid | nullID of the affected entity
statusstringOutcome status (e.g. success)
occurredAtISO 8601 stringWhen the event occurred

System Events and Nullable actorId

actorId is nullable. Automated workflows — such as a BullMQ processor completing a notification job, a housekeeping task triggered on checkout, or a background sync — produce log entries with actorId: null. These entries also contain:

{
  "actorId": null,
  "metadata": { "actorType": "system" }
}

This accurately models the authorship of automated actions without requiring a sentinel UUID.

Query Filters

The GET /v1/activity-logs endpoint supports the following query parameters:

ParameterDescription
targetTypeFilter by target entity type (e.g. reservation)
targetIdFilter by target entity ID
actionFilter by action string (e.g. reservation.created)
actorIdFilter by actor user ID
limitNumber of records to return
offsetPagination offset

Automatic Capture

Activity logs are written automatically for the following event categories:

  • Reservation lifecycle (created, updated, confirmed, checked in/out, cancelled, no-show)
  • Guest and property changes
  • Access code provisioning and revocation
  • Task creation and status transitions
  • Transaction captures and failures
  • Notification deliveries

Application code does not call the activity log service directly in most cases. The listener pattern ensures every covered event generates an audit entry without coupling domain services to the logging infrastructure.

Security Model

  • Every request requires Authorization: Bearer <session-token>.
  • Tenant context is derived from validated auth claims; callers only see logs for their tenant.
  • Log entries are never deleted or updated through the public API.

Error Handling

  • 401 Unauthorized when the bearer token is missing or invalid.
  • 403 Forbidden when the authenticated session lacks valid tenant scope.

Example

GET /v1/activity-logs?targetType=reservation&targetId=0d2d70e1-aeab-432f-ae94-9f3f5a42ba55&limit=20
Authorization: Bearer <session-token>

See the API reference for the detailed endpoint contract.

On this page