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

# Export Audit Logs

> Export audit logs in CSV or JSON format.

Applies current filters to the exported data.
Only superadmins can export audit logs.
PII is masked unless the user belongs to the 'pii_access' group.



## OpenAPI

````yaml get /api/v1/audit-logs/export
openapi: 3.1.0
info:
  title: SnackBase
  description: Open-source Backend-as-a-Service (BaaS)
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/audit-logs/export:
    get:
      tags:
        - audit-logs
      summary: Export Audit Logs
      description: |-
        Export audit logs in CSV or JSON format.

        Applies current filters to the exported data.
        Only superadmins can export audit logs.
        PII is masked unless the user belongs to the 'pii_access' group.
      operationId: export_audit_logs_api_v1_audit_logs_export_get
      parameters:
        - name: format
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/AuditLogExportFormat'
            description: Export format
            default: csv
          description: Export format
        - name: account_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by account ID
            title: Account Id
          description: Filter by account ID
        - name: table_name
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by table name
            title: Table Name
          description: Filter by table name
        - name: record_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by record ID
            title: Record Id
          description: Filter by record ID
        - name: user_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by user ID
            title: User Id
          description: Filter by user ID
        - name: operation
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by operation
            title: Operation
          description: Filter by operation
        - name: from_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: Filter from this timestamp
            title: From Date
          description: Filter from this timestamp
        - name: to_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: Filter to this timestamp
            title: To Date
          description: Filter to this timestamp
      responses:
        '200':
          description: Exported audit logs
          content:
            application/json:
              schema: {}
            text/csv: {}
        '403':
          description: Superadmin access required
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AuditLogExportFormat:
      type: string
      enum:
        - csv
        - json
        - pdf
      title: AuditLogExportFormat
      description: Available export formats for audit logs.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````