---
title: "Get audit logs"
method: GET
path: "/api/v2/audit"
tags: ["Audit"]
---

# Get audit logs

`GET /api/v2/audit`

## Query parameters

- `q` string
- `limit` integer, required
- `offset` integer

## Response `200`

OK

- CodersdkAuditLogResponse
  - `audit_logs` CodersdkAuditLog[]
    - `action` 'create' | 'write' | 'delete' | 'start' | 'stop' | 'login' | 'logout' | 'register' | 'request_password_reset' | 'connect' | 'disconnect' | 'open' | 'close'
    - `additional_fields` object
    - `description` string
    - `diff` CodersdkAuditDiff
    - `id` string, uuid
    - `ip` string
    - `is_deleted` boolean
    - `organization` CodersdkMinimalOrganization
      - `display_name` string
      - `icon` string
      - `id` string, uuid, required
      - `name` string
    - `organization_id` string, uuid — Deprecated: Use 'organization.id' instead.
    - `request_id` string, uuid
    - `resource_icon` string
    - `resource_id` string, uuid
    - `resource_link` string
    - `resource_target` string — ResourceTarget is the name of the resource.
    - `resource_type` 'template' | 'template_version' | 'user' | 'workspace' | 'workspace_build' | 'git_ssh_key' | 'api_key' | 'group' | 'license' | 'convert_login' | 'health_settings' | 'notifications_settings' | 'prebuilds_settings' | 'oauth2_provider_settings' | 'workspace_proxy' | 'organization' | 'oauth2_provider_app' | 'oauth2_provider_app_secret' | 'custom_role' | 'organization_member' | 'notification_template' | 'idp_sync_settings_organization' | 'idp_sync_settings_group' | 'idp_sync_settings_role' | 'workspace_agent' | 'workspace_app' | 'task' | 'ai_seat' | 'ai_provider' | 'ai_provider_key' | 'ai_gateway_key' | 'group_ai_budget' | 'user_ai_budget_override' | 'chat' | 'user_secret' | 'user_skill'
    - `status_code` integer
    - `time` string, date-time
    - `user` CodersdkUser
      - `avatar_url` string, uri
      - `created_at` string, date-time, required
      - `email` string, email, required
      - `has_ai_seat` boolean — HasAISeat intentionally omits omitempty so the API always includes the field, even when false.
      - `id` string, uuid, required
      - `is_service_account` boolean
      - `last_seen_at` string, date-time
      - `login_type` '' | 'password' | 'github' | 'oidc' | 'token' | 'none'
      - `name` string
      - `organization_ids` string[]
      - `roles` CodersdkSlimRole[]
        - `display_name` string
        - `name` string
        - `organization_id` string
      - `status` 'active' | 'dormant' | 'suspended'
      - `theme_preference` string — Deprecated: this value should be retrieved from `codersdk.UserPreferenceSettings` instead.
      - `updated_at` string, date-time
      - `username` string, required
    - `user_agent` string
  - `count` integer
  - `count_cap` integer

---

[API](https://skmtc.net/coder/apis/coder-api.md) · [All operations](https://skmtc.net/coder/apis/coder-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/coder/coder-api/revisions/50a77af44008/schema)
