---
type: api
title: "Delete all case attachments"
description: "Deletes all attachments from a case. Attached files are also deleted. You must have all privileges for the Cases feature in the Management, Observability, or Security section of the Kibana feature privileges, depending on the owner of the case."
url: https://www.elastic.co/elastic/docs-builder/docs/5066/api/kibana-serverless/operation/operation-deletecaseattachmentsdefaultspace
resource: https://www.elastic.co/elastic/docs-builder/docs/5066/api/kibana-serverless/operation/operation-deletecaseattachmentsdefaultspace
products:
  - Kibana
---

# Delete all case attachments

Authentication: required

Availability: Planned

- Server: `https://{kibana_url}`

## Paths

- `DELETE` `/api/cases/{caseId}/attachments`
- `DELETE` `/s/{space_id}/api/cases/{caseId}/attachments`

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.
- `caseId` (string) — required
  The identifier for the case. To retrieve case IDs, use the search cases (`_find)` API. All non-ASCII characters must be URL encoded.
  Example: `9c235210-6834-11ea-a78c-6ffb38a34414`

## Description

Deletes all attachments from a case. Attached files are also deleted. You must have `all` privileges for the **Cases** feature in the **Management**, **Observability**, or **Security** section of the Kibana feature privileges, depending on the owner of the case.

## Header parameters

- `kbn-xsrf` (string) — required
  Cross-site request forgery protection

## Responses

#### `204`

Indicates a successful call.

#### `401`

Authorization information is missing or invalid.

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (integer)
#### `403`

You don't have the required privileges for this case.

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (integer)
#### `404`

The case doesn't exist or has no attachments.

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (integer)
## Code examples

#### Console

```console
DELETE kbn:/api/cases/9c235210-6834-11ea-a78c-6ffb38a34414/attachments
```

#### curl

```curl
curl -X DELETE "${KIBANA_URL}/api/cases/9c235210-6834-11ea-a78c-6ffb38a34414/attachments" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### Authorization information is missing or invalid.

`application/json`

```json
{
  "error": "Unauthorized",
  "message": "Unable to authenticate with the provided credentials.",
  "statusCode": 401
}
```

#### The user does not have access to the requested resource.

`application/json`

```json
{
  "error": "Forbidden",
  "message": "Unauthorized to access cases",
  "statusCode": 403
}
```

#### The case has no attachments.

`application/json`

```json
{
  "error": "Not Found",
  "message": "No attachments found for case 293f1bc0-74f6-11ea-b83a-553aecdb28b6.",
  "statusCode": 404
}
```

