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

# Delete workspace

> Delete a workspace and all its computers.

Deletes a workspace and every computer in it. Only the workspace owner can call this. An invited member gets `401` or `403`, described in [Errors](#errors).

The verb is `POST` and the path ends in `/delete`. There is no `DELETE` handler on `/workspaces/{id}`. Sending `DELETE` there returns `405`.

<Warning>
  This cannot be undone. Every computer in the workspace is terminated and its disk destroyed.
</Warning>

## Order of operations

The endpoint runs these steps in this order:

1. Checks that you own the workspace.
2. Refuses with `409`, before touching anything, when the workspace holds a device or dedicated machine that Orgo manages, has a dedicated computer purchase, has hourly or dedicated computer billing records, has an OpenClaw enrollment, or when another operation is already working on it.
3. Terminates each computer on its host, one at a time. A host that answers `404`, or a computer with no recorded host address, does not stop the delete. A failed termination does not stop the loop either: every remaining computer is still tried.
4. Returns `500` if any termination failed. The workspace, its file records, and the computers that were not terminated stay in place.
5. Deletes the workspace's file records and the workspace row together. The database cascade then removes the computer records.

<Warning>
  A `500` does not mean the workspace is intact. Every computer whose termination succeeded is already destroyed, including any after the one that failed. A retry does not re-send the failed terminations. It returns `409` with `teardown_reconciliation_required` until Orgo support confirms what happened to them. Contact support to finish the delete.
</Warning>

## Path parameters

<ParamField path="id" type="string" required>
  Workspace ID. Required.
</ParamField>

The request body is ignored.

## Response

<ResponseField name="success" type="boolean">
  `true` when the workspace and all of its computers were deleted. The endpoint never returns `false`. A failure comes back as a `4xx` or `5xx` instead.
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable confirmation. Currently `"Project deleted successfully"`.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://www.orgo.ai/api/workspaces/$WORKSPACE_ID/delete \
    -H "Authorization: Bearer $ORGO_API_KEY"
  ```

  ```python Python theme={null}
  import os
  import requests

  api_key = os.environ["ORGO_API_KEY"]
  workspace_id = os.environ["WORKSPACE_ID"]

  response = requests.post(
      f"https://www.orgo.ai/api/workspaces/{workspace_id}/delete",
      headers={"Authorization": f"Bearer {api_key}"}
  )

  if response.json().get("success"):
      print("Workspace deleted")
  ```

  ```javascript JavaScript theme={null}
  const apiKey = process.env.ORGO_API_KEY;
  const workspaceId = process.env.WORKSPACE_ID;

  const response = await fetch(
    `https://www.orgo.ai/api/workspaces/${workspaceId}/delete`,
    {
      method: 'POST',
      headers: { 'Authorization': `Bearer ${apiKey}` }
    }
  );

  const { success } = await response.json();
  if (success) console.log('Workspace deleted');
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "message": "Project deleted successfully"
}
```

## Errors

| Status | Body | Meaning |
| - | - | - |
| `401` | `{ "error": "Invalid API key" }` | The Bearer token starts with `sk_` but is not a known Orgo key. |
| `401` | `{ "error": "Authentication required" }` | No `Authorization` header, or a Bearer token that is not an `sk_` key. |
| `401` | `{ "error": "You do not have access to this workspace." }` | Your account neither owns nor belongs to the workspace, or no workspace has that ID. An unknown ID returns this `401`, not `404`. |
| `401` | `{ "error": "This workspace is view-only. Ask the owner for write access (workspace_read_only)." }` | You are a view-only member of the workspace. |
| `401` | `{ "error": "This API key cannot access this workspace (workspace_scope_mismatch)." }` | A workspace-scoped key targeted a different workspace. |
| `403` | `{ "error": "Only project owner can delete project" }` | You are a member with edit access, not the owner. |
| `409` | `{ "error": "workspace_holds_device", "message": "…" }` | The workspace holds a Mac, an iPhone, or a dedicated machine that Orgo manages. Ask support to release it first. Nothing was deleted. |
| `409` | `{ "error": "compute_allocation_active", "detail": "…" }` | The workspace has a dedicated computer purchase on record. Manage it in Account → Usage first. Nothing was deleted. |
| `409` | `{ "error": "compute_billing_records", "detail": "…" }` | The workspace has hourly or dedicated computer billing records that Orgo keeps. Contact support to delete it. Nothing was deleted, unless the records appeared while the delete was running: then the computers it already shut down stay shut down. |
| `409` | `{ "error": "openclaw_enrollment_cleanup_required", "detail": "…" }` | The workspace has an OpenClaw enrollment. Revoke it first. Nothing was deleted. |
| `409` | `{ "error": "teardown_in_flight", "detail": "…" }` | Another operation is already working on this workspace. Retry in a moment. |
| `409` | `{ "error": "teardown_unavailable", "detail": "…" }` | The delete could not start right now. Retry in a moment. |
| `409` | `{ "error": "teardown_membership_changed", "detail": "…" }` | A computer was added to the workspace while it was being deleted. Remove it, then retry. |
| `409` | `{ "error": "teardown_reconciliation_required", "detail": "…" }` | An earlier attempt could not confirm that every computer shut down. Support has to reconcile it before the delete can finish. |
| `500` | `{ "error": "Refusing to delete project. …" }` | One or more computers could not be terminated, so the workspace was not deleted. **Deletion is already partly done:** every computer whose termination succeeded is destroyed. See [Order of operations](#order-of-operations). |
| `500` | `{ "error": "Failed to delete workspace" }` | Unexpected server error. |

This endpoint answers every failed authorization check with `401`, including a valid key that lacks access. A server-side fault while verifying the credential also comes back as `401`, with `Service temporarily unavailable. …` as the message. Retry that one.


## OpenAPI

````yaml POST /workspaces/{id}/delete
openapi: 3.1.0
info:
  title: Orgo API
  description: >-
    Launch cloud computers that AI agents can control and interact with. Create
    workspaces, provision computers, and control them programmatically.
  version: 2.0.0
  contact:
    name: Orgo Support
    email: spencer@orgo.ai
    url: https://orgo.ai
servers:
  - url: https://www.orgo.ai/api
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Account
    description: >-
      Account capacity: how many computers an account may run, and adding or
      giving back more.
  - name: Clients
    description: >-
      Run Orgo for your clients from your own app: a workspace and scoped key
      each, billed to you or to them.
  - name: Workspaces
    description: Organize computers into named workspaces
  - name: Computers
    description: Provision and manage virtual computers
  - name: Computer Lifecycle
    description: Start, stop, and restart computers
  - name: Computer Actions
    description: Control mouse, keyboard, and execute commands
  - name: Screens
    description: >-
      More than one desktop on a single computer. Each screen is its own X
      server with its own cursor and window manager, so an agent working on one
      cannot disturb another.
  - name: Files
    description: Upload and download files
  - name: Templates
    description: Author, build, and launch reproducible computers from templates
paths:
  /workspaces/{id}/delete:
    post:
      tags:
        - Workspaces
      summary: Delete workspace
      description: >-
        Permanently deletes a workspace and every computer, file, and member
        record in it. Only the owner may delete it. This endpoint answers every
        failed authorization check, including an unknown ID, with `401`.
      operationId: deleteWorkspace
      parameters:
        - name: id
          in: path
          required: true
          description: Workspace ID
          schema:
            type: string
      responses:
        '200':
          description: Workspace deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    description: Human-readable confirmation.
                    example: Project deleted successfully
        '401':
          description: >-
            No usable credential, or an access check failed: you neither own nor
            belong to the workspace (an unknown ID also returns this, not
            `404`), you are a view-only member, or the key is scoped to another
            workspace. A server-side fault while verifying the credential also
            returns `401`; retry that one.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                invalid-key:
                  summary: The key is not one of yours
                  value:
                    error: Invalid API key
                no-credential:
                  summary: No key and no session
                  value:
                    error: Authentication required
                no-access:
                  summary: Not the owner or a member of the workspace
                  value:
                    error: You do not have access to this workspace.
                view-only:
                  summary: View-only member, and the request changes something
                  value:
                    error: >-
                      This workspace is view-only. Ask the owner for write
                      access (workspace_read_only).
                scope-mismatch:
                  summary: The API key is scoped to another workspace
                  value:
                    error: >-
                      This API key cannot access this workspace
                      (workspace_scope_mismatch).
                service-unavailable:
                  summary: Server-side fault while verifying the credential. Retry.
                  value:
                    error: >-
                      Service temporarily unavailable. The database is not
                      accepting requests. Retry shortly.
        '403':
          description: You are a member with edit access, not the owner.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Only project owner can delete project
        '409':
          description: >-
            The delete was refused, and the workspace still exists. A refusal
            raised before teardown begins deletes nothing.
            `compute_billing_records` can also be raised after the computers
            were shut down, when billing records appeared while the delete was
            running; those computers stay shut down.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  detail:
                    type: string
              examples:
                device:
                  summary: Holds a Mac, an iPhone, or a dedicated machine Orgo manages
                  value:
                    error: workspace_holds_device
                    message: >-
                      This workspace holds a device Orgo manages (a Mac or an
                      iPhone). Ask support to release it before deleting the
                      workspace.
                allocation:
                  summary: A dedicated computer purchase is on record
                  value:
                    error: compute_allocation_active
                    detail: >-
                      Manage dedicated computer purchases in Account → Usage
                      before deleting this resource.
                billing-records:
                  summary: Hourly or dedicated computer billing records that Orgo keeps
                  value:
                    error: compute_billing_records
                    detail: >-
                      This workspace or account has hourly or dedicated computer
                      billing records that Orgo keeps, so it cannot be deleted
                      here. Nothing was deleted. Contact support to delete it.
                openclaw:
                  summary: An OpenClaw enrollment
                  value:
                    error: openclaw_enrollment_cleanup_required
                    detail: …
                in-flight:
                  summary: Another operation is working on the workspace
                  value:
                    error: teardown_in_flight
                    detail: …
                unavailable:
                  summary: The delete could not start right now
                  value:
                    error: teardown_unavailable
                    detail: …
                membership:
                  summary: A computer was added during the delete
                  value:
                    error: teardown_membership_changed
                    detail: …
                reconcile:
                  summary: Support must reconcile an earlier attempt
                  value:
                    error: teardown_reconciliation_required
                    detail: …
        '500':
          description: >-
            One or more computers could not be terminated, so the workspace was
            not deleted, but deletion is already partly done: every computer
            whose termination succeeded is destroyed. Also returned for an
            unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                refused:
                  summary: Partial teardown
                  value:
                    error: Refusing to delete project. …
                other:
                  summary: Unexpected
                  value:
                    error: Failed to delete workspace
components:
  schemas:
    Error:
      type: object
      description: >-
        The base error body. Every failure carries `error`; individual endpoints
        add the fields named in the schemas below.
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable message.
          example: Access denied
        code:
          type: string
          description: >-
            Machine-readable reason. Present on the failures that define one,
            absent otherwise.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key authentication. Get your key at orgo.ai/workspaces

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.