---
type: api
title: Delete a package policy
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana-serverless/operation/operation-delete-fleet-package-policies-packagepolicyid
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana-serverless/operation/operation-delete-fleet-package-policies-packagepolicyid
products:
  - Kibana
---

# Delete a package policy

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

## Paths

- `DELETE` `/api/fleet/package_policies/{packagePolicyId}`
- `DELETE` `/s/{space_id}/api/fleet/package_policies/{packagePolicyId}`

#### Path parameters

- `packagePolicyId` (string) — required
  The ID of the package policy

## Description

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

Delete a package policy by ID.

## Required authorization

- Privileges: `fleet-agent-policies-all` and `integrations-all`

## Authentication

- Api key: `Authorization: <value>`
  You must create an API key and use the encoded value in the request header. To learn about creating keys, go to [API keys](https://www.elastic.co/docs/current/serverless/api-keys).

## Query string parameters

- `force` (boolean) — optional
  When true, delete the package policy even if it is managed

## Header parameters

- `kbn-xsrf` (string) — required
  A required header to protect against CSRF attacks

## Responses

#### `200`

Successful response

`application/json`

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

Bad Request

`application/json`

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

#### Console

```console
DELETE kbn:/api/fleet/package_policies/PACKAGE_POLICY_ID
```

#### curl

```curl
curl -X DELETE "${KIBANA_URL}/api/fleet/package_policies/${PACKAGE_POLICY_ID}" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### Delete package policy

The package policy was successfully deleted

```json
{
  "id": "package-policy-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
}
```

