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

# Search run logs

> Searches the log lines of runs in a realm: full-text `q`, and filters by level, run,
daemon, workspace, team, kind of line (`concerns`) and time. Returns a page of lines
(50 by default) plus counts per filter value (`facets`) for building filter menus.
`realm_id` is required, except for site administrators searching all realms.

Requires a signed-in user token; with `realm_id`, a realm member (or higher) with the `runs.view` permission on that realm. With neither, the results are limited to what you can see.



## OpenAPI

````yaml /openapi/hub-by-tag/hub-runs.yaml post /v1/runs/get_logs
openapi: 3.0.3
info:
  title: 'CliqHub API: Runs'
  version: 1.0.0
  description: >-
    Runs of a team on a daemon. People start runs (Start a run), follow them
    (Get a run, Stream

    run activity, Search run logs, Get run telemetry), and control them (Cancel
    a run, Resume a

    run, Supply run inputs). CliqHub hands each control to the run's daemon,
    which must be

    online: when it is not, the call fails with a `run/daemon_offline` or
    `run/daemon_stranded`

    conflict (cancel instead marks the run cancelled on CliqHub).


    Daemons report what happens during a run through the other endpoints here,
    with their realm

    token: Record a new run, Update run status, Complete a run, and three
    separate channels for

    run activity (the live timeline), run telemetry (token usage and traces) and
    run logs (text).
servers:
  - url: https://{host}
    variables:
      host:
        default: cliqhub.io
        description: CliqHub host
security: []
tags:
  - name: Runs
    description: >-
      Runs of a team on a daemon. People start runs (Start a run), follow them
      (Get a run, Stream

      run activity, Search run logs, Get run telemetry), and control them
      (Cancel a run, Resume a

      run, Supply run inputs). CliqHub hands each control to the run's daemon,
      which must be

      online: when it is not, the call fails with a `run/daemon_offline` or
      `run/daemon_stranded`

      conflict (cancel instead marks the run cancelled on CliqHub).


      Daemons report what happens during a run through the other endpoints here,
      with their realm

      token: Record a new run, Update run status, Complete a run, and three
      separate channels for

      run activity (the live timeline), run telemetry (token usage and traces)
      and run logs (text).
paths:
  /v1/runs/get_logs:
    post:
      tags:
        - Runs
      summary: Search run logs
      description: >-
        Searches the log lines of runs in a realm: full-text `q`, and filters by
        level, run,

        daemon, workspace, team, kind of line (`concerns`) and time. Returns a
        page of lines

        (50 by default) plus counts per filter value (`facets`) for building
        filter menus.

        `realm_id` is required, except for site administrators searching all
        realms.


        Requires a signed-in user token; with `realm_id`, a realm member (or
        higher) with the `runs.view` permission on that realm. With neither, the
        results are limited to what you can see.
      operationId: POST_v1_runs_get_logs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                realm_id:
                  type: string
                  description: Realm to search. Required except for site administrators.
                realm_ids:
                  type: array
                  items:
                    type: string
                  maxItems: 200
                  description: >-
                    Site administrators only. Search several realms (for example
                    one organization's).
                q:
                  type: string
                  description: Text to search for in the log messages.
                levels:
                  type: array
                  items:
                    type: string
                  description: Only these levels.
                run_ids:
                  type: array
                  items:
                    type: string
                  description: Only these runs.
                daemon_ids:
                  type: array
                  items:
                    type: string
                  description: Only these daemons.
                workspace_ids:
                  type: array
                  items:
                    type: string
                  description: Only these workspaces.
                teams:
                  type: array
                  items:
                    type: string
                  description: Only these teams (`@scope/slug`).
                concerns:
                  type: array
                  items:
                    type: string
                  description: >-
                    Only these kinds of line: `run`, `system`, `command`,
                    `http`. Default all.
                since_ms:
                  type: number
                  description: Only lines at or after this time (epoch milliseconds).
                until_ms:
                  type: number
                  description: Only lines before this time (epoch milliseconds).
                offset:
                  type: integer
                  description: Lines to skip, for paging.
                limit:
                  type: integer
                  minimum: 1
                  description: Page size. Default 50.
            examples:
              default:
                value:
                  realm_id: 5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b
                  q: timeout
                  levels:
                    - error
                  limit: 20
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - lines
                  - total
                  - facets
                  - realm
                  - offset
                  - limit
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                    description: Always `true` on success.
                  lines:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        run_id:
                          type: string
                        run_name:
                          type: string
                          nullable: true
                        created_at:
                          type: number
                          description: Epoch milliseconds.
                        level:
                          type: string
                          description: >-
                            Log level of the line (for example `info`, `warn`,
                            `error`).
                        message:
                          type: string
                        daemon_id:
                          type: string
                          nullable: true
                        daemon_name:
                          type: string
                          nullable: true
                        workspace_id:
                          type: string
                          nullable: true
                        workspace_name:
                          type: string
                          nullable: true
                        team:
                          type: string
                          nullable: true
                          description: '`@scope/slug`.'
                        realm_id:
                          type: string
                          nullable: true
                        realm_slug:
                          type: string
                          nullable: true
                        org_slug:
                          type: string
                          nullable: true
                        concern:
                          type: string
                          nullable: true
                          description: '`run`, `system`, `command` or `http`.'
                  total:
                    type: number
                    description: Matching lines across all pages.
                  facets:
                    type: object
                    description: >-
                      For each filter (`level`, `daemon_id`, `team`, `run_id`,
                      `workspace_id`, `concern`, `realm_id`), the values present
                      with a label and a count.
                    additionalProperties:
                      type: array
                      items:
                        type: object
                        properties:
                          value:
                            type: string
                          label:
                            type: string
                          count:
                            type: number
                  realm:
                    type: object
                    properties:
                      id:
                        type: string
                      name:
                        type: string
                        nullable: true
                      slug:
                        type: string
                        nullable: true
                  offset:
                    type: number
                  limit:
                    type: number
              example:
                ok: true
                lines:
                  - id: 1b2c3d4e-5f60-4718-9a2b-3c4d5e6f7a8b
                    run_id: 0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f
                    run_name: brave-otter
                    created_at: 1759834470000
                    level: error
                    message: 'npm test: request timeout after 30s'
                    daemon_id: 7d1c2b3a-4e5f-4a6b-8c7d-9e0f1a2b3c4d
                    daemon_name: build-01
                    workspace_id: 9b2e6f10-4c3a-4e7d-8f21-6a5b4c3d2e1f
                    workspace_name: acme-api
                    team: '@acme/code-review'
                    realm_id: 5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b
                    realm_slug: production
                    org_slug: acme
                    concern: run
                total: 1
                facets:
                  level:
                    - value: error
                      count: 1
                  team:
                    - value: '@acme/code-review'
                      count: 1
                realm:
                  id: 5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b
                  name: Production
                  slug: production
                offset: 0
                limit: 20
        '400':
          description: >-
            `bad_request`: `realm_id` was not sent and the caller is not a site
            administrator.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                bad_request:
                  summary: bad_request
                  value:
                    ok: false
                    error: realm_id is required
                    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.
          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
        '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 field is
            missing or has the wrong type. `details.issues` lists each problem.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                invalid_params:
                  summary: invalid_params
                  value:
                    ok: false
                    error: Required
                    code: invalid_params
                    details:
                      issues:
                        - field: realm_id
                          message: Required
        '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.