LaserData Audit API

Tenant audit log + user activity

OpenAPI Specification

laserdata-audit-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: LaserData Cloud Account Audit API
  description: 'Tenant audit log and per-user activity feed.


    Public REST API for the LaserData Cloud audit service.


    ## Authentication


    Every endpoint accepts either of two auth methods:

    - **API key** (machine / CI / SDK): send in the `ld-api-key` header. Cannot be used on `GET /audit/users/activity` which is session-only.

    - **Session cookie** (browser / console): obtained from `POST /account/sign_in` on the control plane.


    Audit endpoints are read-only and replay-safe by definition.


    ## Pagination


    List endpoints return a `Paged<T>` body (`page`, `total_pages`, `total_results`, `items`) and a `link` header (RFC 8288) with `rel="first"`, `"prev"`, `"next"`, `"last"` when applicable.


    ## Errors


    Error responses follow RFC 7807 `application/problem+json` with `type`, `title`, `code`, `reason`, `instance`, `status`, `retryable`, and optional `field` / `field_issues`. `retryable` is `true` for 408, 425, 429, 500, 502, 503, 504.


    ## Response headers


    - `ld-request`: request ID. Include it when reporting issues.

    - `link`: pagination relations.

    - `retry-after`: wait hint on 429 / 503.'
  termsOfService: https://laserdata.com/terms
  contact:
    name: LaserData Support
    url: https://docs.laserdata.com
    email: support@laserdata.com
  license:
    name: Proprietary
  version: 0.0.66
  x-logo:
    url: https://assets.laserdata.com/laserdata_dark.png
    altText: LaserData
    href: https://laserdata.com
servers:
- url: https://api.laserdata.cloud
  description: Production
security:
- ld_api_key: []
- session_cookie: []
tags:
- name: Audit
  description: Tenant audit log + user activity
paths:
  /audit/tenants/{tenant_id}:
    get:
      tags:
      - Audit
      summary: Query tenant audit log
      description: 'Returns the immutable, append-only audit log for a tenant. Every Console action and API call recorded against the tenant is captured. Supports pagination plus filtering by event type, date range, division, environment, deployment, user (subject), author (acting user), api_key, and correlation_id. Required permission: `audit:read`.'
      operationId: get_tenant_audit
      parameters:
      - name: tenant_id
        in: path
        description: Tenant identifier
        required: true
        schema:
          $ref: '#/components/schemas/TenantId'
      - name: page
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 1
        example: 1
      - name: results
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 1
        example: 10
      - name: from
        in: query
        description: Inclusive lower bound (RFC 3339 UTC).
        required: false
        schema:
          type:
          - string
          - 'null'
          format: date-time
        example: '2026-05-20T10:00:00Z'
      - name: to
        in: query
        description: Exclusive upper bound (RFC 3339 UTC).
        required: false
        schema:
          type:
          - string
          - 'null'
          format: date-time
        example: '2026-05-20T10:00:00Z'
      - name: division
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 0
      - name: environment
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 0
      - name: deployment
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 0
      - name: user
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 0
      - name: author
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 0
      - name: api_key
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 0
      - name: types
        in: query
        required: false
        schema:
          type:
          - string
          - 'null'
      - name: correlation_id
        in: query
        required: false
        schema:
          type:
          - string
          - 'null'
      responses:
        '200':
          description: Paged tenant audit events. Each entry carries event type, actor (author + api_key when applicable), resource scope (division/environment/deployment), event-specific data payload, correlation ID, and timestamp
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Paged_TenantAuditInfo'
        '403':
          description: Insufficient permissions (requires audit:read)
        '404':
          description: Tenant not found
  /audit/types:
    get:
      tags:
      - Audit
      summary: List audit event types
      description: 'Returns the complete catalogue of audit event type identifiers that can appear in `/audit/tenants/{tenant_id}` results. Use to populate event-type filters in UIs or to enumerate the discriminators an agent should branch on when parsing the audit stream. Each entry is `{type: <slug>, name: <human label>}` (e.g. `deployment_created`, `member_invited`, `access_rule_added`).'
      operationId: get_tenant_audit_types
      responses:
        '200':
          description: All audit event types (snake_case slug + human-readable label)
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AuditTypeInfo'
        '401':
          description: No active session
  /audit/users/activity:
    get:
      tags:
      - Audit
      summary: List my activity
      description: 'Returns the calling user''s recent activity across all tenants the user is a member of: signed-in actions, API key calls they own, sessions, role changes. Use to populate a personal audit timeline in the Console. Session-only: API keys are tenant-scoped and cannot list user activity.'
      operationId: get_user_activity
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 1
        example: 1
      - name: results
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int64
          minimum: 1
        example: 10
      - name: from
        in: query
        description: Inclusive lower bound (RFC 3339 UTC).
        required: false
        schema:
          type:
          - string
          - 'null'
          format: date-time
        example: '2026-05-20T10:00:00Z'
      - name: to
        in: query
        description: Exclusive upper bound (RFC 3339 UTC).
        required: false
        schema:
          type:
          - string
          - 'null'
          format: date-time
        example: '2026-05-20T10:00:00Z'
      - name: types
        in: query
        required: false
        schema:
          type:
          - string
          - 'null'
      responses:
        '200':
          description: Paged user activity events with event type, target resource, and timestamp
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Paged_UserActivityInfo'
        '401':
          description: No active session
      security:
      - session_cookie: []
