Skip to main content

Audit Log Fields

Every audit log entry contains the following fields:
FieldTypeDescription
idstringUnique audit log identifier
actorTypestringType of actor (admin, merchant, system)
actorIdstringIdentifier of the actor who performed the action
actionstringThe action performed (e.g., merchant.approve, withdrawal.reject)
resourceTypestringThe type of resource affected (e.g., merchant, withdrawal, settings)
resourceIdstringIdentifier of the affected resource
ipAddressstringIP address of the request origin
userAgentstringUser-Agent header from the request
timestampstringISO 8601 timestamp of the event
metadataobjectAdditional context about the action (varies per action)

List Audit Logs

Retrieve platform-wide audit logs. Requires admin authentication.
page
integer
default:"1"
Page number for pagination.
limit
integer
default:"20"
Items per page (max 100).
action
string
Filter by action type (e.g., merchant.approve, settings.update).
resourceType
string
Filter by resource type (e.g., merchant, withdrawal, settings).
actorId
string
Filter by the actor who performed the action.
actorType
string
Filter by actor type. One of admin, merchant, system.
fromDate
string
Filter logs from this date (ISO 8601).
toDate
string
Filter logs up to this date (ISO 8601).

Example Request

curl -X GET "https://olp-api.nipuntheekshana.com/v1/audit-logs?action=merchant.approve&page=1&limit=10" \
  -H "Authorization: Bearer <admin_token>"

Example Response (200)

{
  "data": [
    {
      "id": "log_001",
      "actorType": "admin",
      "actorId": "admin_user_001",
      "action": "merchant.approve",
      "resourceType": "merchant",
      "resourceId": "merch_abc123",
      "ipAddress": "203.0.113.45",
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
      "timestamp": "2026-03-25T14:30:00Z",
      "metadata": {
        "notes": "KYC documents verified successfully",
        "previousStatus": "pending_verification"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 156,
    "totalPages": 16
  }
}

Get Audit Log Detail

id
string
required
The unique audit log identifier.

Example Request

curl -X GET "https://olp-api.nipuntheekshana.com/v1/audit-logs/log_001" \
  -H "Authorization: Bearer <admin_token>"

Example Response (200)

{
  "id": "log_001",
  "actorType": "admin",
  "actorId": "admin_user_001",
  "action": "merchant.approve",
  "resourceType": "merchant",
  "resourceId": "merch_abc123",
  "ipAddress": "203.0.113.45",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
  "timestamp": "2026-03-25T14:30:00Z",
  "metadata": {
    "notes": "KYC documents verified successfully",
    "previousStatus": "pending_verification",
    "newStatus": "active"
  }
}

Merchant-Scoped Audit Logs

Retrieve audit logs scoped to the authenticated merchant. This endpoint is available to merchants (not admin-only) and returns only logs related to the merchant’s own resources.
page
integer
default:"1"
Page number for pagination.
limit
integer
default:"20"
Items per page (max 100).
action
string
Filter by action type.
resourceType
string
Filter by resource type.

Example Request

curl -X GET "https://olp-api.nipuntheekshana.com/v1/merchant/audit-logs?page=1&limit=10" \
  -H "Authorization: Bearer <merchant_token>"

Example Response (200)

{
  "data": [
    {
      "id": "log_042",
      "actorType": "merchant",
      "actorId": "merch_abc123",
      "action": "api_key.create",
      "resourceType": "api_key",
      "resourceId": "key_def456",
      "ipAddress": "198.51.100.22",
      "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
      "timestamp": "2026-03-24T09:00:00Z",
      "metadata": {
        "keyName": "Production Key"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 23,
    "totalPages": 3
  }
}

Error Responses

404 Not Found
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Audit log not found"
  }
}