> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.select.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Export audit logs

> Append-only, oldest-first stream of audit log records, designed for continuous polling (e.g. SIEM export). Records are immutable once written.

The audit log records every create, update, and delete on your SELECT resources, plus events like login and org membership changes — who changed what, and when. Each record is tied to either a `resource` (something in SELECT that changed) or an `event_type` (something that happened with no resource). 

| Name | Kind | What it is |
| --- | --- | --- |
| `actions` | resource | Cost-saving actions |
| `alert_destinations` | resource | Alert destinations (Slack channels, MS Teams webhooks, email addresses) |
| `alert_integrations` | resource | Alert notification integrations (Slack, MS Teams, email) |
| `api_keys` | resource | API keys |
| `budgets` | resource | Budgets |
| `connections` | resource | Data warehouse connections |
| `dashboards` | resource | Dashboards |
| `dashboard_digests` | resource | Scheduled dashboard digests |
| `insights` | resource | Insights |
| `monitors_v2` | resource | Monitors |
| `saved_views` | resource | Saved views |
| `snowflake_warehouses` | resource | Snowflake warehouse settings |
| `teams` | resource | Teams |
| `ticket_integrations` | resource | Ticketing tool integrations (Jira, etc.) |
| `ticket_links` | resource | Links between SELECT items and external tickets or web addresses |
| `user_roles` | resource | User and role assignments |
| `usage_group_sets` | resource | Usage group sets |
| `session` | event | Login / logout |
| `invitation` | event | Org invitation created / revoked |
| `users` | event | User removed from the org |
| `organization` | event | Organization-level settings: trial end date, app warehouse size, feature enablement, data share provisioning |

## How to poll

Page with `page_token`, and drain every poll until `page_token` is `null`:

1. **First run** — call with no `page_token`. Optionally set `changed_at__gte` to a start date to skip old history.
2. **Drain** — keep re-requesting with the `page_token` from the previous response until the response returns `page_token: null` (you are caught up).
3. **Persist** the last non-null `page_token` you received.
4. **Next poll** — resume from that stored `page_token`. It continues strictly after the last record you ingested, so every new record is delivered exactly once.

> **Do not build your own cursor from `changed_at`.** Bulk operations can stamp thousands of records with the exact same `changed_at`. A client that computes its next request from `max(changed_at)` will re-receive duplicates and, if a single-timestamp cluster is larger than `max_results`, loop forever and never advance past it. Always page with `page_token`.

`sort_order` defaults to `asc` (oldest-first) to preserve the SIEM drain-forward contract above; pass `desc` for newest-first. A `page_token` carries the `sort_order` it was minted with, so resuming with the other order is rejected rather than silently resuming in the wrong direction.



## OpenAPI

````yaml https://api.select.dev/v2/openapi.json get /audit-logs
openapi: 3.1.0
info:
  title: SELECT API (v2)
  version: 0.1.0
servers:
  - url: https://api.select.dev/v2
    description: SELECT API v2
