---
title: "Delete all files matching a prefix (bulk delete)"
method: DELETE
path: "/v1/files"
tags: ["Files"]
---

# Delete all files matching a prefix (bulk delete)

`DELETE /v1/files`

S3/blob-style bulk delete: remove every uploaded file whose key starts with *prefix* (e.g. `data/2024/` deletes all files in that virtual folder). Only upload-side files are affected; sandbox output files cannot be bulk-deleted. Returns the count of files actually removed. Anthropic SDK callers can reach this via `client.beta.files.with_raw_response` or a plain `httpx` call with `extra_query={...prefix: data/2024/...}`.

## Query parameters

- `scope_id` string, required — Session / container identifier.
- `prefix` string, required — Key prefix to delete. All uploaded files whose relative path starts with this string are removed. Must be non-empty. A trailing `/` is recommended to avoid accidentally deleting sibling keys that share the same prefix string (e.g. use `data/2024/` not `data/2024`).
- `namespace` string — Namespace to delete from. Defaults to 'session'.

## Response `200`

Successful Response

- DeletedPrefix — Confirmation that all files matching a prefix were deleted.
  - `prefix` string, required — The key prefix that was deleted.
  - `deleted_count` integer, required — Number of files actually removed.
  - `type` 'prefix_deleted' — Object type discriminator, always 'prefix_deleted'.

## Other responses

- `400` — prefix is missing or empty.
- `401` — Unauthorized
- `422` — Validation Error
- `503` — Files API not configured.

## Changes

- **2026-08-27** `4e828cf153c4` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/zylon-ai/apis/private-gpt-api/changes/v1/files/delete.md)

---

[API](https://skmtc.dev/zylon-ai/apis/private-gpt-api.md) · [All operations](https://skmtc.dev/zylon-ai/apis/private-gpt-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/zylon-ai/private-gpt-api/revisions/4e828cf153c4/schema)
