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

# Delete multiple files

> This endpoint is used to delete multiple files.

The `fileIds` field is used to specify the files that should be deleted. The files that are specified in the `fileIds` field will be deleted.

If a files is not specified in the `fileIds` field, the files will not be deleted.

The **fileIds** field is used to specify the files that should be deleted. The files that are specified in the **fileIds** field will be deleted.

If a files is not specified in the **fileIds** field, the files will not be deleted.

## Overview

Permanently deletes multiple files from the system. This is a bulk operation that allows you to remove several files in a single request.

<Note>
  Warning: This action is irreversible.
</Note>

## Request Parameters

### Request Body

The request body must contain a JSON object with the following structure:

| Property | Type   | Required | Description                                      |
| -------- | ------ | -------- | ------------------------------------------------ |
| fileIds  | string | Yes      | Comma-separated list of file UUIDs to be deleted |

## Request Examples

### Single File Deletion

```json theme={null}
{
  "fileIds": "8123612d-187c-44eb-8ac6-214e68506b7e"
}
```

### Multiple Files Deletion

```json theme={null}
{
  "fileIds": "8123612d-187c-44eb-8ac6-214e68506b7e,8123612d-187c-44eb-8ac6-214e68506b7f,9234723e-298d-55fc-9bd7-325f79617c8g"
}
```

### Success Response (200 OK)

```json theme={null}
{
  "success": true
}
```

### Error Responses

#### 400 Bad Request

```json theme={null}
{
  "error": "Invalid request",
  "message": "fileIds parameter is required and cannot be empty"
}
```

#### 403 Bad Request

```json theme={null}
{
  "message": "Access denied. You are in readonly mode.",
  "error": "Forbidden",
  "statusCode": 403
}
```

#### 422 Bad Request

```json theme={null}
{
  "message": "Invalid fileIds.",
  "error": "Unprocessable Entity",
  "statusCode": 422
}
```

## Important Notes

* **Irreversible Action**: Deleted files cannot be recovered. Ensure you have proper backups before deletion.
* **UUID Format**: File IDs must be valid UUIDs in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
* **Comma Separation**: When providing multiple file IDs as a string, separate them with commas without spaces.
* **Batch Processing**: The endpoint processes all file IDs in a single transaction where possible.
* **Partial Failures**: If some files cannot be deleted, the operation will complete for valid files and return error details for failed ones.
* **Permission Checks**: Each file deletion is subject to individual permission validation.

## File ID Requirements

* Must be valid UUID format (36 characters including hyphens)
* File must exist in the system
* User must have delete permissions for each file
* Maximum recommended batch size: 100 files per request

## Use Cases

* Bulk cleanup of temporary or processed files
* User-initiated deletion of selected files from file manager
* Automated cleanup processes removing expired files
* Storage management operations to free up space
* Data privacy compliance for user data deletion requests

## Best Practices

* Validate file ownership before deletion
* Implement confirmation dialogs for user-facing operations
* Log deletion activities for audit purposes
* Check file dependencies before deletion
* Use reasonable batch sizes to avoid timeouts
* Handle partial failures gracefully in your application logic

<Note>
  This endpoint accepts an optional `Idempotency-Key` request header so a retry
  cannot apply the change twice. See
  [Idempotent requests](/docs-api/api-idempotency).
</Note>


## OpenAPI

