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

# Clear audit logs

> Retention-based cleanup. Deletes every audit log older than
`days_to_keep` days and answers with `deleted`, the number of rows
removed. There is no dry run, and the deletion is not reversible.




## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/logs.yaml delete /api/logs/audits
openapi: 3.0.3
info:
  title: Insforge Logs API
  version: 1.0.0
servers: []
security: []
paths:
  /api/logs/audits:
    delete:
      tags:
        - Admin
      summary: Clear audit logs
      description: |
        Retention-based cleanup. Deletes every audit log older than
        `days_to_keep` days and answers with `deleted`, the number of rows
        removed. There is no dry run, and the deletion is not reversible.
      parameters:
        - name: days_to_keep
          in: query
          schema:
            type: integer
            default: 90
          description: Audit logs older than this many days are deleted
      responses:
        '200':
          description: Audit logs cleared
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - deleted
                properties:
                  message:
                    type: string
                  deleted:
                    type: integer
              example:
                message: Audit logs cleared successfully
                deleted: 150
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      security:
        - bearerAuth: []
        - apiKey: []
components:
  responses:
    Unauthorized:
      description: Missing or invalid admin credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: AUTH_INVALID_CREDENTIALS
            message: Unauthorized
            statusCode: 401
    Forbidden:
      description: Authenticated, but the token is not a project_admin
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: AUTH_UNAUTHORIZED
            message: Admin access required
            statusCode: 403
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
          description: Error code for programmatic handling
        message:
          type: string
          description: Human-readable error message
        statusCode:
          type: integer
          description: HTTP status code
        nextActions:
          type: string
          description: Suggested action to resolve the error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````