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

# Unregister a workspace

> Unregisters a workspace. Its past runs are kept in the history. Project files are never
touched; with `purge: true` the folder's `.cliq/` directory is deleted too.

When the daemon is connected to CliqHub it also asks CliqHub to drop the workspace from
its catalog (`hub_removed`); if CliqHub cannot be reached the workspace is still
unregistered here. Unregistering a path that is not registered succeeds with
`removed: false`.

From the CLI: `cliq workspace delete`.

No credential is needed from this machine. From another host, send `Authorization: Bearer` with a dispatch token CliqHub signed for this daemon or a `cliq_tok_…` personal token of a user in the daemon's realm; this only works once the daemon is connected to CliqHub. See [Authentication](/daemon-api/overview#authentication).



## OpenAPI

````yaml /openapi/daemon-by-tag/daemon-workspaces.yaml post /v1/workspaces/remove
openapi: 3.1.0
info:
  title: cliqd API
  version: 1.9.48
  description: >-
    HTTP API of `cliqd`, the local Cliq daemon. Generated from the daemon source
    by `scripts/generate_daemon_openapi.mjs` — do not edit by hand. See the
    [overview](/daemon-api/overview).
servers:
  - url: http://127.0.0.1:4900
    description: Local daemon (default port; `CLIQ_DAEMON_PORT` changes it)
security: []
tags:
  - name: Daemon Workspaces
    description: >-
      A **workspace** is a project folder registered with this daemon. You
      register it once

      (Register a workspace, `cliq init`), assign one or more installed teams to
      it

      (Assign a team to a workspace, `cliq assemble`), then start runs in it
      (Start a run,

      `cliq run`). Workspaces live in the daemon's own catalog; the only thing
      written into

      the folder is an empty `.cliq/` directory.


      Most endpoints take the absolute folder path as `workspace_dir`; assign
      and remove also

      accept the catalog `workspace_id`. Relative paths are resolved against the
      daemon's

      working directory, so always send absolute paths.