components:
  schemas:
    AuditTypeInfo:
      type: object
      required:
      - type
      - name
      properties:
        name:
          type: string
        type:
          type: string
      example:
        type: deployment_created
        name: Deployment created
    Paged_UserActivityInfo:
      type: object
      required:
      - total_pages
      - total_results
      - page
      - items
      properties:
        items:
          type: array
          items:
            type: object
            required:
            - type
            - name
            - timestamp
            properties:
              data: {}
              deployment:
                oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/AuditResource'
              division:
                oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/AuditResource'
              environment:
                oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/AuditResource'
              name:
                type: string
              tenant:
                oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/AuditResource'
              timestamp:
                type: string
                format: date-time
              type:
                type: string
            example:
              type: member_joined
              name: Member joined
              tenant:
                id: 5547234
                name: Acme Inc.
              division: null
              environment: null
              deployment: null
              data: null
              timestamp: '2026-05-23T09:00:00Z'
        page:
          type: integer
          format: int64
          example: 1
          minimum: 1
        total_pages:
          type: integer
          format: int64
          example: 4
          minimum: 0
        total_results:
          type: integer
          format: int64
          example: 137
          minimum: 0
    Paged_TenantAuditInfo:
      type: object
      required:
      - total_pages
      - total_results
      - page
      - items
      properties:
        items:
          type: array
          items:
            type: object
            required:
            - type
            - name
            - timestamp
            properties:
              api_key:
                oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/AuditResource'
              author:
                oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/AuditResource'
              correlation_id:
                type:
                - string
                - 'null'
              data: {}
              deployment:
                oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/AuditResource'
              division:
                oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/AuditResource'
              environment:
                oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/AuditResource'
              name:
                type: string
              timestamp:
                type: string
                format: date-time
              type:
                type: string
              user:
                oneOf:
                - type: 'null'
                - $ref: '#/components/schemas/AuditResource'
            example:
              type: deployment_created
              name: Deployment created
              author:
                id: 7283491
                name: Alice Smith
              user: null
              division:
                id: 5547234
                name: engineering
              environment:
                id: 9082734
                name: production
              deployment:
                id: 1290387450
                name: primary-stream
              api_key:
                id: 8472634927
                name: ci-deploy
              data:
                cloud: aws
                region: us-east-1
                tier: standard
              correlation_id: 550e8400e29b41d4a716446655440000
              timestamp: '2026-05-23T10:23:14.123456Z'
        page:
          type: integer
          format: int64
          example: 1
          minimum: 1
        total_pages:
          type: integer
          format: int64
          example: 4
          minimum: 0
        total_results:
          type: integer
          format: int64
          example: 137
          minimum: 0
    AuditResource:
      type: object
      required:
      - id
      properties:
        id:
          type: integer
          format: int64
          minimum: 0
        name:
          type:
          - string
          - 'null'
    TenantId:
      type: integer
      format: int64
      example: 7261845022003200001
      minimum: 0
  securitySchemes:
    ld_api_key:
      type: apiKey
      in: header
      name: ld-api-key
      description: Tenant API key sent in the ld-api-key request header. Scoped to tenant-level audit reads. Cannot be used on user-scope endpoints (`/audit/users/activity`).
    session_cookie:
      type: apiKey
      in: cookie
      name: session
      description: Browser session cookie issued by POST /account/sign_in on core. Required for user-scope endpoints.
externalDocs:
  url: https://docs.laserdata.com
  description: LaserData Cloud documentation