---
title: "Delete Context Files"
method: DELETE
path: "/api/v1/contexts/{context_id}/files"
tags: ["contexts"]
---

# Delete Context Files

`DELETE /api/v1/contexts/{context_id}/files`

## Request

- Base URL: `https://memory.kagura-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://memory.kagura-ai.com/api/v1/contexts/{context_id}/files`
- Auth: none declared

Soft-delete every file of the context and release their quota (#1960).

Owner only. Allowed while the workspace is capacity-locked (#1941): it is
cleanup, the way an owner gets back under the storage limit — and the
default context cannot be deleted, so this is how its files are cleared in
bulk. The files take the same road as a single ``DELETE /files/{id}``: the
rows are soft-deleted now, the R2 objects go with the 7-day GC.

Raises:
    403: Not the context owner.
    404: Context not found.
    409: The context is locked (``is_locked``), as for deleting it.

## Path parameters

- `context_id` string, uuid, required

## Headers

- `authorization` string, nullable

## Response `200`

Successful Response

- ContextFilesDeleteResponse: What ``DELETE /contexts/{id}/files`` removed (#1960).
  - `deleted` integer, required: Uploaded files soft-deleted — what the file list showed; cancelled in-flight uploads release their bytes but are not counted
  - `released_bytes` integer, required: Bytes released from the storage quota: the uploaded files' bytes plus the reservations of cancelled in-flight uploads

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud.md) · [All operations](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/revisions/aa9df1a21db9?raw)
