DELETE
/policies/{bundleId}Delete Policy Draft
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
| bundleId * | path | The policy bundle id ( The |
| projectSlug * | path | The project's slug: the path segment after It is unique within the org. |
Responses
| HTTP | K9O Code | Description |
|---|---|---|
| 204 | The draft was deleted. No body. | |
| 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. |
TypeScript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.policies.delete('pol_demo00000001')Showing example in TypeScript