> ## Documentation Index
> Fetch the complete documentation index at: https://docsnewgen.flexxible.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List audits

> Returns audit events of the specified organization to check what action was taken, on which entity, when it occurred, and who triggered it. When `trigger_type` is `user`, `trigger_id` corresponds to the user ID and can be queried via the user endpoint. When `trigger_type` is `api`, `trigger_id` corresponds to the API key ID; currently API keys are not queryable from this public API.



## OpenAPI

````yaml /en/api-reference/openapi.en-v2.json get /v2/organizations/{organization_id}/audits
openapi: 3.0.3
info:
  title: API Publica Portal
  version: 2.0.0
  description: Public REST API for portal
servers:
  - url: https://api.flexxible.net
    description: Portal API (production)
security:
  - bearerAuth: []
tags:
  - name: Digital activity
    description: Creation of core process groups by organization
  - name: Roles
    description: Endpoint de creacion de roles de organizacion
  - name: Usuarios
    description: Endpoint de creacion de usuarios de organizacion
  - name: Grupos de workspaces
    description: Endpoints de gestión de grupos de workspaces
  - name: Workspaces
    description: Endpoint de eliminacion de workspaces de la organizacion
  - name: Aplicaciones instaladas
    description: Endpoint de detalle de aplicación instalada de la organización
  - name: Autenticación
    description: Endpoints de autenticación y contexto de sesión
  - name: Microservicios
    description: Detalle de microservicios por organizacion
  - name: Operaciones
    description: Consulta de detalle de operaciones por organización
  - name: Organización
    description: Operaciones de organización
  - name: Objetivos de política de parches
    description: Endpoints de gestión de objetivos de política de parches
  - name: Configuraciones de producto
    description: Endpoints de gestión de configuraciones de producto
  - name: Grupos de reporte
    description: Operaciones sobre grupos de reporte
  - name: Sesiones
    description: Endpoint de detalle de sesion de la organizacion
  - name: Tenants
    description: Endpoints de gestión de tenants
paths:
  /v2/organizations/{organization_id}/audits:
    get:
      tags:
        - Audit
      summary: List audits
      description: >-
        Returns audit events of the specified organization to check what action
        was taken, on which entity, when it occurred, and who triggered it. When
        `trigger_type` is `user`, `trigger_id` corresponds to the user ID and
        can be queried via the user endpoint. When `trigger_type` is `api`,
        `trigger_id` corresponds to the API key ID; currently API keys are not
        queryable from this public API.
      operationId: get_audits
      parameters:
        - name: organization_id
          in: path
          required: true
          description: Organization identifier.
          schema:
            type: string
            pattern: ^[0-9a-f]{24}$
            minLength: 24
            maxLength: 24
        - name: page
          in: query
          required: false
          description: Page number to query.
          schema:
            type: integer
            default: 1
            minimum: 1
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
            default: 100
            minimum: 1
            maximum: 100
          description: Number of items per page.
        - name: fields
          in: query
          required: false
          description: Comma-separated list of response fields to include.
          schema:
            type: string
            example: >-
              id,audited_at,action,entity_type,entity_id,trigger_type,trigger_id,trigger_name
        - name: sort
          in: query
          required: false
          description: >-
            Sorting expression in the format <field>:asc|desc. In aggregate
            mode, only accepts `group_by` fields or aggregated aliases (`count`,
            `<function>_<field>`).
          schema:
            type: string
            pattern: ^([a-z_]+):(asc|desc)$
        - name: filters
          in: query
          required: false
          description: Filtering JSON expression on filterable fields in the response.
          schema:
            type: string
          examples:
            simple:
              summary: Simple filter by entity type
              value: '{"field":"entity_type","op":"eq","value":"workspace"}'
            complex-and:
              summary: AND combination by action and entity type
              value: >-
                {"and":[{"field":"action","op":"eq","value":"update"},{"field":"entity_type","op":"eq","value":"workspace"}]}
            complex-or-and:
              summary: OR combination within AND with actor and action
              value: >-
                {"and":[{"or":[{"field":"trigger_id","op":"eq","value":"8c1a7e2b9f4d3c6e0a5b1d2f"},{"field":"trigger_id","op":"eq","value":"f0b9c3d7a1e5f8b2c4d6e9a0"}]},{"field":"action","op":"eq","value":"delete"}]}
        - name: aggregate
          in: query
          required: false
          description: >-
            JSON expression for aggregation. Structure:
            {"group_by":["field"],"aggregates":[{"field":"*","function":"count"}]}.
            Cannot be combined with `fields`.
          schema:
            type: string
            maxLength: 1024
          examples:
            group-by-action-count:
              summary: Group by action and count
              value: >-
                {"group_by":["action"],"aggregates":[{"field":"*","function":"count"}]}
            group-by-entity-type-count:
              summary: Group by entity type and count
              value: >-
                {"group_by":["entity_type"],"aggregates":[{"field":"*","function":"count"}]}
      responses:
        '200':
          description: Audit list retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAuditsResponseV2'
              examples:
                list-mode:
                  summary: List mode response
                  value:
                    has_next: true
                    data:
                      - id: b7e4c2a9d1f6038e5a2c9b4d
                        audited_at: '2026-06-30T11:45:12.000Z'
                        organization_id: a9d3f1b7c4e8026d5f0a3c8e
                        action: update
                        entity_type: workspace
                        entity_id: c2f8a1d4b9e3067f5c0d2a8e
                        trigger_type: api
                        trigger_id: 8c1a7e2b9f4d3c6e0a5b1d2f
                        trigger_name: Api Key
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: BAD_REQUEST
                  message: Invalid request data
                  details: fields and aggregate cannot be combined.
        '401':
          description: Not authorized to access the requested organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: unauthorized
                  message: No autorizado para acceder a la organización solicitada.
        '404':
          description: Resource not found within the authorized organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: not_found
                  message: El recurso solicitado no existe en la organización indicada.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: internal_error
                  message: Se ha producido un error interno.
components:
  schemas:
    GetAuditsResponseV2:
      type: object
      required:
        - has_next
        - data
      properties:
        has_next:
          type: boolean
          description: Indicates if there's a next page.
        data:
          type: array
          description: List of audits.
          items:
            $ref: '#/components/schemas/AuditItemV2'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
            details:
              type: string
          required:
            - message
            - code
      required:
        - error
    AuditItemV2:
      type: object
      required:
        - id
        - audited_at
        - action
        - entity_type
        - entity_id
        - trigger_type
        - trigger_id
        - trigger_name
      properties:
        id:
          type: string
          description: Audit identifier.
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
        audited_at:
          type: string
          format: date-time
          description: Date when the audit is recorded.
        organization_id:
          type: string
          nullable: true
          description: Identifier of the organization associated with the record.
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
        action:
          type: string
          description: Audited action.
          enum:
            - insert
            - update
            - delete
            - recover
            - soft_delete
        entity_type:
          type: string
          description: Type of entity on which the action is performed.
        entity_id:
          type: string
          description: Identifier of the impacted entity.
        trigger_type:
          type: string
          description: Type of actor triggering the action.
          enum:
            - api
            - user
        trigger_id:
          type: string
          description: Identifier of the actor.
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
        trigger_name:
          type: string
          description: Visible name of the actor.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````