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

> ## Agent Instructions
> Start with /introduction/getting-started. Use the Direct Query API (POST /query) with the Newton Fusion model (text, image, and video reasoning) or the Newton Omega encoder (time-series embeddings). ATAI_API_ENDPOINT must include the version path: /v0.5 for most APIs, /v0.6 for the Fine-Tuning Service. Pages whose descriptions are marked (Archived) document the legacy Lens runtime — do not use them for new projects.

# Delete File

> Delete a file from the authenticated organization

## Overview

This endpoint deletes a file from the authenticated organization. The file is removed from the available files list and its contents are scheduled for deletion from storage.

## Path Parameters

<ParamField path="file_id" type="string" required>
  Identifier of the file to delete (returned by [Upload File](./upload) or [Complete Upload](./complete-upload))
</ParamField>

## Response

<ResponseField name="is_valid" type="boolean">
  Whether the deletion was successful. Check this field to detect errors.
</ResponseField>

<ResponseField name="file_id" type="string">
  Identifier of the file that was deleted
</ResponseField>

<ResponseField name="file_uid" type="string">
  Internal unique identifier of the deleted file
</ResponseField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X DELETE https://api.u1.archetypeai.app/v0.5/files/delete/file-abc123 \
    -H "Authorization: Bearer $ATAI_API_KEY"
  ```

  ```python Python theme={"system"}
  import requests
  import os

  api_key = os.environ.get("ATAI_API_KEY")
  file_id = "file-abc123"

  response = requests.delete(
      f"https://api.u1.archetypeai.app/v0.5/files/delete/{file_id}",
      headers={"Authorization": f"Bearer {api_key}"},
  )

  result = response.json()
  if result.get("is_valid"):
      print(f"Deleted: {result['file_id']}")
  else:
      print(f"Errors: {result.get('errors')}")
  ```

  ```javascript JavaScript theme={"system"}
  const fileId = "file-abc123";

  const response = await fetch(
    `https://api.u1.archetypeai.app/v0.5/files/delete/${fileId}`,
    {
      method: "DELETE",
      headers: {
        Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
      },
    }
  );

  const result = await response.json();
  if (result.is_valid) {
    console.log(`Deleted: ${result.file_id}`);
  } else {
    console.error("Errors:", result.errors);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={"system"}
  {
    "is_valid": true,
    "file_id": "file-abc123",
    "file_uid": "8f2c1e5a-7b3d-4d9e-9c1a-2f5b7d8e4a6c"
  }
  ```

  ```json 401 - Unauthorized theme={"system"}
  {
    "errors": [
      {
        "code": "unauthorized_request",
        "message": "Unauthorized or invalid access.",
        "suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
        "error_uid": "err-xxxxxxxx"
      }
    ]
  }
  ```

  ```json 404 - File not found theme={"system"}
  {
    "errors": [
      {
        "code": "file_not_found",
        "message": "No file with the given file_id was found for the organization.",
        "suggestion": "Verify the file_id and that the file has not already been deleted.",
        "error_uid": "err-xxxxxxxx"
      }
    ]
  }
  ```
</ResponseExample>
