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

# Get a hug bundle file

> Returns one file of a stored hug bundle — its bytes, with its content type, cached for a year
(a bundle never changes: it is named by its hash). Public: a bundle is a hug's built page and
holds no Hug data. The Hub serves hug pages from its content host at `/hb/<sha256>/<path>`
through this endpoint.

No authentication: anyone can call this.



## OpenAPI

````yaml /openapi/hub-by-tag/hub-hugs.yaml post /v1/hug_bundles/get_file
openapi: 3.0.3
info:
  title: 'CliqHub API: Hugs'
  version: 1.0.0
  description: >-
    A Hug is a run asking people for input: an agent (a review gate, or its own
    `ctx.ask`) opens

    one with a **hug** — the page people answer on — naming it and its bundle's
    hash, with the hug's

    params, the upload slots answers may use and the run files the page may
    show. The built-in hugs

    are `form` (ask for answers) and `approval` (approve or reject); teams bring
    their own. CliqHub

    posts it to the Hug's channels; anyone it reaches who can view runs in the
    realm answers on the

    Hug page, where the hug's page runs in a sandboxed frame, and can change
    their answer while it is

    open. CliqHub doesn't interpret answers: each is sent back to the agent as
    key-values, and the

    agent checks it against the hug's definition, decides when it has heard
    enough and closes the

    Hug. It expires after its time (at most 7 days).


    Seeing a Hug needs `runs.view` on its realm; answering also needs the Hug to
    be addressed to

    you (your own channel, or one of its shared channels). `create`, `close` and
    `get_events` are

    for daemons only; `hug_bundles/get_file` serves hug pages to anyone.
servers:
  - url: https://{host}
    variables:
      host:
        default: cliqhub.io
        description: CliqHub host
security: []
tags:
  - name: Hugs
    description: >-
      A Hug is a run asking people for input: an agent (a review gate, or its
      own `ctx.ask`) opens

      one with a **hug** — the page people answer on — naming it and its
      bundle's hash, with the hug's

      params, the upload slots answers may use and the run files the page may
      show. The built-in hugs

      are `form` (ask for answers) and `approval` (approve or reject); teams
      bring their own. CliqHub

      posts it to the Hug's channels; anyone it reaches who can view runs in the
      realm answers on the

      Hug page, where the hug's page runs in a sandboxed frame, and can change
      their answer while it is

      open. CliqHub doesn't interpret answers: each is sent back to the agent as
      key-values, and the

      agent checks it against the hug's definition, decides when it has heard
      enough and closes the

      Hug. It expires after its time (at most 7 days).


      Seeing a Hug needs `runs.view` on its realm; answering also needs the Hug
      to be addressed to

      you (your own channel, or one of its shared channels). `create`, `close`
      and `get_events` are

      for daemons only; `hug_bundles/get_file` serves hug pages to anyone.
paths:
  /v1/hug_bundles/get_file:
    post:
      tags:
        - Hugs
      summary: Get a hug bundle file
      description: >-
        Returns one file of a stored hug bundle — its bytes, with its content
        type, cached for a year

        (a bundle never changes: it is named by its hash). Public: a bundle is a
        hug's built page and

        holds no Hug data. The Hub serves hug pages from its content host at
        `/hb/<sha256>/<path>`

        through this endpoint.


        No authentication: anyone can call this.
      operationId: POST_v1_hug_bundles_get_file
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sha256:
                  type: string
                  pattern: ^[0-9a-f]{64}$
                  description: The bundle's hash.
                path:
                  type: string
                  minLength: 1
                  maxLength: 300
                  description: >-
                    The file's path inside the bundle (`index.html`,
                    `assets/main.js`).
              required:
                - sha256
                - path
            examples:
              default:
                value:
                  sha256: >-
                    9f2c4e1a7b3d5f6e8a0c2e4f6a8b0d2c4e6f8a0b2c4d6e8f0a1b3c5d7e9f1a2b
                  path: index.html
      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: string
                    format: binary
              example:
                ok: true
                data: <!doctype html><html>…</html>
        '404':
          description: '`not_found`: CliqHub holds no such bundle, or no such file in it.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                not_found:
                  summary: not_found
                  value:
                    ok: false
                    error: Bundle file not found
                    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: 'sha256: 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: []
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.

````

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