> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keebai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GET /v1/blocks/{id}/versions/{versionId}

> Read the content of one historical version, so you can check it before restoring.

Returns the content of a specific version, in the same shape as [reading the current content](/dev/endpoints/blocks-content-get).

Two reasons to use it: checking what a [restore](/dev/endpoints/blocks-version-restore) would bring back, and reading the version an assistant is actually pinned to when that is not the current one.

## Endpoint

```
GET https://api.keebai.com/v1/blocks/{id}/versions/{versionId}
```

## Required scope

`assistants:read`

## Headers

| Header          | Required | Value                    |
| --------------- | -------- | ------------------------ |
| `Authorization` | Yes      | `Bearer kbai_pk_<token>` |

## Path parameters

| Parameter   | Type     | Description                                 |
| ----------- | -------- | ------------------------------------------- |
| `id`        | `string` | `ObjectId` of the block.                    |
| `versionId` | `string` | `ObjectId` of one of that block's versions. |

## Example request

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.keebai.com/v1/blocks/6650bbbb2222cccc3333dddd/versions/6650ffff4444aaaa5555bbbb \
    -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  ```

  ```js JavaScript theme={null}
  const base = "https://api.keebai.com/v1/blocks/6650bbbb2222cccc3333dddd";
  const auth = { Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}` };

  // Diff the current content against the previous version before restoring.
  const { data } = await (await fetch(`${base}/versions`, { headers: auth })).json();
  const previous = data.find((v) => !v.is_current);
  const { content } = await (
    await fetch(`${base}/versions/${previous._id}`, { headers: auth })
  ).json();
  ```

  ```python Python theme={null}
  import os, requests

  resp = requests.get(
      "https://api.keebai.com/v1/blocks/6650bbbb2222cccc3333dddd"
      "/versions/6650ffff4444aaaa5555bbbb",
      headers={"Authorization": f"Bearer {os.environ['KEEBAI_API_TOKEN']}"},
      timeout=10,
  )
  resp.raise_for_status()
  content = resp.json()["content"]
  ```
</CodeGroup>

## Response

### 200 OK

```json theme={null}
{
  "content": {
    "block_id": "6650bbbb2222cccc3333dddd",
    "version_id": "6650ffff4444aaaa5555bbbb",
    "version_number": 4,
    "edit_mode": "free",
    "content": "1. Saludar.\n2. Preguntar el servicio.",
    "created_at": "2026-07-26T09:44:03.512Z"
  }
}
```

### 401 Unauthorized

Missing, invalid, revoked, or expired token.

### 403 Forbidden

The token does not have the `assistants:read` scope.

### 404 Not Found

The block does not exist in the token's company and project, or `error.code` is `BLOCK_VERSION_NOT_FOUND` because the version does not exist **or belongs to a different block**.

### 502 Bad Gateway

The assistant service is unreachable.

## Operational notes

* **The version must belong to the block in the path.** A valid version id from another block of the same company is a `404`, not a redirect — the nesting is enforced, not decorative.
* **`edit_mode` decides the field**, same as the current-content endpoint: `free` gives you `content` as text, `assisted` gives you `payload` as an object.
* **Historical versions of catalogue blocks are readable.** The write restriction applies to saving, not to reading, so you can inspect the history of a `product_info` block even though you cannot edit it here.
* **Versions never expire and are never pruned.** Any id you have seen stays readable.


## OpenAPI

````yaml GET /v1/blocks/{id}/versions/{versionId}
openapi: 3.0.0
info:
  title: Keebai Public API
  description: Superficie pública REST autenticada con Personal Access Tokens (PAT).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.keebai.com
    description: Production
security: []
tags: []
paths:
  /v1/blocks/{id}/versions/{versionId}:
    get:
      tags:
        - blocks
      summary: Leer el contenido de una version
      description: >-
        El contenido de una version historica, para revisarla antes de
        restaurarla.
      operationId: PublicBlocksController_getVersion
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
        - name: versionId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicBlockContentEnvelopeDto'
      security:
        - PAT: []
components:
  schemas:
    PublicBlockContentEnvelopeDto:
      type: object
      properties:
        content:
          $ref: '#/components/schemas/PublicBlockContentDto'
      required:
        - content
    PublicBlockContentDto:
      type: object
      properties:
        content:
          type: string
          maxLength: 100000
          description: >-
            Contenido completo del bloque en texto. Reemplaza al anterior
            creando una version nueva.
          example: |-
            Sos el asistente de una barberia.
            - Tuteas al cliente.
      required:
        - content
  securitySchemes:
    PAT:
      scheme: bearer
      bearerFormat: kbai_pk_<hex>
      type: http
      description: >-
        Personal Access Token con prefijo `kbai_pk_`. Generar desde el portal
        con permiso `developer.manage_tokens`.

````