---
type: api
title: Delete an uploaded file
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-delete-fleet-agents-files-fileid
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-delete-fleet-agents-files-fileid
products:
  - Kibana
---

# Delete an uploaded file

- 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-serverless/authentication#apikeyauth)

#### Path Parameters

- `fileId` (string)
  The ID of the uploaded file

## Description

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

Delete a file uploaded by an agent.<br/><br/>[Required authorization] Route required privileges: fleet-agents-all.

## Responses

#### `200`

Successful response

`application/json`

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

Bad Request

`application/json`

- `attributes` (object)
- `error` (string)
- `errorType` (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}" \
  -H "kbn-xsrf: true"
```

## Response Examples

#### Delete agent upload file

Uploaded file successfully deleted

```json
{
  "deleted": true,
  "id": "file-id-1"
}
```

#### Generic error response

Example of a generic error response

```json
{
  "error": "Bad Request",
  "message": "An error message describing what went wrong",
  "statusCode": 400
}
```

