Skip to main content

Audit Logs

1 API call in this section.

List Audit Logs

System Configuration / Audit Logs
GET/system/audit-logs?tenant_id={{tenant_id}}&actor_id=&start_date=&end_date=&endpoint=&method=&status_code=&page=1&limit=10

Retrieves a paginated list of audit logs with optional filtering. Audit logs track all API requests and responses for security and compliance purposes. Authentication: - Requires valid authentication token - User must have 'manage:operations:tenant' permission or be a system admin Query Parameters: - tenant_id (optional for system admins): UUID of the tenant - actor_id (optional): Filter by user ID who performed the action - start_date (optional): Filter by start date (ISO format) - end_date (optional): Filter by end date (ISO format) - endpoint (optional): Filter by API endpoint - method (optional): Filter by HTTP method - status_code (optional): Filter by HTTP status code - page (optional): Page number for pagination (default: 1) - limit (optional): Number of items per page (default: 10) Response: - Returns a paginated list of audit logs - Includes pagination metadata (total count, page, limit) - Each audit log entry includes: - Request details (method, endpoint, data) - Response details (status code, data) - Actor information (user ID) - Timestamps - IP address and user agent

Send a bearer token in Authorization and a tenant API key when the integration requires X-APIKey or X-API-Key.
Request
curl
1curl --request GET "$ONDI_BASE_URL/system/audit-logs?tenant_id={{tenant_id}}&actor_id=&start_date=&end_date=&endpoint=&method=&status_code=&page=1&limit=10" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "X-API-Key: {{api_key}}"

Query parameters

tenant_idOptional
query string

{{tenant_id}}

UUID of the tenant (optional for system admins)

actor_idOptional
query string

Filter by user ID who performed the action (optional)

start_dateOptional
query string

Filter by start date (ISO format, optional)

end_dateOptional
query string

Filter by end date (ISO format, optional)

endpointOptional
query string

Filter by API endpoint (optional)

methodOptional
query string

Filter by HTTP method (optional)

status_codeOptional
query string

Filter by HTTP status code (optional)

pageOptional
query string

1

Page number for pagination (optional, default: 1)

limitOptional
query string

10

Number of items per page (optional, default: 10)

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

X-API-KeyOptional
header string

{{api_key}}

Responses

Success Response200OK
Response body
json
1{2  "success": true,3  "message": "Audit logs retrieved successfully",4  "audit_logs": [5    {6      "id": "audit-uuid-1",7      "tenant_id": "tenant-uuid",8      "actor_id": "user-uuid-1",9      "endpoint": "/api/deliveries",10      "method": "POST",11      "request_data": {12        "pickup_location": "location-1",13        "delivery_location": "location-2"14      },15      "response_data": {16        "id": "delivery-uuid-1",17        "status": "created"18      },19      "status_code": 201,20      "ip_address": "192.168.1.1",21      "user_agent": "Mozilla/5.0...",22      "created_at": "2023-04-01T10:00:00Z"23    },24    {25      "id": "audit-uuid-2",26      "tenant_id": "tenant-uuid",27      "actor_id": "user-uuid-2",28      "endpoint": "/api/deliveries/delivery-uuid-1",29      "method": "PUT",30      "request_data": {31        "status": "in_transit"32      },33      "response_data": {34        "id": "delivery-uuid-1",35        "status": "in_transit"36      },37      "status_code": 200,38      "ip_address": "192.168.1.2",39      "user_agent": "Mozilla/5.0...",40      "created_at": "2023-04-01T11:30:00Z"41    }42  ],43  "page": 1,44  "limit": 10,45  "total": 246}
Error - Insufficient Permissions403Forbidden
Response body
json
1{2  "success": false,3  "message": "Insufficient permissions"4}
Error - Server Error500Internal Server Error
Response body
json
1{2  "success": false,3  "message": "Internal server error"4}