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

# Export audit events



## OpenAPI

````yaml /api-reference/openapi.json get /api/v2/workspaces/{workspaceId}/export/audit
openapi: 3.1.1
info:
  title: ContraForce API
  description: ContraForce platform API for security operations management.
  version: '2.0'
servers: []
security: []
tags:
  - name: Incidents
  - name: Gamebooks
  - name: Data sources
  - name: Service tickets
  - name: Investigation
  - name: Export
  - name: agent-tools
  - name: Cross-workspace incidents
  - name: Cross-workspace gamebooks
  - name: Cross-workspace data sources
  - name: Webhooks
  - name: Service accounts
  - name: Users
  - name: Azure resources
paths:
  /api/v2/workspaces/{workspaceId}/export/audit:
    get:
      tags:
        - Export
      summary: Export audit events
      operationId: v2-export-audit-events
      parameters:
        - name: workspaceId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: startTime
          in: query
          schema:
            type: string
            format: date-time
        - name: endTime
          in: query
          schema:
            type: string
            format: date-time
        - name: nextPageToken
          in: query
          schema:
            type: string
        - name: pageSize
          in: query
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportAuditResponse'
        '400':
          description: Bad request — validation or parameter binding failed.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblemDetails'
        '401':
          description: Unauthorized — missing or invalid Bearer token.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblemDetails'
        '403':
          description: Forbidden — insufficient scope or workspace access.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblemDetails'
        '404':
          description: Not found — workspace or resource is missing.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblemDetails'
        '429':
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal server error.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblemDetails'
components:
  schemas:
    ExportAuditResponse:
      required:
        - value
      type: object
      properties:
        value:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/ExportedAuditEventDto'
            description: One workspace audit event in the machine-export shape.
          description: The audit events in this page.
        nextPageToken:
          type:
            - 'null'
            - string
          description: >-
            URL-safe token for the next page, or `null` when this is the last
            page.
      description: Response envelope for the workspace audit-export endpoint.
    ApiProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
        title:
          type:
            - 'null'
            - string
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        detail:
          type:
            - 'null'
            - string
        instance:
          type:
            - 'null'
            - string
        code:
          type:
            - 'null'
            - string
        requestId:
          type:
            - 'null'
            - string
        timestamp:
          type:
            - 'null'
            - string
        target:
          type:
            - 'null'
            - string
        errors:
          type:
            - 'null'
            - object
          additionalProperties:
            type: array
            items:
              type: string
      description: >-
        API extension of ProblemDetails that surfaces the stable error code,

        trace identifier, timestamp, optional target, and optional field-keyed
        validation

        error map alongside the RFC 7807 members.
    ProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
        title:
          type:
            - 'null'
            - string
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        detail:
          type:
            - 'null'
            - string
        instance:
          type:
            - 'null'
            - string
    ExportedAuditEventDto:
      required:
        - id
        - timeGenerated
        - workspaceId
        - discriminator
        - activityType
        - activityAction
        - actorId
        - targetResourceType
        - targetResourceId
      type: object
      properties:
        id:
          type: string
          description: The audit entry's unique id.
          format: uuid
        timeGenerated:
          type: string
          description: When the audited activity happened (UTC).
          format: date-time
        workspaceId:
          type: string
          description: The ContraForce workspace the event belongs to.
          format: uuid
        discriminator:
          type:
            - 'null'
            - string
          description: >-
            The audit domain, e.g. `WorkspaceManagement` or
            `IncidentInvestigation`.
        activityType:
          type:
            - 'null'
            - string
          description: The activity type name, e.g. `WorkspaceRoleChanged`.
        activityAction:
          type:
            - 'null'
            - string
          description: The activity action name, e.g. `Update`.
        actorId:
          type: string
          description: The id of the user or agent that performed the activity.
          format: uuid
        actorName:
          type:
            - 'null'
            - string
          description: The display name of the actor, when recorded.
        actorEmail:
          type:
            - 'null'
            - string
          description: The email of the actor, when recorded.
        targetResourceType:
          type:
            - 'null'
            - string
          description: >-
            The type of the resource the activity targeted, e.g. `Incident` or
            `User`.
        targetResourceId:
          type:
            - 'null'
            - string
          description: The id of the resource the activity targeted.
        targetResourceName:
          type:
            - 'null'
            - string
          description: The human-readable name of the target resource, when recorded.
        metadata:
          type:
            - 'null'
            - string
          description: >-
            The entry's activity-specific metadata serialized as a JSON string
            (including its

            `$type` discriminator), or `null` when the entry carries none.
      description: One workspace audit event in the machine-export shape.

````