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

# Update agent settings

> Sets or clears an agent's settings for the organization or a realm (`settings.values`, `settings.clear`). Do not send back masked values.

Requires a signed-in user token; with `realm_id`, a realm operator (or higher) with the `agents.manage.realm` permission on that realm; with `org_id`, a role with the `agents.manage` permission in that organization. One of `realm_id` or `org_id` is required.



## OpenAPI

````yaml /openapi/hub-by-tag/hub-agents.yaml post /v1/agents/update_settings
openapi: 3.0.3
info:
  title: 'CliqHub API: Agents'
  version: 1.0.0
  description: >-
    The agent catalog: built-in agents that ship with cliq (`is_system: true`,
    in every

    organization) and custom agents your organization registers (`cliq agent
    register`). An

    agent is identified by organization, name and version; only its manifest is
    stored here,

    the code runs on daemons. Agent settings (API keys, models, …) can be set
    for the

    organization and overridden per realm; secret values come back masked unless
    you hold

    `agents.reveal`.
servers:
  - url: https://{host}
    variables:
      host:
        default: cliqhub.io
        description: CliqHub host
security: []
tags:
  - name: Agents
    description: >-
      The agent catalog: built-in agents that ship with cliq (`is_system: true`,
      in every

      organization) and custom agents your organization registers (`cliq agent
      register`). An

      agent is identified by organization, name and version; only its manifest
      is stored here,

      the code runs on daemons. Agent settings (API keys, models, …) can be set
      for the

      organization and overridden per realm; secret values come back masked
      unless you hold

      `agents.reveal`.
paths:
  /v1/agents/update_settings:
    post:
      tags:
        - Agents
      summary: Update agent settings
      description: >-
        Sets or clears an agent's settings for the organization or a realm
        (`settings.values`, `settings.clear`). Do not send back masked values.


        Requires a signed-in user token; with `realm_id`, a realm operator (or
        higher) with the `agents.manage.realm` permission on that realm; with
        `org_id`, a role with the `agents.manage` permission in that
        organization. One of `realm_id` or `org_id` is required.
      operationId: POST_v1_agents_update_settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                org_id:
                  type: string
                  format: uuid
                  description: >-
                    Organization this call targets. Caller must be authorized
                    for this org
                id:
                  type: string
                  format: uuid
                  description: Catalog row UUID whose settings to mutate
                realm_id:
                  type: string
                  format: uuid
                  description: When set, write realm overrides; realm must belong to org_id
                settings:
                  type: object
                  properties:
                    values:
                      type: object
                      additionalProperties:
                        type: string
                      description: Keys to upsert (must be declared on the agent manifest)
                    clear:
                      type: array
                      items:
                        type: string
                        minLength: 1
                      minItems: 1
                      description: Keys to remove so values fall back to unset / inherited
                  description: Upsert and/or clear operations applied in one call
              required:
                - org_id
                - id
                - settings
            examples:
              default:
                value:
                  org_id: 2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f
                  id: 5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d
                  settings:
                    values:
                      api_token: <jira-api-token>
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                    description: Always `true` on success.
                  data:
                    type: boolean
              example:
                ok: true
                data: true
        '400':
          description: >-
            `bad_request`: Neither `realm_id` nor `org_id` was sent.


            `bad_request`: A value is a masked secret (read without
            `agents.reveal` and sent back).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                bad_request:
                  summary: bad_request
                  value:
                    ok: false
                    error:
                      code: bad_request
                      message: realm_id or org_id is required
                bad_request (endpoint):
                  summary: bad_request (endpoint)
                  value:
                    ok: false
                    error: >-
                      Value for 'api_token' appears to be masked — fetch without
                      agents.reveal first
                    code: bad_request
        '401':
          description: >-
            `unauthorized`: No `Authorization` header, or the token is
            malformed, expired or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                unauthorized:
                  summary: unauthorized
                  value:
                    ok: false
                    error:
                      code: unauthorized
                      message: Authentication required
        '403':
          description: >-
            `forbidden`: You can see the realm or organization but your role
            lacks the required permission.


            `forbidden`: `realm_id` is not a realm of the organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    ok: false
                    error:
                      code: forbidden
                      message: You do not have access to do this
                forbidden (endpoint):
                  summary: forbidden (endpoint)
                  value:
                    ok: false
                    error: realm does not belong to the requested organization
                    code: forbidden
        '404':
          description: >-
            `not_found`: The realm or organization you named does not exist or
            you cannot see it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                not_found:
                  summary: not_found
                  value:
                    ok: false
                    error:
                      code: not_found
                      message: Not found
        '422':
          description: >-
            `invalid_params`: The body fails the request schema: a required
            field is missing or a value has the wrong type or format. The
            message lists every issue as `field: problem`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                invalid_params:
                  summary: invalid_params
                  value:
                    ok: false
                    error: 'org_id: Required'
                    code: invalid_params
        '500':
          description: >-
            `internal_error`: An unexpected server fault. Retry later; if it
            persists, report it with the time of the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                internal_error:
                  summary: internal_error
                  value:
                    ok: false
                    error: Internal server error
                    code: internal_error
      security:
        - BearerAuth: []
components:
  schemas:
    HubErr:
      type: object
      required:
        - ok
        - error
      description: >-
        Every failure. Route-policy denials (401/403/404, and 400 when neither
        realm_id nor org_id was sent) answer `error` as `{ code, message }`;
        errors raised by the endpoint answer `error` as the message with the
        code beside it in `code`. Every error has a code. See
        [Errors](/hub-api/errors).
      properties:
        ok:
          type: boolean
          description: Always false on error
        error:
          description: The message, or `{ code, message }` for an access denial.
          oneOf:
            - type: string
            - type: object
              required:
                - code
                - message
              properties:
                code:
                  type: string
                message:
                  type: string
        code:
          type: string
          description: Stable error code of an endpoint error.
        details:
          type: object
          additionalProperties: true
          description: Structured detail, when there is some.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: cliq_tok_* | cliq_dt_*
      description: >-
        User PAT (`cliq_tok_…`, including session-scoped) or realm token
        (`cliq_dt_…`).

````

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