Anaconda Audit Logs API

The Audit Logs API from Anaconda — 5 operation(s) for audit logs.

OpenAPI Specification

anaconda-audit-logs-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Audit Logs API
  version: 0.1.0
servers:
- url: https://anaconda.com
  description: Anaconda Cloud
tags:
- name: Audit Logs
paths:
  /api/audit-logs:
    get:
      description: Retrieve audit logs for your organization with support for search, sorting, pagination, and date filtering.
      operationId: get_audit_logs__get
      parameters:
      - description: 'Filter audit logs by field values. Use the format `column_name:value1,value2` to match entries where the column contains any of the specified values.


          You can pass multiple `q` parameters to build complex filters. They are combined using the `search_operator` parameter.'
        in: query
        name: q
        required: false
        schema:
          default: []
          items:
            type: string
          title: Q
          type: array
      - description: 'The logical operator used to combine multiple `q` filters.


          Use `or` to return logs matching any filter. Use `and` to return only logs matching all filters.'
        in: query
        name: search_operator
        required: false
        schema:
          default: or
          title: Search Operator
          type: string
      - description: 'Sort the results by one or more columns. Use the format `column_name` for ascending order or `-column_name` for descending order.


          For example, `-occurred_at` sorts by most recent first.'
        in: query
        name: sort
        required: false
        schema:
          default: ''
          title: Sort
          type: string
      - description: The maximum number of audit log entries to return per page.
        in: query
        name: limit
        required: false
        schema:
          default: 100
          maximum: 1000
          minimum: 1
          title: Limit
          type: integer
      - description: The number of entries to skip before returning results. Use with `limit` to paginate through large result sets.
        in: query
        name: offset
        required: false
        schema:
          default: 0
          minimum: 0
          title: Offset
          type: integer
      - description: Only return audit logs that occurred on or after this timestamp. Use ISO 8601 format with timezone.
        in: query
        name: from_date
        required: false
        schema:
          anyOf:
          - format: date-time
            type: string
            example: <timestamp>
          - type: 'null'
          title: From Date
      - description: Only return audit logs that occurred on or before this timestamp. Use ISO 8601 format with timezone.
        in: query
        name: to_date
        required: false
        schema:
          anyOf:
          - format: date-time
            type: string
            example: <timestamp>
          - type: 'null'
          title: To Date
      - description: 'Your organization ID, found in your organization''s URL: `anaconda.com/app/organizations/<ORG_ID>/`.'
        in: header
        name: X-Org-Name
        required: true
        schema:
          type: string
          title: X-Org-Name
      - description: The API version to use. Set to `v1`.
        in: header
        name: X-API-Version
        required: true
        schema:
          default: v1
          title: X-Api-Version
          type: string
      responses:
        '200':
          description: 'Request succeeded and a paginated list of audit logs is returned.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse_AuditLogResponse_'
        '422':
          description: 'The request parameters failed validation.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - JWT or Access Token: []
      summary: Get Audit Logs
      tags:
      - Audit Logs
  /api/audit-logs/{audit_log_id}:
    get:
      description: Retrieve a single audit log entry by its unique identifier.
      operationId: get_audit_log__audit_log_id__get
      parameters:
      - description: 'UUID of the audit log entry to retrieve.

          '
        in: path
        name: audit_log_id
        required: true
        schema:
          description: 'Identifier of the audit log entry.

            '
          format: uuid
          title: Audit Log Id
          type: string
          example: <uuid>
      - description: 'Name of the organization to scope the request to. This header is required

          in multi-tenant deployments.

          '
        in: header
        name: X-Org-Name
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Organization name used to resolve the tenant context.

            '
          title: X-Org-Name
      - description: The API version to use. Set to `v1`.
        in: header
        name: X-API-Version
        required: false
        schema:
          default: v1
          description: 'API version to target for this request.

            '
          title: X-Api-Version
          type: string
      responses:
        '200':
          description: 'Request succeeded and the requested audit log entry is returned.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuditLogResponse'
        '422':
          description: 'The request parameters failed validation.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - JWT or Access Token: []
      summary: Get Audit Log
      tags:
      - Audit Logs
  /api/audit-logs/export:
    post:
      description: Create a bulk export job that writes audit logs in JSON Lines format. The export is processed asynchronously — use the returned job ID to check status and download the results.
      operationId: create_export_job_export_post
      parameters:
      - description: 'Name of the organization to scope the request to. This header is required

          in multi-tenant deployments.

          '
        in: header
        name: X-Org-Name
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Organization name used to resolve the tenant context.

            '
          title: X-Org-Name
      - description: The API version to use. Set to `v1`.
        in: header
        name: X-API-Version
        required: false
        schema:
          default: v1
          description: 'API version to target for this request.

            '
          title: X-Api-Version
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportRequest'
        required: true
      responses:
        '200':
          description: 'Request succeeded and an export job identifier is returned.

            '
          content:
            application/json:
              schema:
                additionalProperties:
                  format: uuid
                  type: string
                title: Response Create Export Job Export Post
                type: object
        '422':
          description: 'The request body or headers failed validation.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - JWT or Access Token: []
      summary: Create Export Job
      tags:
      - Audit Logs
  /api/audit-logs/export/{job_id}:
    get:
      description: Retrieve the current status of an export job and, when complete, the download URL for the exported data.
      operationId: get_export_job_status_export__job_id__get
      parameters:
      - description: 'UUID of the export job to query.

          '
        in: path
        name: job_id
        required: true
        schema:
          description: 'Identifier of the export job.

            '
          format: uuid
          title: Job Id
          type: string
          example: <uuid>
      - description: 'Name of the organization to scope the request to. This header is required

          in multi-tenant deployments.

          '
        in: header
        name: X-Org-Name
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Organization name used to resolve the tenant context.

            '
          title: X-Org-Name
      - description: The API version to use. Set to `v1`.
        in: header
        name: X-API-Version
        required: false
        schema:
          default: v1
          description: 'API version to target for this request.

            '
          title: X-Api-Version
          type: string
      responses:
        '200':
          description: 'Request succeeded and the export job status is returned.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportJobResponse'
        '422':
          description: 'The request parameters failed validation.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - JWT or Access Token: []
      summary: Get Export Job Status
      tags:
      - Audit Logs
  /api/audit-logs/export/{job_id}/download:
    get:
      description: Download the exported audit log data for a completed export job in JSON Lines format.
      operationId: download_export_export__job_id__download_get
      parameters:
      - description: 'UUID of the export job whose data should be downloaded.

          '
        in: path
        name: job_id
        required: true
        schema:
          description: 'Identifier of the export job.

            '
          format: uuid
          title: Job Id
          type: string
          example: <uuid>
      - description: 'Name of the organization to scope the request to. This header is required

          in multi-tenant deployments.

          '
        in: header
        name: X-Org-Name
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Organization name used to resolve the tenant context.

            '
          title: X-Org-Name
      - description: The API version to use. Set to `v1`.
        in: header
        name: X-API-Version
        required: false
        schema:
          default: v1
          description: 'API version to target for this request.

            '
          title: X-Api-Version
          type: string
      responses:
        '200':
          description: 'Request succeeded and the export data is streamed in the response.

            '
          content:
            application/json:
              schema: {}
        '422':
          description: 'The request parameters failed validation.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - JWT or Access Token: []
      summary: Download Export
      tags:
      - Audit Logs
