curl -X GET "https://api.trusec.io/v1/logs?limit=50&events=user.login,user.logout" \ -H "Authorization: Bearer trusec_sk_your_api_key"
{ "data": [ { "id": "log_abc123", "timestamp": "2024-01-20T15:30:00.000Z", "event": "user.login", "actor": { "id": "user_123", "email": "jane@example.com", "type": "user" }, "target": { "id": "session_xyz", "type": "session" }, "context": { "ip": "192.168.1.100", "userAgent": "Mozilla/5.0...", "location": { "city": "San Francisco", "country": "US" } }, "result": "success" } ], "pagination": { "hasMore": true, "nextCursor": "cur_def456" } }
Query and export audit logs
success
failure
curl -X GET "https://api.trusec.io/v1/logs/log_abc123" \ -H "Authorization: Bearer trusec_sk_your_api_key"
{ "data": { "id": "log_abc123", "timestamp": "2024-01-20T15:30:00.000Z", "event": "user.login", "actor": { "id": "user_123", "email": "jane@example.com", "type": "user" }, "target": { "id": "session_xyz", "type": "session" }, "context": { "ip": "192.168.1.100", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)", "location": { "city": "San Francisco", "region": "California", "country": "US", "coordinates": { "lat": 37.7749, "lng": -122.4194 } } }, "result": "success", "traceId": "trace_xyz789", "metadata": { "mfaUsed": true, "authMethod": "password" } } }
curl -X POST "https://api.trusec.io/v1/logs/search" \ -H "Authorization: Bearer trusec_sk_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "query": "password reset failed", "from": "2024-01-01T00:00:00Z", "limit": 20 }'
{ "data": [ { "id": "log_search123", "timestamp": "2024-01-15T10:00:00.000Z", "event": "user.password_reset.failed", "actor": { "email": "unknown@example.com", "type": "anonymous" }, "result": "failure", "highlights": { "event": "<em>password</em> <em>reset</em> <em>failed</em>" } } ], "meta": { "totalHits": 5, "searchTimeMs": 12 } }
json
csv
curl -X POST "https://api.trusec.io/v1/logs/export" \ -H "Authorization: Bearer trusec_sk_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "from": "2024-01-01T00:00:00Z", "to": "2024-01-31T23:59:59Z", "format": "csv" }'
{ "data": { "exportId": "exp_abc123", "status": "processing", "format": "csv", "estimatedRecords": 15000, "createdAt": "2024-01-20T16:00:00Z" } }
curl -X GET "https://api.trusec.io/v1/logs/export/exp_abc123" \ -H "Authorization: Bearer trusec_sk_your_api_key"
{ "data": { "exportId": "exp_abc123", "status": "completed", "format": "csv", "totalRecords": 14892, "fileSizeBytes": 2458920, "downloadUrl": "https://exports.trusec.io/exp_abc123.csv?token=...", "expiresAt": "2024-01-21T16:00:00Z", "createdAt": "2024-01-20T16:00:00Z", "completedAt": "2024-01-20T16:02:30Z" } }