---
title: "Delete a workspace"
method: DELETE
path: "/api/v1/public/workspaces/{workspace_id}"
tags: ["Account"]
---

# Delete a workspace

`DELETE /api/v1/public/workspaces/{workspace_id}`

## Request

- Base URL: `https://app.traceroot.ai`
- URL: `https://app.traceroot.ai/api/v1/public/workspaces/{workspace_id}`
- Auth: HTTP bearer

Hard-delete a workspace and everything in it.

Requires ADMIN role in the workspace (the write service decides); a
workspace outside the caller's memberships is a 403, as on the update.
The cascade removes every project, its data references, access keys,
memberships and invites; the typed ``name`` must equal the workspace's
current name, and the caller's only workspace cannot be deleted.

Args:
    request (Request): Incoming request (rate-limit plumbing).
    response (Response): Outgoing response (rate-limit plumbing).
    auth (AccountStampedAuth): Account-scope user auth (session token or
        CLI access JWT); its resolved ``user_id`` becomes the actor.
    workspace_id (str): The workspace to delete.
    name (str): The workspace's current name, as a typed confirmation.
    reason (str): Why it is being deleted; recorded on the audit row.
    _live (None): Write-path liveness gate (blocks a revoked JWT session).

Returns:
    DeleteWorkspaceResponse: The removed workspace and the cascade counts.

Raises:
    HTTPException: The write service's 400/403/404/409 verbatim, or a
        503 when its response is ambiguous.

## Path parameters

- `workspace_id` string, required

## Query parameters

- `name` string, required: The workspace's current name, typed as confirmation
- `reason` string, required: Why the resource is being deleted; recorded on the audit row

## Response `200`

Successful Response

- DeleteWorkspaceResponse: A hard-deleted workspace and the counts of what cascaded with it.
  - `cascaded` object, nullable
  - `deleted` boolean, required
  - `reason` string, required
  - `workspace` DeletedResource, required: What a delete removed: the row's id and name, for the receipt.
    - `id` string, required
    - `name` string, required

## Other responses

- `400`: Invalid request
- `401`: Authentication failed or session revoked
- `403`: Insufficient role or wrong credential kind
- `404`: Not found
- `409`: The typed name does not match, or this is the caller's only workspace
- `422`: Validation Error
- `503`: Write service unavailable

---

[API](https://skmtc.dev/traceroot/apis/traceroot-public-api.md) - [All operations](https://skmtc.dev/traceroot/apis/traceroot-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/traceroot/apis/traceroot-public-api/revisions/ce6aef96c0d6?raw)
