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

# Open a review

> An agent opens a review for its run (through its daemon). CliqHub notifies the reviewers:
the `reviewers` groups (each a policy `any` or `all` and a list of channels or usernames),
or the realm's members when none are given. `mode` is `verdict` (default, a decision),
`chat` (a conversation, starting with `initial_message`) or `input_pause` (a form to fill
in). The review expires after `timeout_minutes` (default 240). Answers `201`.

Requires a daemon's realm token (`cliq_dt_…`) for the realm given by `realm_id`.



## OpenAPI

````yaml /openapi/hub-by-tag/hub-reviews.yaml post /v1/reviews/create
openapi: 3.0.3
info:
  title: 'CliqHub API: Reviews'
  version: 1.0.0
  description: >-
    Human-in-the-loop (HUG) reviews. When a team reaches a review phase, the
    agent opens a

    review; CliqHub notifies the reviewers (people and channels named in the
    team or at run

    start) and shows the review in their inbox. A reviewer reads it, can chat
    with the agent,

    and gives a verdict (`PASS`, `REJECT` or `ROUTE:<phase>`); with an `all`
    policy every group

    must answer first. The agent then picks up the decision and acknowledges it.


    A review is `pending`, then `decided`, then `completed` once the agent
    acknowledged it, or

    `expired` when nobody answered in time (4 hours by default).
servers:
  - url: https://{host}
    variables:
      host:
        default: cliqhub.io
        description: CliqHub host
security: []
tags:
  - name: Reviews
    description: >-
      Human-in-the-loop (HUG) reviews. When a team reaches a review phase, the
      agent opens a

      review; CliqHub notifies the reviewers (people and channels named in the
      team or at run

      start) and shows the review in their inbox. A reviewer reads it, can chat
      with the agent,

      and gives a verdict (`PASS`, `REJECT` or `ROUTE:<phase>`); with an `all`
      policy every group

      must answer first. The agent then picks up the decision and acknowledges
      it.


      A review is `pending`, then `decided`, then `completed` once the agent
      acknowledged it, or

      `expired` when nobody answered in time (4 hours by default).
paths:
  /v1/reviews/create:
    post:
      tags:
        - Reviews
      summary: Open a review
      description: >-
        An agent opens a review for its run (through its daemon). CliqHub
        notifies the reviewers:

        the `reviewers` groups (each a policy `any` or `all` and a list of
        channels or usernames),

        or the realm's members when none are given. `mode` is `verdict`
        (default, a decision),

        `chat` (a conversation, starting with `initial_message`) or
        `input_pause` (a form to fill

        in). The review expires after `timeout_minutes` (default 240). Answers
        `201`.


        Requires a daemon's realm token (`cliq_dt_…`) for the realm given by
        `realm_id`.
      operationId: POST_v1_reviews_create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                run_id:
                  type: string
                  minLength: 1
                  description: The run asking.
                daemon_id:
                  type: string
                  minLength: 1
                  description: The daemon running it.
                realm_id:
                  type: string
                  minLength: 1
                  description: The run's realm.
                payload:
                  type: object
                  additionalProperties: true
                  description: >-
                    What the reviewer sees and answers (title, message, fields,
                    artifacts).
                route_targets:
                  type: array
                  items:
                    type: string
                  description: >-
                    Phases a reviewer may send the run back to with
                    `ROUTE:<phase>`.
                timeout_minutes:
                  type: number
                  minimum: 1
                  maximum: 10080
                  description: Minutes until the review expires (1 to 10080). Default 240.
                remind_every_minutes:
                  type: integer
                  minimum: 1
                  maximum: 10080
                  description: >-
                    Remind reviewers this often while pending. Default no
                    reminders.
                reviewers:
                  type: array
                  items:
                    type: object
                    properties:
                      policy:
                        type: string
                        enum:
                          - any
                          - all
                      channels:
                        type: array
                        items:
                          type: string
                          minLength: 1
                        minItems: 1
                    required:
                      - policy
                      - channels
                  description: >-
                    Reviewer groups: `{ policy: any | all, channels: [channel or
                    username] }`.
                mode:
                  type: string
                  enum:
                    - input_pause
                    - verdict
                    - chat
                  description: '`verdict` (default), `chat` or `input_pause`.'
                initial_message:
                  type: string
                  maxLength: 10
                  description: 'chat: the agent''s first message.'
              required:
                - run_id
                - daemon_id
                - realm_id
                - payload
            examples:
              default:
                value:
                  run_id: 0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f
                  daemon_id: 7d1c2b3a-4e5f-4a6b-8c7d-9e0f1a2b3c4d
                  realm_id: 5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b
                  payload:
                    title: Approve the fix
                    message: 3 findings fixed; approve to merge.
                  route_targets:
                    - fix
                  reviewers:
                    - policy: any
                      channels:
                        - sshah
      responses:
        '201':
          description: Created.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                    description: Always `true` on success.
                  data:
                    type: object
                    properties:
                      review_id:
                        type: string
                      review_url:
                        type: string
                        description: Link to the review in the console.
              example:
                ok: true
                data:
                  review_id: 4a3b2c1d-0e9f-4a8b-9c7d-6e5f4a3b2c1d
                  review_url: >-
                    https://cliqhub.io/reviews/4a3b2c1d-0e9f-4a8b-9c7d-6e5f4a3b2c1d
        '400':
          description: >-
            `bad_request`: A group uses policy `all` in `chat` or `input_pause`
            mode, or there are no reviewers and the realm has no members.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                bad_request:
                  summary: bad_request
                  value:
                    ok: false
                    error: >-
                      No reviewers configured and realm has no user members —
                      cannot create review
                    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 but your role there is too low or
            lacks the required permission.


            `forbidden`: A daemon token named a daemon outside its realm.
          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: >-
                      Daemon '7d1c2b3a-4e5f-4a6b-8c7d-9e0f1a2b3c4d' is not a
                      member of this realm
                    code: forbidden
        '404':
          description: >-
            `not_found`: The realm does not exist, was deleted, or you are not a
            member of it (404 rather than 403, so its existence is not
            revealed).


            `not_found`: The run is not in `realm_id`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                not_found:
                  summary: not_found
                  value:
                    ok: false
                    error:
                      code: not_found
                      message: Not found
                not_found (endpoint):
                  summary: not_found (endpoint)
                  value:
                    ok: false
                    error: Run not found in this realm
                    code: 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: 'run_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.