# Query audit log Retrieve structured audit log entries for an organization with filtering, search, and pagination. Returns a paginated list of audit entries tracking all mutations in your organization: role assignments, department changes, user management, and more. Supports filtering by entity type, action type, actor, date range, and full-text search. #### Path Parameters **`organization_id`** string required The unique identifier of the organization. #### Query Parameters **`entity_type`** string optional Filter by entity type. Values: `user`, `department`, `role`, `role_assignment`, `department_membership`, `permission`, `knowledge_slice`, `vector_store`, `knowledge_grant`, `knowledge_composite`. **`action_type`** string optional Filter by action type. Values: `created`, `updated`, `deleted`, `invited`, `deactivated`, `reactivated`, `removed`, `assigned`, `unassigned`, `reparented`, `membership_added`, `membership_removed`, and more. **`actor_id`** string optional Filter by the user who performed the action. **`target_id`** string optional Filter by the target entity of the action. **`department_id`** string optional Filter by department context. **`from_date`** string optional Filter entries from this date (ISO 8601 format, e.g. `2025-01-01`). **`to_date`** string optional Filter entries until this date (ISO 8601 format, e.g. `2025-12-31`). **`search_term`** string optional Full-text search across entity name, actor name, and actor email. **`skip`** integer optional · Defaults to `0` Number of entries to skip for pagination. **`limit`** integer optional · Defaults to `50` Number of entries to return per page. Maximum: 100. ## Returns Returns a paginated list of audit entries with total count and pagination metadata. - **`items`** — Array of audit entry objects - **`total`** — Total number of entries matching all filters - **`skip`** — Current offset - **`limit`** — Current page size - **`has_more`** — Whether more entries exist beyond this page Request ```bash cURL curl -s -X GET "https://api.aitronos.com/v1/organizations/org_abc123/audit-log?entity_type=role&action_type=assigned&limit=10" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" | python3 -m json.tool ``` ```python Python SDK from aitronos import Aitronos client = Aitronos(api_key="your-api-key") result = client.audit_log.query( organization_id="org_abc123", entity_type="role", action_type="assigned", limit=10, ) print(result) ``` ```python Python import requests response = requests.get( "https://api.aitronos.com/v1/organizations/org_abc123/audit-log", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, params={ "entity_type": "role", "action_type": "assigned", "limit": 10, }, ) print(response.json()) ``` ```javascript JavaScript const response = await fetch( "https://api.aitronos.com/v1/organizations/org_abc123/audit-log?entity_type=role&action_type=assigned&limit=10", { headers: { "Authorization": "Bearer YOUR_ACCESS_TOKEN", }, } ); const data = await response.json(); console.log(data); ``` Response ```json 200 OK { "items": [ { "id": "aentry_abc123def456", "entity_type": "role_assignment", "entity_id": "role_xyz789", "entity_name": "Admin", "action_type": "assigned", "actor_id": "usr_owner123", "actor_name": "Jane Smith", "actor_email": "jane@example.com", "target_id": "usr_newuser456", "target_name": "John Doe", "previous_value": null, "new_value": null, "metadata": null, "organization_id": "org_abc123", "department_id": null, "created_at": "2026-01-15T10:30:00Z" } ], "total": 1, "skip": 0, "limit": 10, "has_more": false } ``` ```json 403 Forbidden { "success": false, "error": { "code": "INSUFFICIENT_PERMISSIONS", "message": "You don't have permission to access this resource.", "system_message": "Insufficient permissions for this operation", "type": "client_error", "status": 403, "details": { "required_capability": "view_audit_log" }, "trace_id": "abc-123-def", "timestamp": "2026-01-15T10:30:00Z" } } ``` ## Related Resources - [Export Audit Log](/docs/api-reference/audit-log/export)