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

# Delete a file

`DELETE /files/{file_id}`

Deletes a file owned by the requesting workspace. Deletion is irreversible.

## Path parameters

- `file_id` string, required

## Query parameters

- `workspace_id` string, uuid — Workspace to scope the request to. Defaults to the caller’s default workspace.
- `provider` 'openai' | 'anthropic' — Store or read this file on the named provider using your own API key for it. Omit to use OpenRouter storage.

## Response `200`

The file was deleted.

- union — Confirmation that a file was deleted, in the negotiated shape.
  - OpenRouterFileDeleted — Deletion result in the OpenRouter shape.
    - `_shape` 'openrouter', required
    - `id` string, required
    - `type` 'file_deleted', required
  - OpenAIFileDeleted — Deletion result in OpenAI's shape.
    - `_shape` 'openai', required
    - `deleted` true, required
    - `id` string, required
    - `object` 'file', required
  - AnthropicFileDeleted — Deletion result in Anthropic's shape.
    - `_shape` 'anthropic', required
    - `id` string, required
    - `type` 'file_deleted', required

## Other responses

- `401` — Unauthorized - Authentication required or invalid credentials
- `403` — Forbidden - Authentication successful but insufficient permissions
- `404` — Not Found - Resource does not exist
- `429` — Too Many Requests - Rate limit exceeded
- `500` — Internal Server Error - Unexpected server error
- `502` — Bad Gateway - Provider/upstream API failure
- `503` — Service Unavailable - Service temporarily unavailable

## Changes

- **2026-08-26** `ed04e14f2755` — 2 breaking, 1 warning
  - for the `path` request parameter `file_id`, the minLength was increased from `0` to `1`
  - added the pattern `^[\w-]+$` to the `path` request parameter `file_id`
  - for the `path` request parameter `file_id`, the maxLength was set to `256`
- **2026-07-29** `6968addaaf97` — 4 breaking, 5 info
  - added `#/components/schemas/OpenRouterFileDeleted, #/components/schemas/OpenAIFileDeleted, #/components/schemas/AnthropicFileDeleted` to the response body `oneOf` list for the response status `200`
  - the response's body type changed from `object` to no type for status `200`
  - removed the required property `id` from the response with the `200` status
  - removed the required property `type` from the response with the `200` status
  - …5 more

[Change history](https://skmtc.dev/openrouterteam/apis/openrouter-api/changes/files/:file_id/delete.md)

---

[API](https://skmtc.dev/openrouterteam/apis/openrouter-api.md) · [All operations](https://skmtc.dev/openrouterteam/apis/openrouter-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/openrouterteam/openrouter-api/revisions/7acda443a3bd/schema)
