> ## 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 /api/lens/query) with the Newton Fusion model (text, image, and video reasoning) or the Newton Omega encoder (time-series embeddings). ATAI_API_ENDPOINT is the base URL https://platform.u1.archetypeai.app with no version path; every endpoint path begins with /api. Pages whose descriptions are marked (Archived) document the legacy Lens runtime — do not use them for new projects.

# Delete File by ID

> Delete a file from the authenticated organization by its file_uid

Requires [version 2.0.0](https://docs.archetypeai.app/release-notes/2.0.x.md#v2-0-0) or later of the Archetype platform.

## Overview

This endpoint permanently deletes the bytes and metadata of a file, looked up by the file's
`file_uid` (a value starting with `fil_`) instead of by its filename. It otherwise behaves like
[Delete File](https://docs.archetypeai.app/api-reference/files/delete-file.md).

The deletion is synchronous. Once the response is returned, the file no longer appears in
listings, and its filename can be reused by a new upload. The new upload gets a new `file_uid`.

Deleting a file requires the `developer` or `admin` role; callers with the `viewer` role receive
an HTTP `403` error. Only registered or corrupt files can be deleted. A file whose direct upload
is still in progress isn't visible to this endpoint and returns an HTTP `404` error; cancel it
with [Abort Upload](https://docs.archetypeai.app/api-reference/files/abort-upload.md) instead. Files you can't see, files that are already deleted,
and values that aren't a `file_uid` also return an HTTP `404` error.

## Path Parameters

**file\_id** `string` *required*

The file's `file_uid` (`fil_...`), as returned by the upload endpoints and in every file
metadata record.

## Response

**is\_valid** `boolean` *required*

`true` when the file is gone. Failures are reported through an HTTP error status code.

**file\_id** `string` *required*

The filename of the deleted file

**file\_uid** `string` *required*

The `file_uid` of the deleted file

```bash cURL theme={"system"}
curl -X DELETE https://platform.u1.archetypeai.app/api/files/fil_01k7x3q9m2v8n4p6r5t0w1y2z3 \
  -H "Authorization: Bearer $ATAI_API_KEY"
```

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

api_key = os.environ.get("ATAI_API_KEY")
file_uid = "fil_01k7x3q9m2v8n4p6r5t0w1y2z3"

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

result = response.json()
print(f"Deleted: {result['file_id']} ({result['file_uid']})")
```

```javascript JavaScript theme={"system"}
const fileUid = "fil_01k7x3q9m2v8n4p6r5t0w1y2z3";

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

const result = await response.json();
if (response.ok) {
  console.log(`Deleted: ${result.file_id} (${result.file_uid})`);
} else {
  console.error("Errors:", result.errors);
}
```

```json 200 - Success theme={"system"}
{
  "is_valid": true,
  "file_id": "training-data.csv",
  "file_uid": "fil_01k7x3q9m2v8n4p6r5t0w1y2z3"
}
```

```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": "not_found",
      "message": "File not found: org_id=<org_id>, file_id=fil_01k7x3q9m2v8n4p6r5t0w1y2z3",
      "suggestion": null,
      "error_uid": "err-xxxxxxxx"
    }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.