> ## 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.

# Show a hug in development

> What `cliq hug dev` calls: shows a hug's built bundle on the local Hug page — no run, no Hug —
with the given params, attachments, or an answer to show in view mode. Calling again with the
same `dev_id` after a rebuild reloads the page. Local callers only.

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-hug.yaml post /v1/hugs/dev
openapi: 3.1.0
info:
  title: cliqd API
  version: 1.15.16
  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 Hugs
    description: >-
      A Hug is an agent asking people for input, with a hug — the page they
      answer on. The agent

      (through cliq-sdk's `ctx.ask` / `ctx.hug`) opens it here; cliqd finds the
      hug by name (the

      team's `hugs/`, `CLIQ_HUGS_PATH`, `~/.cliqrc/hugs`), adds its bundle's
      hash, stores the Hug with

      its events in SQLite, sends it to CliqHub (with the bundle, when CliqHub
      asks for it)

      when enrolled (through the outbox, retried until it is accepted), and
      hands the agent each

      event — an answer, the expiry, a cancellation — in order through `next`.
      The agent decides

      when it has heard enough and closes the Hug.


      CliqHub delivers events with `deliver` (a Hub command: deduplicated and
      acknowledged, stored

      before the ack). In standalone mode there is no CliqHub: the Hug is local,
      cliqd serves its

      page at `/hugs/<hug_id>` (the link carries a per-Hug secret; `cliq run`
      opens it), and the

      answer arrives through `respond`. A phase that stops while its Hugs are

      open waits for them, and runs again when they have something new — also
      after a restart (root

      runs; a sub-team's run can't be re-attached and is marked crashed). See
      [Hugs](/hugs).
paths:
  /v1/hugs/dev:
    post:
      tags:
        - Daemon Hugs
      summary: Show a hug in development
      description: >-
        What `cliq hug dev` calls: shows a hug's built bundle on the local Hug
        page — no run, no Hug —

        with the given params, attachments, or an answer to show in view mode.
        Calling again with the

        same `dev_id` after a rebuild reloads the page. Local callers only.


        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_hugs_dev
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                dev_id:
                  description: Refresh this dev Hug after a rebuild (its page reloads)
                  type: string
                  minLength: 1
                  maxLength: 100
                dist:
                  type: string
                  minLength: 1
                  description: The hug's built bundle folder (absolute path)
                params:
                  description: The hug's params (checked against its definition)
                attachments:
                  description: Files the hug may read (absolute paths)
                  maxItems: 50
                  type: array
                  items:
                    type: string
                    minLength: 1
                view:
                  description: Values to show in view mode, as a submitted answer
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties: {}
              required:
                - dist
            examples:
              default:
                value:
                  dist: /home/ann/team/hugs/review-batch/dist
                  params:
                    company: ACME
                    documents:
                      - id: lease
                        name: Lease
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                properties:
                  ok:
                    type: boolean
                    const: true
                  data:
                    type: object
                    properties:
                      dev_id:
                        type: string
                      page_path:
                        type: string
                        description: The page's path on cliqd, with its secret after `#`.
              example:
                ok: true
                data:
                  dev_id: d-1
                  page_path: /hugs/d-1#3b9f…
        '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: 'dist: Invalid input: expected string, received undefined'
                      details:
                        - path: dist
                          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: >-
            `FORBIDDEN` — The caller isn't on the daemon's own machine.


            `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.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                FORBIDDEN:
                  summary: FORBIDDEN
                  value:
                    ok: false
                    error:
                      code: FORBIDDEN
                      message: Forbidden
                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)
        '422':
          description: >-
            `UNPROCESSABLE` — The folder isn't a built hug, or the params don't
            match its definition.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                UNPROCESSABLE:
                  summary: UNPROCESSABLE
                  value:
                    ok: false
                    error:
                      code: UNPROCESSABLE
                      message: Unprocessable entity
        '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:
    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.