---
title: "Delete a file"
method: DELETE
path: "/v1/files/{file_id}"
tags: ["Files"]
---

# Delete a file

`DELETE /v1/files/{file_id}`

Permanently delete a file from the session. Both uploaded files and sandbox-generated output files can be deleted through this endpoint.

## Path parameters

- `file_id` string, required

## Query parameters

- `scope_id` string, required — Session / container identifier.
- `namespace` string — Namespace the file belongs to. Defaults to 'session'.

## Response `200`

Successful Response

- DeletedFile — Confirmation that a file was deleted.
  - `id` string, required — Relative path of the file that was deleted.
  - `type` 'file_deleted' — Object type discriminator, always 'file_deleted'.

## Other responses

- `401` — Unauthorized
- `404` — File not found.
- `422` — Validation Error
- `503` — Files API not configured (session namespace not set).

## Changes

- **2026-08-27** `4e828cf153c4` — 1 info
  - added the new optional `query` request parameter `namespace`
- **2026-07-06** `594fa71dfb90` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/zylon-ai/apis/private-gpt-api/changes/v1/files/:file_id/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)
