> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Workspace

> Owner-only delete that cascades the subtree

Deletes a workspace. **Owner-only** (the workspace's own owner, or an ancestor owner via the god path). **There is no `delete-workspace` capability.**

Deletion **cascades** the entire subtree in one transaction, bottom-up: invitations → members → workspaces. Every workspace actually deleted fires a `workspace.deleted` webhook (one per workspace).

<Note>
  **No per-member webhooks fire on this path.** The cascade does **not** emit `workspace.member.removed` for the memberships it tears down — one POST per member across a large subtree would flood a delivery layer with no retry or batching, and `workspace.deleted` already says the whole roster is gone. Treat each `workspace.deleted` as removing that node's entire roster. See [Webhooks & lifecycle](/sdk/workspaces/webhooks#deleting-a-workspace-does-not-emit-per-member-events).
</Note>

<Warning>
  Your own data tagged with a workspace id (docs, issues, etc.) is **not** deleted by Sublay — Sublay doesn't know about it. React to the `workspace.deleted` webhook to clean up your own workspace-tagged data.
</Warning>

## Path Parameters

<ParamField path="id" type="string" required>
  The workspace UUID.
</ParamField>

## Body Parameters

<ParamField body="userId" type="string">
  Service/master keys only — the user to act as (must be own owner or an ancestor owner). Sent in the request body so the act-as-user path works on `DELETE`.
</ParamField>

## Response

```json theme={null}
{ "message": "Workspace deleted successfully." }
```

## Error Responses

<AccordionGroup>
  <Accordion title="Unauthorized — 403">
    ```json theme={null}
    { "error": "Only the owner or an ancestor owner may delete a workspace.", "code": "workspace/unauthorized" }
    ```
  </Accordion>
</AccordionGroup>
