/v1/workspaces/{workspace_slug}/policies/{policy_id}AuthDelete a managed policy. Cascades: API keys lose the binding (deny-all if no other bindings remain); roles fall back to their inline policy column. Owners and admins; a policy bound to a role, or a preset policy, only an owner can delete. Cookie/JWT only.
Path parameters
workspace_slug*stringSlug of the workspace. Platform routes name the workspace by slug, positionally in the SDK (`platform.workspaces.retrieve("acme")`); the product APIs bind `workspace_id` instead.
policy_id*string · uuidId of the policy.
Response · 200 Policy deleted. `bound_key_count` is the number of live API keys that lost the binding.
id*string · uuidThe deleted policy.
deleted*booleanAlways `true`: the policy is gone.
Example: true
bound_key_count*numberLive API keys that were bound to the policy and lost the binding. A key with no binding left falls back to deny-all.
Example: 3
Example
Request
DELETE https://api.platform-auth.productcraft.co/v1/workspaces/{workspace_slug}/policies/{policy_id}
Authorization: Bearer YOUR_TOKENimport { PlatformAuth } from "@productcraft/platform-auth";
// Reads PRODUCTCRAFT_API_KEY from the environment; administration
// calls take a person's session: { auth: { type: "bearer", token } }
const platform = new PlatformAuth();
const managedPolicyDeleted = await platform.workspaces.policies.delete("acme", "3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f");platform.workspaces.policies.delete(workspaceSlug, policyId, options?): PlatformAuth.ManagedPolicyDeleted
Response
{
"id": "00000000-0000-0000-0000-000000000000",
"deleted": true,
"bound_key_count": 3
}