security: []
tags:
  - name: metrics
    description: >-
      Query cost and usage data across Snowflake, BigQuery, Databricks and
      Tableau. Each route is `POST /v2/metrics/<model>/query` for one semantic
      model. Every route takes the same body shape and returns the same response
      shape. Each route page gives guidance on when to use the route, and worked
      examples.


      ## Body shape


      | Field | Meaning |

      | --- | --- |

      | `measures` | Aggregates to compute, for example `sum_spend`. |

      | `dimensions` | Fields to group by. Each one is returned on every row. |

      | `filter_expression` | An `and`/`or` tree of filters on dimensions,
      applied before aggregation. |

      | `measure_filters` | Filters on measures, applied after aggregation. |

      | `sort` | The order of the rows: `[{"field": "sum_spend", "direction":
      "desc"}]`. |

      | `limit` | The maximum number of rows. Results are not paginated: `limit`
      cuts the result short, and there is no next page. Omit `limit` to get all
      rows. |

      | `aggregate` | Set `false` to list the rows with no grouping. See
      "Listing rows". |


      v2 accepts only `filter_expression`. The body refuses the legacy `filters`
      list.


      ## Filter on dates


      Filter on the `day` field. Use two filters (both bounds are inclusive):


      ```json

      {"operator": "and", "filters": [
        {"field": "day", "operator": ">=", "value": "2026-08-01"},
        {"field": "day", "operator": "<=", "value": "2026-08-31"}], "limit": 1000}
      ```


      Or use one relative filter: `{"field": "day", "operator": "in range",
      "value": "30D"}`. The values are `{N}D` and `{N}M` (the last N days or
      months, today included), `WTD`, `MTD`, `QTD`, `YTD`, and `LMTD` (the whole
      previous calendar month).


      - Do not filter on `hour`, `week`, `month` or `quarter` to bound a range.
      Filter on `day`, and use the coarser fields as dimensions.

      - A timestamp such as `start_time <= "2026-08-31"` compares to midnight
      and drops most of that day. Use `day`, or `start_time < "2026-09-01"`.

      - A snapshot route (for example `snowflake-storage-summary`) describes the
      current state, and a `day` filter does not bound its size and cost fields.
      On routes that join the snapshot to activity, `day` bounds only the
      activity fields. Each route page says which fields these are.


      ## Which measure is cost


      - `sum_spend` (or `spend`, or `cost` on some routes) is the dollar cost in
      the filtered period. Use it for "how much did we spend".

      - `*_annualized` measures extend the spend of the filtered period to a
      year: a `7D` range gives that week's spend times 365 / 7. They are
      projections, not spend.

      - On snapshot routes, `annual_cost`, `*_monthly_cost` and `*_annual_cost`
      are the current rate extended to a month or a year. A date range does not
      bound them.

      - Do not present any of these run-rates as spend in a period.

      - Databricks routes also give DBUs (for example `sum_task_usage`). DBUs
      are not dollars.


      The `spend` route is the consolidated cost of every platform. Use it for
      totals, trends and breakdowns by service. Use a platform route to explain
      what inside the platform caused the cost.


      ## Text values are case-sensitive


      Filter values must match the stored case. A value in the wrong case
      matches no rows, with no error. For example:


      - On `spend`, `connection_type` is `Snowflake`, `Bigquery` or
      `Databricks`, and `"snowflake"` matches nothing.

      - On `search`, `data-freshness` and `workload-metadata-suggestions`,
      `connection_type` is lowercase: `snowflake`, `bigquery`, `databricks`.

      - On `snowflake-workloads`, most `resource_type` values are lowercase keys
      (`query_pattern`, `dbt`), but the AI types are title case (`Cortex
      Analyst`).


      ## Usage groups


      A usage group set divides cost into named groups, such as departments or
      teams. To group by the groups of one set, name the set in `path`:


      ```json

      {"dimensions": [{"field": "usage_group", "path": ["Department"]}],
      "limit": 1000}

      ```


      `path[0]` is the name of the set, not its ID. A plain `"usage_group"`
      dimension groups by every set at once. The same `{"field": ..., "path":
      [...]}` form reads keys of other semi-structured fields, for example
      workload metadata.


      ## Period over period


      Some routes publish `<measure>_previous_period`, `change_<measure>` and
      `percent_change_<measure>`. These measures need one bounded date range on
      `day`, at the top level of `filter_expression`:


      - Use two bounds on `day`, or one `in range` filter. Do not mix the two
      forms.

      - Do not nest the date filter in a sub-expression, and do not bound the
      range with `month` or `quarter`.

      - The previous period is the same number of days, just before the range.
      For `QTD` on 2026-09-28 (2026-07-01 to 2026-09-28, 90 days), the previous
      period is 2026-04-02 to 2026-06-30, not the previous calendar quarter.


      ## Listing rows


      Set `"aggregate": false` and name only `dimensions` to get the rows as
      they are, for example the individual queries that ran longer than ten
      minutes. If the body also names `measures` or `measure_filters`, the route
      aggregates, with no error. Always set a `limit` on a listing.


      ## Default scoping filters


      Some tables hold more than one kind of row, and the SELECT app filters to
      one kind by default. Each route page names these filters. For example:


      - `snowflake-query-patterns`: `{"field": "resource_type", "operator":
      "in", "values": ["query_pattern"]}`. `bigquery-query-patterns` filters
      `workload_type` to `bigquery_query_pattern`, and
      `databricks-query-patterns` filters `resource_type` to
      `databricks_query_pattern`.

      - `snowflake-dbt`: `{"field": "dbt_node_resource_type", "operator": "=",
      "value": "model"}`. Without it, tests, seeds and snapshots rank with
      models. The same filter applies to `bigquery-dbt-queries` and
      `databricks-dbt-queries`.


      ## Teams


      Send `X-Team-Id` to evaluate a query as a team you belong to. The rows are
      then limited to what the team's roles can reach.


      ## Which route answers which question


      | Question | Route |

      | --- | --- |

      | Total spend, spend trend, spend by platform, service or usage group |
      `spend` |

      | Most expensive Snowflake warehouses | `snowflake-workloads` (or
      `snowflake-warehouses` for metering spend) |

      | Warehouse utilization, idle spend, cluster usage |
      `snowflake-warehouses`, `snowflake-warehouse-clusters` |

      | Query latency, spillage and bytes scanned on a warehouse |
      `snowflake-warehouse-query-performance` |

      | Most expensive recurring queries | `snowflake-query-patterns` |

      | Individual queries | `snowflake-queries` |

      | Cost of dbt models, and of dbt runs | `snowflake-dbt`,
      `snowflake-dbt-invocations` |

      | Cost of tasks, stored procedures, dynamic tables | `snowflake-tasks`,
      `snowflake-stored-procedures`, `snowflake-dynamic-tables` |

      | Cost of BI tools (Looker, Mode, Hex, Sigma, Periscope, Tableau) |
      `snowflake-looker`, `snowflake-mode`, `snowflake-hex`, `snowflake-sigma`,
      `snowflake-periscope`, `tableau-queries` |

      | Cost of Fivetran, and of workloads defined by query tags |
      `snowflake-fivetran`, `snowflake-custom-workloads` |

      | Serverless, automatic clustering and Snowpipe cost |
      `snowflake-serverless`, `snowflake-automatic-clustering`,
      `snowflake-snowpipe` |

      | Storage cost in a period | `snowflake-storage`, `bigquery-storage-spend`
      |

      | Largest or unused tables now | `snowflake-storage-summary`,
      `bigquery-storage-summary` |

      | Which workloads read or write a table | `lineage-workloads`,
      `lineage-tables`, `lineage-edges` |

      | BigQuery cost by project, job or query pattern | `bigquery-projects`,
      `bigquery-jobs`, `bigquery-query-patterns` |

      | BigQuery reservations and commitments | `bigquery-reservation-timeline`,
      `bigquery-commitments`, `bigquery-commitment-scopes` |

      | Databricks cost by job, query, SQL warehouse or cluster |
      `databricks-jobs`, `databricks-queries`, `databricks-sql-warehouses`,
      `databricks-clusters` |

      | Savings from SELECT actions | `action-realized-savings` |

      | How current the data is | `data-freshness` |
