Audit Log API
Query and export admin audit logs with filtering, pagination, and CSV export for compliance reporting.
Endpoints
GET
/v1/admin/audit-logsQuery audit logs (paginated, filtered)GET
/v1/admin/audit-logs/exportExport audit logs as CSVAuthentication
Both endpoints require API key authentication. Admin-level rate limiting is enforced.
Query Audit Logs
GET
/v1/admin/audit-logsReturns paginated admin audit logs with optional filters. Response includes aggregate stats and metadata about available filter values.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | number | 1 | Page number |
limit | number | 25 | Results per page (max 100) |
action | string | — | Filter by action type (e.g., POLICY_REVIEW_RESOLVED) |
user_id | string | — | Filter by admin user ID |
resource_type | string | — | Filter by resource type (e.g., policy, agent, api_key) |
date_from | string | — | Start date (ISO 8601 format) |
date_to | string | — | End date (ISO 8601 format) |
search | string | — | Full-text search across log details |
Response Fields
| Field | Type | Description |
|---|---|---|
logs | array | Array of audit log entries |
pagination | object | Page, limit, total, and total_pages |
stats | object | Aggregate statistics for the filtered results |
meta.actions | string[] | Available action types for filtering |
meta.resource_types | string[] | Available resource types for filtering |
Example
bash
curl "https://api.tork.network/v1/admin/audit-logs?action=POLICY_REVIEW_RESOLVED&limit=5&date_from=2026-02-01" \
-H "x-tork-api-key: tork_sk_your_api_key"json
{
"logs": [
{
"id": "log_x1y2z3",
"action": "POLICY_REVIEW_RESOLVED",
"user_id": "usr_abc",
"user_email": "admin@example.com",
"resource_type": "policy_review",
"resource_id": "rev_a1b2c3",
"details": {
"resolution": "policy_updated",
"severity": "critical"
},
"ip_address": "203.0.113.50",
"created_at": "2026-02-12T15:30:00Z"
}
],
"pagination": {
"page": 1,
"limit": 5,
"total": 12,
"total_pages": 3
},
"stats": {
"total_actions": 12,
"unique_users": 3
},
"meta": {
"actions": ["POLICY_REVIEW_RESOLVED", "EMERGENCY_SHUTDOWN_ACTIVATED", "NOTIFICATION_ROUTING_UPDATED"],
"resource_types": ["policy_review", "emergency_shutdown", "notification_routing"]
}
}Export Audit Logs
GET
/v1/admin/audit-logs/exportExports audit logs as a CSV file. Supports the same filters as the query endpoint. Returns up to 10,000 records.
Query Parameters
Same filter parameters as the query endpoint: action, user_id, resource_type, date_from, date_to, search. Pagination is fixed at page 1, limit 10,000.
Response Headers
| Header | Value |
|---|---|
Content-Type | text/csv |
Content-Disposition | attachment; filename="tork-audit-log-2026-02-12.csv" |
Example
bash
curl "https://api.tork.network/v1/admin/audit-logs/export?date_from=2026-02-01" \
-H "x-tork-api-key: tork_sk_your_api_key" \
-o audit-log.csvCompliance Reports
Use the export endpoint to generate audit trails for SOC 2, ISO 27001, and NIST AI RMF compliance reviews.
Error Responses
| Status | Description |
|---|---|
401 | Missing or invalid API key |
429 | Rate limit exceeded |
500 | Internal server error |