Audit Logs
List audit logs
Section titled “List audit logs”GET /api/audit-logsReturns a paginated list of audit log entries for the authenticated user’s organization, newest first. Audit logs record actions like API key creation, deletion, profile updates, and proxy endpoint changes.
Auth required: Yes
Query parameters
Section titled “Query parameters”| Parameter | Type | Description |
|---|---|---|
cursor | string | Pagination cursor from previous response |
limit | number | Items per page (1–100, default 20) |
Response
Section titled “Response”{ "items": [ { "id": "a1b2c3d4-...", "user_id": "...", "org_id": "...", "action": "api_key.created", "resource_type": "api_key", "resource_id": "550e8400-...", "metadata": "{\"name\":\"CLI - MacBook Pro\"}", "created_at": "2026-03-17T01:00:00.000Z" } ], "nextCursor": "2026-03-17T01:00:00.000Z|a1b2c3d4-...", "hasMore": false}Fields
Section titled “Fields”| Field | Type | Description |
|---|---|---|
id | string | Unique audit log ID |
user_id | string | ID of the user who performed the action |
org_id | string | Organization ID |
action | string | Action identifier (e.g. api_key.created, proxy_endpoint.deleted) |
resource_type | string | Type of resource affected (e.g. api_key, proxy_endpoint, profile) |
resource_id | string | null | ID of the affected resource |
metadata | string | null | JSON string with additional context |
created_at | string | ISO timestamp of when the action occurred |
Example
Section titled “Example”curl "https://codecosts.com/api/audit-logs?limit=10" \ -H "Authorization: Bearer $CODECOSTS_API_KEY"