---
type: api
title: Delete a package
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-epm-packages-pkgname-pkgversion
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-delete-fleet-epm-packages-pkgname-pkgversion
products:
  - Kibana
---

# Delete a package

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

## Paths

- `DELETE` `/api/fleet/epm/packages/{pkgName}/{pkgVersion}`
- `DELETE` `/api/fleet/epm/packages/{pkgName}`
- `DELETE` `/s/{space_id}/api/fleet/epm/packages/{pkgName}/{pkgVersion}`

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

#### Path Parameters

- `pkgName` (string)
  Package name
- `pkgVersion` (string) — optional, leave it out to use `/api/fleet/epm/packages/{pkgName}`
  Package version

## Description

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

Uninstall a specific version of a package and remove all its assets.<br/><br/>[Required authorization] Route required privileges: integrations-all AND fleet-agent-policies-all.

## Query String Parameters

- `force` (boolean)
  When true, delete the package even if it has active package policies

## Responses

#### `200`

Successful response

`application/json`

- `items` ([] union anyOf · max: 10000)
  - **Kibana_HTTP_APIs_kibana_asset_reference**
    - `deferred` (boolean)
    - `id` (string)
    - `originId` (string)
    - `type` (union enum | string)
      Values: `dashboard`, `lens`, `visualization`, `search`, `index-pattern`, `map`, `ml-module`, `security-rule`, `csp-rule-template`, `osquery-pack-asset`, `osquery-saved-query`, `tag`
  - **Kibana_HTTP_APIs_es_asset_reference**
    - `customDataStreamOriginDataset` (string)
    - `customDataStreamOriginType` (string)
    - `deferred` (boolean)
    - `id` (string)
    - `type` (enum)
      Values: `index`, `index_template`, `component_template`, `ingest_pipeline`, `ilm_policy`, `data_stream_ilm_policy`, `transform`, `ml_model`, `knowledge_base`, `esql_view`
    - `version` (string)
#### `400`

Bad Request

`application/json`

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

#### Console

```console
DELETE /api/fleet/epm/packages/{pkgName}/{pkgVersion}
```

#### curl

```curl
curl -X DELETE "https://{kibana_url}/api/fleet/epm/packages/{pkgName}/{pkgVersion}" \
  -H "kbn-xsrf: true"
```

## Response Examples

#### Delete package

Package successfully deleted

```json
{
  "items": [
    {
      "id": "aws-logs-aws.cloudwatch_logs-default",
      "type": "index_template"
    }
  ]
}
```

#### Generic error response

Example of a generic error response

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

