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

# Update audit settings

> Update audit settings for the current organization. If retention is reduced, events outside the new retention window are immediately deleted. Requires organization admin permissions.



## OpenAPI

````yaml /openapi/em-runtime-governance-v2.yaml patch /governance/audit/settings
openapi: 3.1.0
info:
  title: em_runtime_governance
  version: 5.27.0
servers: []
security: []
paths:
  /governance/audit/settings:
    patch:
      tags:
        - audit
      summary: Update audit settings
      description: >-
        Update audit settings for the current organization. If retention is
        reduced, events outside the new retention window are immediately
        deleted. Requires organization admin permissions.
      operationId: update_audit_settings
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuditSettingsUpdateRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuditSettingsResponse'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    AuditSettingsUpdateRequest:
      properties:
        retention_days:
          type: integer
          maximum: 3650
          minimum: 30
          title: Retention Days
          description: Retention period in days (30-3650)
      type: object
      required:
        - retention_days
      title: AuditSettingsUpdateRequest
      description: Request to update audit settings.
    AuditSettingsResponse:
      properties:
        org_id:
          type: string
          title: Org Id
          description: Organization ID
        retention_days:
          type: integer
          title: Retention Days
          description: Number of days to retain audit logs
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When settings were created
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: When settings were last updated
      type: object
      required:
        - org_id
        - retention_days
        - created_at
        - updated_at
      title: AuditSettingsResponse
      description: Audit settings for an organization.
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      type: object
      required:
        - error
      title: ErrorResponse
      description: Standard error response model.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ErrorBody:
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          title: Message
        details:
          additionalProperties: true
          type: object
          title: Details
        request_id:
          type: string
          title: Request Id
        timestamp:
          type: string
          format: date-time
          title: Timestamp
      type: object
      required:
        - code
        - message
        - request_id
        - timestamp
      title: ErrorBody
      description: Error body with structured details.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ErrorCode:
      type: string
      enum:
        - INVALID_REQUEST
        - INVALID_TOKEN
        - INSUFFICIENT_PERMISSIONS
        - RESOURCE_NOT_FOUND
        - RESOURCE_ALREADY_EXISTS
        - VALIDATION_ERROR
        - RATE_LIMIT_EXCEEDED
        - SERVICE_UNAVAILABLE
        - INTERNAL_ERROR
      title: ErrorCode
      description: Standard error codes for API responses.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````