paths:
  /v1/workspaces/remove:
    post:
      tags:
        - Daemon Workspaces
      summary: Unregister a workspace
      description: >-
        Unregisters a workspace. Its past runs are kept in the history. Project
        files are never

        touched; with `purge: true` the folder's `.cliq/` directory is deleted
        too.


        When the daemon is connected to CliqHub it also asks CliqHub to drop the
        workspace from

        its catalog (`hub_removed`); if CliqHub cannot be reached the workspace
        is still

        unregistered here. Unregistering a path that is not registered succeeds
        with

        `removed: false`.


        From the CLI: `cliq workspace delete`.


        No credential is needed from this machine. From another host, send
        `Authorization: Bearer` with a dispatch token CliqHub signed for this
        daemon or a `cliq_tok_…` personal token of a user in the daemon's realm;
        this only works once the daemon is connected to CliqHub. See
        [Authentication](/daemon-api/overview#authentication).
      operationId: daemon_post_workspaces_remove
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                workspace_dir:
                  type: string
                  minLength: 1
                  description: Absolute workspace path
                purge:
                  description: >-
                    Also delete the folder's `.cliq/` directory. Project files
                    are never touched. Default `false`.
                  type: boolean
              required:
                - workspace_dir
            examples:
              default:
                value:
                  workspace_dir: /home/dev/acme-api
              purge:
                summary: Also delete the folder's .cliq/ directory
                value:
                  workspace_dir: /home/dev/acme-api
                  purge: true
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                properties:
                  ok:
                    type: boolean
                    const: true
                  data:
                    $ref: '#/components/schemas/WorkspaceRemoveResult'
              example:
                ok: true
                data:
                  workspace_dir: /home/dev/acme-api
                  removed: true
                  deleted_cliq: false
                  hub_removed: true
        '400':
          description: >-
            `PAYLOAD_INVALID` — The body (query string for `GET`) fails the
            request schema. `details` lists each issue.


            `BAD_REQUEST` — The body is not valid JSON or is larger than the
            route allows (10 MB; artifact uploads more).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                PAYLOAD_INVALID:
                  summary: PAYLOAD_INVALID
                  value:
                    ok: false
                    error:
                      code: PAYLOAD_INVALID
                      message: >-
                        workspace_dir: Invalid input: expected string, received
                        undefined
                      details:
                        - path: workspace_dir
                          message: 'Invalid input: expected string, received undefined'
                BAD_REQUEST:
                  summary: BAD_REQUEST
                  value:
                    ok: false
                    error:
                      code: BAD_REQUEST
                      message: >-
                        Request body could not be read: Unexpected token } in
                        JSON at position 12
        '401':
          description: >-
            `UNAUTHORIZED` — A caller on another host sent no `Authorization:
            Bearer` token, or one that does not verify (expired, wrong
            audience).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                UNAUTHORIZED:
                  summary: UNAUTHORIZED
                  value:
                    ok: false
                    error:
                      code: UNAUTHORIZED
                      message: Missing or invalid Authorization Bearer token
        '403':
          description: >-
            `WEB_REQUEST_REFUSED` — The request carries an `Origin` header (it
            came from a web page).


            `HOST_NOT_LOCAL` — A loopback caller addressed a `Host` other than
            localhost (DNS rebinding guard).


            `LOCAL_ONLY` — The daemon isn't connected to CliqHub (no dispatch
            key) and the caller is on another host.


            `FORBIDDEN` — A `cliq_tok_…` token's user is not in this daemon's
            realm ACL, or the ACL is not loaded yet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                WEB_REQUEST_REFUSED:
                  summary: WEB_REQUEST_REFUSED
                  value:
                    ok: false
                    error:
                      code: WEB_REQUEST_REFUSED
                      message: cliqd doesn't accept requests from web pages
                HOST_NOT_LOCAL:
                  summary: HOST_NOT_LOCAL
                  value:
                    ok: false
                    error:
                      code: HOST_NOT_LOCAL
                      message: cliqd only answers requests addressed to localhost
                LOCAL_ONLY:
                  summary: LOCAL_ONLY
                  value:
                    ok: false
                    error:
                      code: LOCAL_ONLY
                      message: >-
                        This cliqd isn't connected to CliqHub yet, so from
                        another machine it only accepts a local token (minted by
                        tokens/create on the machine running cliqd)
                FORBIDDEN:
                  summary: FORBIDDEN
                  value:
                    ok: false
                    error:
                      code: FORBIDDEN
                      message: Access denied — identity not in realm ACL
        '409':
          description: >-
            `WORKSPACE_RUNS_ACTIVE` — A run is still going in the workspace.
            Wait for it or cancel it, then try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                WORKSPACE_RUNS_ACTIVE:
                  summary: WORKSPACE_RUNS_ACTIVE
                  value:
                    ok: false
                    error:
                      code: WORKSPACE_RUNS_ACTIVE
                      message: >-
                        1 run is in progress in this workspace — wait for it or
                        cancel (cliq status), then try again
        '500':
          description: >-
            `INTERNAL_ERROR` — An unexpected daemon fault. The message names the
            request id; the cause is in the cliqd log.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                INTERNAL_ERROR:
                  summary: INTERNAL_ERROR
                  value:
                    ok: false
                    error:
                      code: INTERNAL_ERROR
                      message: >-
                        cliqd hit an unexpected error (request 7f3a…). Details
                        are in the cliqd log.
      security:
        - {}
        - DaemonBearer: []
components:
  schemas:
    WorkspaceRemoveResult:
      type: object
      required:
        - workspace_dir
        - removed
        - deleted_cliq
      properties:
        workspace_dir:
          type: string
          example: /home/dev/acme-api
        removed:
          type: boolean
          description: >-
            `true` when the workspace was registered and is now unregistered;
            `false` when it was not registered (the call is idempotent).
          example: true
        deleted_cliq:
          type: boolean
          description: The folder's `.cliq/` directory was deleted (only with `purge`).
          example: false
        hub_removed:
          type: boolean
          description: >-
            Present when the daemon is connected to CliqHub. `true` when CliqHub
            removed the workspace from its catalog too; `false` when CliqHub
            refused or could not be reached (the local removal still happened).
          example: true
    ErrorReply:
      type: object
      description: >-
        Every failure. Switch on `error.code` — it is stable; `message` is for
        people and may change.
      required:
        - ok
        - error
      properties:
        ok:
          type: boolean
          const: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable error code. See [Errors](/daemon-api/errors).
              example: TEAM_NOT_FOUND
            message:
              type: string
              description: What went wrong and, where possible, what to do.
              example: Team 'acme/code-review' not found
            details:
              description: >-
                Structured detail when there is some: the list of schema issues
                for `PAYLOAD_INVALID`, the agent problems for
                `TEAM_AGENT_CONFIG_REQUIRED`, …
  securitySchemes:
    DaemonBearer:
      type: http
      scheme: bearer
      description: >-
        Not needed from the same machine. From another host: a dispatch JWT
        CliqHub signed for this daemon, or a `cliq_tok_…` personal token whose
        user is in the daemon's realm.

````

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