components:
  schemas:
    ExportRequest:
      description: '**Request body** for creating a new export job that filters audit logs and

        writes them in JSON Lines format.

        '
      properties:
        from_date:
          anyOf:
          - format: date-time
            type: string
            example: <timestamp>
          - type: 'null'
          description: 'Lower bound (inclusive) for filtering audit logs by `occurred_at`.

            Only events with `occurred_at >= from_date` are exported.

            '
          title: From Date
        q:
          default: []
          description: 'Search filters in the format `column_name:search_string1,search_string2`.


            Multiple values for a single column are separated by commas. To combine

            multiple `q` entries, use `search_operator`.

            '
          items:
            type: string
          title: Q
          type: array
        search_operator:
          default: or
          description: "Logical operator used to combine multiple `q` filters:\n\n- `or` — export logs that match **any** search condition  \n- `and` — export logs that match **all** search conditions\n"
          title: Search Operator
          type: string
        to_date:
          anyOf:
          - format: date-time
            type: string
            example: <timestamp>
          - type: 'null'
          description: 'Upper bound (inclusive) for filtering audit logs by `occurred_at`.

            Only events with `occurred_at <= to_date` are exported.

            '
          title: To Date
      title: ExportRequest
      type: object
    ValidationError:
      description: '**Validation error** describing an issue with a specific part of the request.

        '
      properties:
        loc:
          description: 'Location of the validation error as a path of components, such as

            `["body", "field_name"]` or `["query", "param_name"]`.

            '
          items:
            anyOf:
            - type: string
            - type: integer
          title: Location
          type: array
        msg:
          description: 'Human-readable description of the validation error.

            '
          title: Message
          type: string
        type:
          description: 'Machine-readable error type code.

            '
          title: Error Type
          type: string
      required:
      - loc
      - msg
      - type
      title: ValidationError
      type: object
    PaginatedResponse_AuditLogResponse_:
      description: '**Paginated response** that wraps a list of audit log entries and the total

        number of matching records.

        '
      properties:
        items:
          description: 'Page of audit log entries returned for the current request.

            '
          items:
            $ref: '#/components/schemas/AuditLogResponse'
          title: Items
          type: array
        total_count:
          description: 'Total number of audit log entries matching the query, across all pages.

            '
          title: Total Count
          type: integer
      required:
      - items
      - total_count
      title: PaginatedResponse[AuditLogResponse]
      type: object
    HTTPValidationError:
      description: '**Error response** returned when the request fails validation.

        '
      properties:
        detail:
          description: 'List of validation errors describing which fields are invalid and why.

            '
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ExportJobResponse:
      description: '**Response** containing the state of a bulk export job and, when complete,

        its download URL.

        '
      properties:
        completed_at:
          anyOf:
          - format: date-time
            type: string
            example: <timestamp>
          - type: 'null'
          description: 'Time when the export job finished processing, if it has completed.

            '
          title: Completed At
        created_at:
          format: date-time
          title: Created At
          type: string
          example: <timestamp>
        download_url:
          anyOf:
          - type: string
          - type: 'null'
          description: 'URL to download the exported data in JSON Lines format, present when

            the job has completed successfully.

            '
          title: Download Url
        error_message:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Error message describing why the export job failed, if applicable.

            '
          title: Error Message
        id:
          format: uuid
          title: Id
          type: string
          example: <uuid>
        org_id:
          format: uuid
          title: Org Id
          type: string
          example: <uuid>
        progress:
          anyOf:
          - type: integer
          - type: 'null'
          description: 'Approximate completion percentage for the export job, in the range `0–100`.

            '
          title: Progress
        status:
          description: 'Current status of the export job (for example, `pending`, `running`,

            `completed`, or `failed`).

            '
          title: Status
          type: string
        total_records:
          anyOf:
          - type: integer
          - type: 'null'
          description: 'Total number of records included in the export, when known.

            '
          title: Total Records
      required:
      - id
      - org_id
      - status
      - created_at
      title: ExportJobResponse
      type: object
    AuditLogResponse:
      description: '**Response** representation of an audit log entry, including core fields and

        a formatted, human-readable message.

        '
      properties:
        action_key:
          description: 'Key that identifies the type of action recorded (for example, `policy_updated`).

            '
          title: Action Key
          type: string
        action_verb:
          anyOf:
          - maxLength: 100
            type: string
          - type: 'null'
          description: 'Short verb or phrase that summarizes the action taken (for example,

            `created`, `updated`, `deleted`).

            '
          title: Action Verb
        actor_email:
          anyOf:
          - maxLength: 320
            type: string
          - type: 'null'
          description: 'Email address of the actor who performed the action.

            '
          title: Actor Email
        actor_id:
          anyOf:
          - format: uuid
            type: string
            example: <uuid>
          - type: 'null'
          description: 'UUID of the user or system principal responsible for the action.

            '
          title: Actor Id
        actor_type:
          anyOf:
          - maxLength: 100
            type: string
          - type: 'null'
          description: 'Type of actor that initiated the event (for example, `user` or `system`).

            '
          title: Actor Type
        created_at:
          format: date-time
          title: Created At
          type: string
          example: <timestamp>
        id:
          format: uuid
          title: Id
          type: string
          example: <uuid>
        message:
          description: 'Human-readable message describing the audit event, derived from the

            structured fields in the log.

            '
          readOnly: true
          title: Message
          type: string
        meta:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          description: 'Arbitrary metadata associated with the event, represented as a JSON object.

            '
          title: Meta
        occurred_at:
          anyOf:
          - format: date-time
            type: string
            example: <timestamp>
          - type: 'null'
          description: 'Time at which the event occurred, as reported by the emitting service.

            '
          title: Occurred At
        org_id:
          format: uuid
          title: Org Id
          type: string
          example: <uuid>
        org_name:
          anyOf:
          - type: string
          - type: 'null'
          description: 'Name of the organization to which this audit log entry belongs.

            '
          title: Org Name
        service_name:
          anyOf:
          - maxLength: 100
            type: string
          - type: 'null'
          description: 'Name of the service that wrote the audit log entry.

            '
          title: Service Name
        target_email:
          anyOf:
          - maxLength: 320
            type: string
          - type: 'null'
          description: 'Optional email address associated with the resource or subject affected

            by the action.

            '
          title: Target Email
        target_id:
          anyOf:
          - format: uuid
            type: string
            example: <uuid>
          - type: 'null'
          description: 'Identifier of the resource affected by the action.

            '
          title: Target Id
        target_type:
          anyOf:
          - maxLength: 100
            type: string
          - type: 'null'
          description: 'Type of resource affected by the action (for example, `user`, `group`, `policy`).

            '
          title: Target Type
      required:
      - action_key
      - id
      - org_id
      - created_at
      - message
      title: AuditLogResponse
      type: object
  securitySchemes:
    JWT_or_Access_Token:
      bearerFormat: JWT or Access Token
      description: 'Bearer token obtained by authenticating with your organization''s [service account](/anaconda-platform/admin/service-accounts) credentials (`client_id` and `client_secret`).


        See the [Getting started](/anaconda-platform/admin/audit-logs/audit-log-api) page for the full authentication flow.'
      scheme: bearer
      type: http