> ## 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}/content

> Read the current content of a block, as plain text for free blocks or as a structured payload for catalogue ones.

The last step of the drill-down: [assistants](/dev/endpoints/assistants-list) → [their blocks](/dev/endpoints/assistants-blocks-list) → **this block's content**.

Returns the content of whichever version the block currently points at, together with that version's id and number.

## Endpoint

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

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

## Example request

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

  ```js JavaScript theme={null}
  const resp = await fetch(
    "https://api.keebai.com/v1/blocks/6650bbbb2222cccc3333dddd/content",
    { headers: { Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}` } },
  );
  const { content } = await resp.json();

  // Free blocks carry text; catalogue blocks carry a structured payload.
  console.log(content.content ?? content.payload);
  ```

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

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

## Response

### 200 OK

A free block, which is anything written through this API:

```json theme={null}
{
  "content": {
    "block_id": "6650bbbb2222cccc3333dddd",
    "version_id": "6650ffff4444aaaa5555bbbb",
    "version_number": 4,
    "edit_mode": "free",
    "content": "1. Saludar y preguntar en qué puede ayudar.\n2. Preguntar el servicio.\n3. Ofrecer los horarios disponibles.",
    "created_at": "2026-07-26T09:44:03.512Z"
  }
}
```

A catalogue block, configured in the portal:

```json theme={null}
{
  "content": {
    "block_id": "6650bbbb2222cccc3333eeee",
    "version_id": "6650ffff4444aaaa5555cccc",
    "version_number": 12,
    "edit_mode": "assisted",
    "payload": {
      "products": { "source": "shopify", "product_ids": [], "visible_to_ai": true },
      "response_format": { "include_checkout_link": true }
    },
    "created_at": "2026-07-21T11:19:44.001Z"
  }
}
```

### 401 Unauthorized

Missing, invalid, revoked, or expired token.

### 403 Forbidden

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

### 404 Not Found

No block with that id in the token's company and project, or `error.code` is `BLOCK_CONTENT_NOT_FOUND` because the block has never been saved and has no current version.

### 502 Bad Gateway

The assistant service is unreachable.

## Operational notes

* **`edit_mode` tells you which field to read.** `free` gives you `content` as text and no `payload`; `assisted` gives you `payload` as an object and no `content`. Every block written through this API is `free`.
* **The `payload` of an assisted block is an opaque object** whose shape depends on the block type. It is returned as stored so you can inspect it, but it is not writable here — [saving those types](/dev/endpoints/blocks-content-save) returns `409`.
* **Rich formatting authored in the portal flattens to text.** Bold, italics, colours and inline function chips do not survive the round trip: you get the words, not the styling. If a block was carefully styled in the portal, prefer editing it there.
* **This reads the block's current version, which is not necessarily what a given assistant sees.** An assistant with a `pinned_version_id` renders that version instead; read it with [`GET /v1/blocks/{id}/versions/{versionId}`](/dev/endpoints/blocks-version-get).
* **`created_by` is never returned.** It is an internal user id.


## OpenAPI

````yaml GET /v1/blocks/{id}/content
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}/content:
    get:
      tags:
        - blocks
      summary: Leer el contenido de un bloque
      description: >-
        Devuelve el contenido de la version vigente. Los bloques libres vuelven
        como texto en content; los de catalogo, que solo edita el portal,
        vuelven como payload estructurado.
      operationId: PublicBlocksController_getContent
      parameters:
        - name: id
          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`.

````