# Delete Policy Draft

`DELETE /policies/{bundleId}` · Core · Policy & Approvals

Deletes a draft policy bundle. Only `draft`-status bundles may be deleted; attempts to delete a `published` or `superseded` bundle return `K9O_POLICY_PUBLISH_CONFLICT` (409). Requires `PROJECT_ADMIN`. Published and superseded bundles are retained for audit and cannot be deleted.

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `bundleId` | path | yes | The policy bundle id (`pol_...`). The `pol_` prefix may be left out. Example: `"pol_demo00000001"`. |
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Responses

- **204**: The draft was deleted. No body.

## Errors

| HTTP | Code | When |
|---|---|---|
| 401 | `K9O_SESSION_EXPIRED` | The caller's session token is expired or invalid; re-authenticate to continue. |
| 403 | `K9O_ACCESS_DENIED` | The caller does not hold PROJECT_ADMIN role, which is required to delete a policy bundle. |
| 404 | `K9O_POLICY_NOT_FOUND` | No policy bundle with the supplied identifier exists in this project. |
| 409 | `K9O_POLICY_PUBLISH_CONFLICT` | The bundle is published or superseded and cannot be deleted; only draft bundles may be removed. |

## Code samples

### cURL

```bash
curl -X DELETE 'https://<org>.api-<region>.k9o.io/@storefront/policies/<bundleId>' \
  -H 'Authorization: Bearer $K9O_TOKEN'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/policies/<bundleId>', {
  method: 'DELETE',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`
  },
});
const { data, meta } = await res.json();
```

### @k9o/core

```typescript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.policies.delete('pol_demo00000001')
```

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.policies.delete("pol_demo00000001")
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Policies.Delete(ctx, "pol_demo00000001")
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.policies.delete("pol_demo00000001").await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.policies().delete("pol_demo00000001")
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Policies.DeleteAsync("pol_demo00000001")
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.policies.delete("pol_demo00000001")
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->policies->delete('pol_demo00000001')
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/core/delete-policy-draft
