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

# Set a setting

> Writes one setting; `value: null` clears it. Daemon-wide keys take effect at once
(logging keys are re-applied immediately). A workspace key needs the `workspace_dir` of
a registered workspace.

`hub_connect.sync` and `hub_connect.sync_logs` (or `hub_connect` with an object) control
what the daemon sends to CliqHub; clearing one restores its default rather than
turning it off.

CliqHub can push settings too: with `tx_id` a repeated call returns the first reply and
the outcome is acknowledged to CliqHub. Keys that decide where the daemon sends its
credentials or listens (`cliq.api_url`, `daemon.host`, every `hub.` key) can only be
changed from this machine.

From the CLI: `cliq settings set agents.claude-code.api_key <value>`.

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-settings.yaml post /v1/settings/set
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 Settings
    description: >-
      Settings are `key = value` pairs, the same ones `cliq settings` reads and
      writes.

      Keys under `agents.`, `hub.`, `hub_connect.`, `daemon.`, `logging.`,
      `notifications.`,

      `docker.`, `cliq.` and a few other prefixes are **daemon-wide**. Any other
      key is a

      **workspace secret**, stored for one workspace and needing
      `workspace_dir`.


      Secret values (API keys, tokens, passwords, and every workspace secret)
      are only shown to

      callers on the same machine; from another host they read as `•••• (secret,
      hidden)`.

      Values are JSON: strings, numbers, booleans, objects.
paths:
  /v1/settings/set:
    post:
      tags:
        - Daemon Settings
      summary: Set a setting
      description: >-
        Writes one setting; `value: null` clears it. Daemon-wide keys take
        effect at once

        (logging keys are re-applied immediately). A workspace key needs the
        `workspace_dir` of

        a registered workspace.


        `hub_connect.sync` and `hub_connect.sync_logs` (or `hub_connect` with an
        object) control

        what the daemon sends to CliqHub; clearing one restores its default
        rather than

        turning it off.


        CliqHub can push settings too: with `tx_id` a repeated call returns the
        first reply and

        the outcome is acknowledged to CliqHub. Keys that decide where the
        daemon sends its

        credentials or listens (`cliq.api_url`, `daemon.host`, every `hub.` key)
        can only be

        changed from this machine.


        From the CLI: `cliq settings set agents.claude-code.api_key <value>`.


        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_settings_set
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                workspace_dir:
                  anyOf:
                    - type: string
                      minLength: 1
                    - type: 'null'
                  description: Workspace path, or null for daemon-global settings
                key:
                  type: string
                  minLength: 1
                  description: Setting key
                value:
                  description: New value; null clears the setting
                tx_id:
                  description: Hub command id (dedup + ack)
                  type: string
              required:
                - workspace_dir
                - key
            examples:
              api_key:
                summary: An agent API key
                value:
                  workspace_dir: null
                  key: agents.claude-code.api_key
                  value: <your-anthropic-api-key>
              clear:
                summary: Clear a setting
                value:
                  workspace_dir: null
                  key: agents.claude-code.model
                  value: null
              workspace:
                summary: A workspace secret
                value:
                  workspace_dir: /home/dev/acme-api
                  key: STRIPE_TEST_KEY
                  value: sk_test_123
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                properties:
                  ok:
                    type: boolean
                    const: true
                  data:
                    $ref: '#/components/schemas/SettingSetResult'
              example:
                ok: true
                data:
                  workspace_dir: null
                  key: agents.claude-code.model
                  value: claude-sonnet-4-5
                  updated: true
        '400':
          description: >-
            `PAYLOAD_INVALID` — `value` is missing (send `null` to clear), `key`
            is missing or empty, or `workspace_dir` is missing.


            `SETTING_VALUE_INVALID` — A workspace key was sent with
            `workspace_dir` `null`, or the key is `hub.token` (replaced by
            `hub.session`).


            `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: 'value: is required (use null to clear)'
                      details:
                        - path: value
                          message: is required (use null to clear)
                SETTING_VALUE_INVALID:
                  summary: SETTING_VALUE_INVALID
                  value:
                    ok: false
                    error:
                      code: SETTING_VALUE_INVALID
                      message: >-
                        Non-daemon key "STRIPE_TEST_KEY" requires a workspace:
                        run it inside a workspace directory
                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: >-
            `SETTING_LOCAL_ONLY` — A caller on another host tried to change
            `cliq.api_url`, `daemon.host` or a `hub.` key.


            `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:
                SETTING_LOCAL_ONLY:
                  summary: SETTING_LOCAL_ONLY
                  value:
                    ok: false
                    error:
                      code: SETTING_LOCAL_ONLY
                      message: >-
                        hub.session can only be changed on the machine running
                        cliqd
                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
        '404':
          description: >-
            `WORKSPACE_NOT_REGISTERED` — `workspace_dir` is not a registered
            workspace (workspace keys only).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorReply'
              examples:
                WORKSPACE_NOT_REGISTERED:
                  summary: WORKSPACE_NOT_REGISTERED
                  value:
                    ok: false
                    error:
                      code: WORKSPACE_NOT_REGISTERED
                      message: 'Workspace not registered: /home/dev/acme-api'
        '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:
    SettingSetResult:
      type: object
      required:
        - workspace_dir
        - key
        - value
        - updated
      properties:
        workspace_dir:
          type:
            - string
            - 'null'
          example: null
        key:
          type: string
          description: >-
            The key written. For `hub_connect.sync` / `hub_connect.sync_logs`
            this is `hub_connect`.
          example: agents.claude-code.model
        value:
          description: >-
            The value now stored, or `null` when cleared. For `hub_connect`
            keys, the whole `{ sync, sync_logs }` object.
          example: claude-sonnet-4-5
        updated:
          type: boolean
          description: The stored value was written.
          example: true
        warning:
          type: string
          description: >-
            Present when the change took effect with a caveat (for example sync
            settings the daemon will apply after reconnecting).
    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.