---
type: api
title: Delete file uploaded by agent
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-delete-agent-upload-file
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-delete-agent-upload-file
products:
  - Kibana
---

# Delete file uploaded by agent

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

## Paths

- `DELETE` `/api/fleet/agents/files/{fileId}`
- `DELETE` `/s/{space_id}/api/fleet/agents/files/{fileId}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v8/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v8/authentication#basicauth)

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

## Responses

#### `200`

OK

`application/json`

- `body` (object)
  - `deleted` (boolean)
  - `id` (string)
#### `400`

Generic Error

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (number)
## Code Examples

#### Console

```console
DELETE /api/fleet/agents/files/{fileId}
```

#### curl

```curl
curl -X DELETE "https://{kibana_url}/api/fleet/agents/files/{fileId}"
```