paths:
  /audit-logs:
    get:
      tags:
        - audit-logs
      summary: Export audit logs
      description: >-
        Append-only, oldest-first stream of audit log records, designed for
        continuous polling (e.g. SIEM export). Records are immutable once
        written.


        The audit log records every create, update, and delete on your SELECT
        resources, plus events like login and org membership changes — who
        changed what, and when. Each record is tied to either a `resource`
        (something in SELECT that changed) or an `event_type` (something that
        happened with no resource). 


        | Name | Kind | What it is |

        | --- | --- | --- |

        | `actions` | resource | Cost-saving actions |

        | `alert_destinations` | resource | Alert destinations (Slack channels,
        MS Teams webhooks, email addresses) |

        | `alert_integrations` | resource | Alert notification integrations
        (Slack, MS Teams, email) |

        | `api_keys` | resource | API keys |

        | `budgets` | resource | Budgets |

        | `connections` | resource | Data warehouse connections |

        | `dashboards` | resource | Dashboards |

        | `dashboard_digests` | resource | Scheduled dashboard digests |

        | `insights` | resource | Insights |

        | `monitors_v2` | resource | Monitors |

        | `saved_views` | resource | Saved views |

        | `snowflake_warehouses` | resource | Snowflake warehouse settings |

        | `teams` | resource | Teams |

        | `ticket_integrations` | resource | Ticketing tool integrations (Jira,
        etc.) |

        | `ticket_links` | resource | Links between SELECT items and external
        tickets or web addresses |

        | `user_roles` | resource | User and role assignments |

        | `usage_group_sets` | resource | Usage group sets |

        | `session` | event | Login / logout |

        | `invitation` | event | Org invitation created / revoked |

        | `users` | event | User removed from the org |

        | `organization` | event | Organization-level settings: trial end date,
        app warehouse size, feature enablement, data share provisioning |


        ## How to poll


        Page with `page_token`, and drain every poll until `page_token` is
        `null`:


        1. **First run** — call with no `page_token`. Optionally set
        `changed_at__gte` to a start date to skip old history.

        2. **Drain** — keep re-requesting with the `page_token` from the
        previous response until the response returns `page_token: null` (you are
        caught up).

        3. **Persist** the last non-null `page_token` you received.

        4. **Next poll** — resume from that stored `page_token`. It continues
        strictly after the last record you ingested, so every new record is
        delivered exactly once.


        > **Do not build your own cursor from `changed_at`.** Bulk operations
        can stamp thousands of records with the exact same `changed_at`. A
        client that computes its next request from `max(changed_at)` will
        re-receive duplicates and, if a single-timestamp cluster is larger than
        `max_results`, loop forever and never advance past it. Always page with
        `page_token`.


        `sort_order` defaults to `asc` (oldest-first) to preserve the SIEM
        drain-forward contract above; pass `desc` for newest-first. A
        `page_token` carries the `sort_order` it was minted with, so resuming
        with the other order is rejected rather than silently resuming in the
        wrong direction.
      operationId: list_audit_logs_audit_logs_get
      parameters:
        - name: max_results
          in: query
          required: false
          schema:
            type: integer
            description: Maximum number of records to return (1–500).
            default: 50
            title: Max Results
          description: Maximum number of records to return (1–500).
        - name: sort_order
          in: query
          required: false
          schema:
            enum:
              - asc
              - desc
            type: string
            description: '`asc` (default, oldest-first) or `desc` (newest-first).'
            default: asc
            title: Sort Order
          description: '`asc` (default, oldest-first) or `desc` (newest-first).'
        - name: page_token
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Opaque cursor from a previous response. Omit on the first call.
            title: Page Token
          description: Opaque cursor from a previous response. Omit on the first call.
        - name: changed_at__gte
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Changed At  Gte
        - name: changed_at__lte
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Changed At  Lte
        - name: changed_at__in_range
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Changed At  In Range
        - name: table_name__in
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Table Name  In
        - name: event_type__in
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Event Type  In
        - name: changed_by__ilike
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Changed By  Ilike
        - name: changed_by__not_ilike
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Changed By  Not Ilike
        - name: changed_by__isnull
          in: query
          required: false
          schema:
            anyOf:
              - type: boolean
              - type: 'null'
            title: Changed By  Isnull
        - name: resource__in
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Resource  In
        - name: resource__not_in
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Resource  Not In
        - name: operation__in
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Operation  In
        - name: operation__not_in
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Operation  Not In
        - name: status__in
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Status  In
        - name: status__not_in
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Status  Not In
        - name: id__in
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Id  In
        - name: x-tenant-id
          in: header
          required: true
          schema:
            type: string
            description: The organization ID the request is scoped to.
            title: X-Tenant-Id
          description: The organization ID the request is scoped to.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListResponse_ExportAuditLog_'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '408':
          $ref: '#/components/responses/RequestTimeout'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      security:
        - HTTPBearer: []