````yaml api-reference/cleaned_openapi.json DELETE /prod/v1/files
openapi: 3.0.0
info:
  title: Public API
  description: >-

    ### Welcome to fileAI’s Public API Documentation.

    This API allows users to check the health of the system, upload and manage
    files, and manage AI Schemas.

    Should you have any questions, please reach out to fileAI via the “Contact a
    Developer” link below.



    [Contact a Developer](mailto:support@file.ai)



    ### Prerequisites


    Before using our API, please ensure you complete the following prerequisites

    - You must have a fileAI account. Sign up or login
    [here](https://orion.file.ai/en/sign-up)

    - You must have an API Key. After creating your fileAI account, you can
    generate your API Key. Refer to the Authentication section below for more
    details.



    ### Authentication

    All API requests require an API key for authentication.

    - To obtain your API key, please log in to your fileAI account and navigate
    to Project Settings in your dashboard

    - Keep your API key secure and do not share it publicly.


    ![Authentication](https://static.orion.file.ai/authentication.png)


    ### How to Use Your API Key

    Once you have your API key:

    - Click the Authorize button on the top-right of this page

    - Enter your API Key under Value

    - Click Authorize to start making authenticated requests directly from the
    documentation


    ![How to Use Your API
    Key](https://static.orion.file.ai/how-to-use-api-keys.png)
        
  version: '1.0'
  contact: {}
servers:
  - url: https://api.orion.file.ai
    description: Default. Use this unless your workspace is on an instance.
  - url: https://api.orion.{instance}.file.ai
    description: Instance-specific host.
    variables:
      instance:
        default: au
        enum:
          - au
          - sg
          - jp
        description: >-
          Instance hosting your workspace: au (Australia), sg (Singapore), jp
          (Japan).
security: []
tags:
  - name: Public API V1
paths:
  /prod/v1/files:
    delete:
      tags:
        - Public API V1
      summary: Delete multiple files
      description: >-
        This endpoint is used to delete multiple files.


        The `fileIds` field is used to specify the files that should be deleted.
        The files that are specified in the `fileIds` field will be deleted.


        If a files is not specified in the `fileIds` field, the files will not
        be deleted.
      operationId: PublicAPIController_deleteManyDocuments
      parameters:
        - name: Idempotency-Key
          in: header
          description: >-
            Optional opaque key (max 255 chars, UUIDv4 recommended) making this
            request idempotent for 24h: a retry with the same key and body
            replays the original response with Idempotent-Replayed: true.
          required: false
          schema:
            type: string
      requestBody:
        required: true
        description: Delete multiple files input
        content:
          application/json:
            schema:
              type: string
            examples:
              example1:
                summary: Delete multiple files
                value:
                  fileIds:
                    - 8123612d-187c-44eb-8ac6-214e68506b7e
                    - 8123612d-187c-44eb-8ac6-214e68506b7f
      responses:
        '200':
          description: The files are deleted
          content:
            application/json:
              example:
                success: true
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        '401':
          description: Missing or invalid API key.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '403':
          description: Read-only or inactive API key.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '404':
          description: Resource not found.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '422':
          description: Invalid input
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
              example:
                type: https://errors.file.ai/validation-failed
                title: Validation failed
                status: 422
                detail: Invalid fileIds.
                instance: /v1/{route}
                code: VALIDATION_FAILED
                requestId: 0f1c8e03-978e-40d5-bc93-6894a57f9324
                errors: []
                message: Invalid fileIds.
                error: Unprocessable Entity
                statusCode: 422
        '429':
          description: Rate limit exceeded.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '500':
          description: Unexpected internal error.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
      security:
        - x-api-key: []
components:
  schemas:
    ProblemDetailsDto:
      type: object
      properties:
        type:
          type: string
          description: A URI identifying the problem type.
          example: https://errors.file.ai/validation-failed
        title:
          type: string
          description: Stable, human-readable summary of the problem type.
          example: Validation failed
        status:
          type: number
          description: HTTP status code.
          example: 422
        detail:
          type: string
          description: Human-readable explanation specific to this occurrence.
          example: One or more fields are invalid.
        instance:
          type: string
          description: URI reference for this occurrence (the request path).
          example: /v1/files/upload
        code:
          type: string
          description: Stable machine-readable error code.
          example: VALIDATION_FAILED
        requestId:
          type: string
          description: Correlation id for this request.
          example: 0f1c8e03-978e-40d5-bc93-6894a57f9324
        errors:
          description: Field-level violations (validation only).
          type: array
          items:
            $ref: '#/components/schemas/ProblemErrorItemDto'
        retryAfter:
          type: number
          description: Seconds until the client may retry (present on 429 only).
          example: 42
        message:
          type: string
          description: Legacy key (deprecated — use `detail`/`title`).
          example: Validation failed
        error:
          type: string
          description: Legacy key (deprecated — use `title`).
          example: Unprocessable Entity
        statusCode:
          type: number
          description: Legacy key (deprecated — use `status`).
          example: 422
      required:
        - type
        - title
        - status
        - detail
        - instance
        - code
        - requestId
        - errors
        - message
        - error
        - statusCode
    ProblemErrorItemDto:
      type: object
      properties:
        code:
          type: string
          example: REQUIRED
        detail:
          type: string
          example: must not be empty
        pointer:
          type: string
          description: JSON Pointer to the offending body field.
          example: '#/fileName'
        parameter:
          type: string
          description: Name of the offending query/header parameter.
          example: limit
      required:
        - code
        - detail
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication

````