Skip to main content
GET
/
api
/
v1
/
activity-logs
Activity Logs
curl --request GET \
  --url https://api.example.com/api/v1/activity-logs
{
  "data": [
    {
      "id": "<string>",
      "userId": "<string>",
      "action": "<string>",
      "targetType": "<string>",
      "targetId": "<string>",
      "details": {},
      "ipAddress": "<string>",
      "userAgent": "<string>",
      "layer": "<string>",
      "requestId": "<string>",
      "createdAt": "<string>"
    }
  ],
  "meta": {
    "page": 123,
    "pageSize": 123,
    "totalPages": 123,
    "totalItems": 123
  }
}

Overview

Returns paginated list of activity logs for audit and monitoring. Supports filtering by user, action, target, and date range.

Authentication

Requires JWT authentication with ADMIN role only.

Query Parameters

page
number
default:"1"
Page number (min: 1)
pageSize
number
default:"10"
Items per page (min: 1)
userId
string
Filter by user ID (UUID)
action
enum
Filter by action type (see ActivityType enum)
targetType
string
Filter by target entity type (e.g., TICKET, USER, ACCOUNT_PAYMENT)
targetId
string
Filter by target entity ID
startDate
string
Start date in ISO 8601 format (e.g., 2024-03-01T00:00:00Z)
endDate
string
End date in ISO 8601 format
Search in action details (free text)

Response

data
array
Activity log entries
meta
object
Pagination metadata

Activity Types

Common action types include:
  • TICKET_CREATE, TICKET_PAY, TICKET_CANCEL
  • ACCOUNT_PAYMENT_CREATE, ACCOUNT_PAYMENT_REVERSE
  • USER_LOGIN, USER_CREATE, USER_UPDATE
  • SORTEO_CREATE, SORTEO_EVALUATE

Example Request

GET /api/v1/activity-logs?userId=abc-123&action=TICKET_PAY&page=1&pageSize=20

Example Response

{
  "success": true,
  "data": [
    {
      "id": "log-001",
      "userId": "abc-123",
      "action": "TICKET_PAY",
      "targetType": "TICKET_PAYMENT",
      "targetId": "payment-456",
      "details": {
        "created": true,
        "cached": false,
        "amount": 50000
      },
      "ipAddress": "192.168.1.100",
      "userAgent": "Mozilla/5.0...",
      "layer": "controller",
      "requestId": "req-789",
      "createdAt": "2024-03-15T10:30:00.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "pageSize": 20,
    "totalPages": 5,
    "totalItems": 95
  }
}

Additional Endpoints

Get by User

GET /api/v1/activity-logs/user/:userId?page=1&pageSize=20
Get all logs for a specific user.

Get by Target

GET /api/v1/activity-logs/target/:targetType/:targetId?page=1&pageSize=20
Get all logs for a specific entity.

Get by Action

GET /api/v1/activity-logs/action/:action?page=1&pageSize=20
Get all logs for a specific action type.

Cleanup Old Logs

POST /api/v1/activity-logs/cleanup
Request body:
{
  "days": 45
}
Deletes activity logs older than specified days (default: 45).

Build docs developers (and LLMs) love