components:
  schemas:
    ListResponse_ExportAuditLog_:
      properties:
        items:
          items:
            $ref: '#/components/schemas/ExportAuditLog'
          type: array
          title: Items
        page_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Page Token
          description: Opaque cursor for the next page; empty/absent on the last page.
        row_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Row Count
          description: >-
            Best-effort total for the filtered result set; may be null when
            expensive.
      type: object
      required:
        - items
      title: ListResponse[ExportAuditLog]
    ExportAuditLog:
      properties:
        id:
          type: string
          title: Id
          description: The unique identifier of the audit log record.
        resource:
          anyOf:
            - type: string
            - type: 'null'
          title: Resource
          description: >-
            The kind of record that was changed (e.g. `dashboards`,
            `connections`, `user_roles`). Null for event-driven records, which
            set `event_type` instead.
        event_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Event Type
          description: >-
            The kind of event for records with no backing resource (e.g.
            `users`, `invitation`, `session`). Null for resource-backed records,
            which set `resource` instead. Exactly one of `resource` /
            `event_type` is set.
        record_id:
          type: string
          title: Record Id
          description: The id of the changed record.
        operation:
          type: string
          enum:
            - insert
            - update
            - delete
          title: Operation
          description: 'The operation performed: insert, update, or delete.'
        status:
          type: string
          enum:
            - success
            - failure
          title: Status
          description: >-
            Outcome of the action: `success`, or `failure` for an attempt that
            did not complete (e.g. a failed login, which is otherwise recorded
            with the same `operation` as a successful one).
        changed_by:
          type: string
          title: Changed By
          description: Who made the change (user email or API key name).
        changed_at:
          type: string
          title: Changed At
          description: When the change occurred — RFC 3339 UTC, e.g. 2026-06-05T10:30:00Z.
        updates:
          items:
            $ref: '#/components/schemas/ExportAuditFieldUpdate'
          type: array
          title: Updates
          description: The list of field changes captured for this record.
      type: object
      required:
        - id
        - record_id
        - operation
        - status
        - changed_by
        - changed_at
        - updates
      title: ExportAuditLog
      description: A single audit log record, slimmed for export.
    ProblemDetail:
      additionalProperties: true
      description: >-
        RFC 9457-style error payload, served as ``application/problem+json``.


        ``code`` is the stable, machine-readable identifier — consumers branch
        on it,

        never on ``title``. ``type`` stays ``about:blank``: we keep no per-error

        documentation pages. There is no ``instance``/request-id member (we
        don't run

        access logs). See the flat error-code catalogue in §4 of the standards
        doc.
      properties:
        type:
          default: about:blank
          title: Type
          type: string
        title:
          type: string
          title: Title
        status:
          title: Status
          type: integer
        detail:
          title: Detail
          type: string
        code:
          $ref: '#/components/schemas/ErrorCode'
        retryable:
          title: Retryable
          type: boolean
        details:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          default: null
          title: Details
      required:
        - title
        - status
        - detail
        - code
        - retryable
      title: ProblemDetail
      type: object
    ExportAuditFieldUpdate:
      properties:
        field:
          type: string
          title: Field
          description: The name of the field that changed.
        old_value:
          title: Old Value
          description: The value before the change.
        new_value:
          title: New Value
          description: The value after the change.
      type: object
      required:
        - field
        - old_value
        - new_value
      title: ExportAuditFieldUpdate
      description: A single field change, slimmed for export (drops UI label + raw values).
    ErrorCode:
      type: string
      enum:
        - validation_failed
        - unauthorized
        - invalid_token
        - forbidden
        - not_found
        - tenant_id_required
        - tenant_mismatch
        - conflict
        - delete_blocked_by_dependencies
        - query_profile_unavailable
        - insight_auto_closed
        - integration_credentials_rejected
        - describe_procedure_unavailable
        - missing_grant
        - monitor_run_without_period
        - template_render_failed
        - response_too_large
        - precondition_failed
        - precondition_required
        - quota_exceeded
        - rate_limited
        - filter_key_not_supported
        - pagination_token_expired
        - pagination_token_invalid
        - internal_error
        - service_unavailable
      title: ErrorCode
      description: >-
        The machine-readable identifier of an error.


        Clients branch on this, never on ``title`` or ``detail``. A published
        code keeps

        its meaning; new codes may be added.
  responses:
    BadRequest:
      description: Bad request
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
    Unauthorized:
      description: Unauthorized
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
      headers:
        WWW-Authenticate:
          description: Authentication challenge for the requested resource.
          required: true
          schema:
            type: string
    Forbidden:
      description: Forbidden
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
    NotFound:
      description: Not found
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
    MethodNotAllowed:
      description: Method not allowed
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
      headers:
        Allow:
          description: HTTP methods supported by the requested resource.
          required: true
          schema:
            type: string
    RequestTimeout:
      description: Request Timeout
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
    ValidationFailed:
      description: Validation failed
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
    RateLimited:
      description: Rate limited
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
      headers:
        Retry-After:
          description: Number of seconds to wait before retrying the request.
          required: true
          schema:
            type: integer
            minimum: 0
    InternalError:
      description: Internal error
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
    ServiceUnavailable:
      description: Service unavailable
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetail'
      headers:
        Retry-After:
          description: Number of seconds to wait before retrying the request.
          required: true
          schema:
            type: integer
            minimum: 0
  securitySchemes:
    HTTPBearer:
      type: http
      description: Organization API key (sl_…).
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.