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

# Archive File

> Permanently hide a file from all live API responses.

Archives a file, permanently hiding it from all live API responses (case details, file listings, search, and analysis endpoints). The file data is retained for audit trail purposes. Only organisation administrators can archive files.

<Warning>
  Archiving is **one-way**; there is no restore endpoint. Confirm the action before calling this endpoint.
</Warning>

## Best Practices

1. **Wait for analysis to settle**: A file can only be archived once its analysis has completed. Archiving a file mid-analysis returns `409 Conflict`.
2. **Handle repeat calls**: Archiving an already-archived file also returns `409 Conflict`; treat it as already done rather than an error.
3. **Administrator only**: Non-administrator API keys receive `403 Forbidden`. Route archive actions through an administrator integration.


## OpenAPI

````yaml PATCH /cases/{caseId}/files/{fileId}/archive
openapi: 3.1.0
info:
  title: Veridox Core API
  description: Veridox Core Platform API
  version: 0.0.1
  contact: {}
servers:
  - url: https://api.uk.veridox.ai
    description: Live (UK)
  - url: https://api.ca.veridox.ai
    description: Live (CA)
security: []
tags:
  - name: Status
    description: System status and health check endpoints
  - name: Cases
    description: Case and case file management
  - name: Organisations
    description: Organisation management
  - name: Document Requests
    description: Document request management
  - name: Search
    description: Search functionality
  - name: Admin
    description: Administrative endpoints
paths:
  /cases/{caseId}/files/{fileId}/archive:
    patch:
      tags:
        - Case Files
      summary: Archive a file
      description: >-
        Permanently hides a file from all live API responses. Only org
        ADMINISTRATORs can archive files. The file data is retained in the
        database for audit trail purposes. Archiving is one-way; there is no
        restore endpoint.
      operationId: CaseFilesController_archiveFile
      parameters:
        - name: fileId
          required: true
          in: path
          description: File ID
          schema:
            type: string
        - name: caseId
          required: true
          in: path
          description: Case ID
          schema:
            type: string
      responses:
        '200':
          description: File archived successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CaseFileResponseDto'
        '400':
          description: Invalid fileId (must be a valid UUID)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '401':
          description: Unauthorized (invalid or missing authentication token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '403':
          description: Only org ADMINISTRATORs can archive files
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '404':
          description: File not found or does not belong to this organisation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '409':
          description: File is already archived, or analysis has not yet completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '429':
          description: Too many requests (rate limit exceeded)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
      security:
        - api-key: []
components:
  schemas:
    CaseFileResponseDto:
      type: object
      properties:
        file_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$
          x-nestjs_zod-uses-3-point-1-syntax: true
        case_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$
          x-nestjs_zod-uses-3-point-1-syntax: true
        case_label:
          anyOf:
            - type: string
            - type: 'null'
          x-nestjs_zod-uses-3-point-1-syntax: true
          x-nestjs_zod-empty-type: true
        label:
          anyOf:
            - type: string
            - type: 'null'
          x-nestjs_zod-uses-3-point-1-syntax: true
          x-nestjs_zod-empty-type: true
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          x-nestjs_zod-uses-3-point-1-syntax: true
          x-nestjs_zod-empty-type: true
        thumbnail_url:
          anyOf:
            - type: string
            - type: 'null'
          x-nestjs_zod-uses-3-point-1-syntax: true
          x-nestjs_zod-empty-type: true
        current_risk_score:
          anyOf:
            - type: string
            - type: 'null'
          x-nestjs_zod-uses-3-point-1-syntax: true
          x-nestjs_zod-empty-type: true
        analysis_status:
          type: string
          enum:
            - waiting_for_upload
            - processing
            - settled
          x-nestjs_zod-uses-3-point-1-syntax: true
        analysis_outcome:
          anyOf:
            - type: string
              enum:
                - success
                - failed
            - type: 'null'
          x-nestjs_zod-uses-3-point-1-syntax: true
          x-nestjs_zod-empty-type: true
        current_analysis_phase:
          anyOf:
            - type: string
            - type: 'null'
          x-nestjs_zod-uses-3-point-1-syntax: true
          x-nestjs_zod-empty-type: true
        uploaded_at:
          anyOf:
            - type: string
              format: date-time
              pattern: >-
                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
            - type: 'null'
          x-nestjs_zod-uses-3-point-1-syntax: true
          x-nestjs_zod-empty-type: true
        created_at:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
          x-nestjs_zod-uses-3-point-1-syntax: true
        team_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          x-nestjs_zod-uses-3-point-1-syntax: true
        team_name:
          type: string
          x-nestjs_zod-uses-3-point-1-syntax: true
      required:
        - file_id
        - case_id
        - case_label
        - label
        - mime_type
        - thumbnail_url
        - current_risk_score
        - analysis_status
        - analysis_outcome
        - current_analysis_phase
        - uploaded_at
        - created_at
    ErrorDto:
      type: object
      properties:
        error_code:
          type: string
          description: Machine-readable error code for programmatic handling
          examples:
            - request.cases.file.missing-risk-score
            - request.authentication.invalid-token
            - request.forbidden
            - request.cases.case.not-found
            - request.cases.case.already-locked
        error_message:
          type: string
          description: Human-readable error message explaining what went wrong
          example: >-
            User tried to perform an invalid operation on a file without a risk
            score.
        error_details:
          type: object
          example:
            field: email_address
      required:
        - error_code
        - error_message
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: x-api-key

````