## Read a catalog sample

`GET /v1/block-repository/:code/content`

Returns {code,html}, the HTML sample from the catalog. A missing sample returns 404. Codes may contain dots, colon and @; URL-encode the path component with encodeURIComponent(code). Application blocks repo_N are read from this portal repository.

Requires the `landing` scope. READONLY keys can read. Optional query `scope=KNOWLEDGE|GROUP|MAINPAGE` selects the page context. No body is accepted by the contract. Credential-bearing strings are replaced with `[REDACTED]`, including the entire HTML string if needed. The Bitrix24 response is bounded to 8 MiB; exceeding the limit returns 502.


The content method does not resolve the bitrix: prefix (404); use an unprefixed code for content. The manifest method accepts the prefix.

## Request parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `code` | string | yes | Non-empty URL-encoded block code, for example `01.big_with_text_3` or `repo_12`. |
| `scope` | string | no | KNOWLEDGE, GROUP or MAINPAGE; omit for an ordinary site. |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/block-repository/01.big_with_text_3/content" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/block-repository/01.big_with_text_3/content" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/block-repository/01.big_with_text_3/content", {
  headers: {"X-Api-Key": "YOUR_API_KEY"},
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)
```

### JavaScript — OAuth application

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/block-repository/01.big_with_text_3/content", {
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN"},
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)
```

## Response fields

| Field | Type | Description |
|---|---|---|
| `success` | boolean | true |
| `data` | object | Operation result. |
| `data.code` | string | Requested code. |
| `data.html` | string | HTML catalog sample; may be [REDACTED]. |

## Response

```json
{
  "success": true,
  "data": {
    "code": "01.big_with_text_3",
    "html": "<section>Sample</section>"
  }
}
```

## Errors

| HTTP | Code | Condition |
|---|---|---|
| 400 | `INVALID_PARAMS` | Invalid pageId/blockId or blank code. |
| 400 | `INVALID_SCOPE` | Invalid scope. |
| 401 | `TOKEN_MISSING` | No Bitrix24 credentials. |
| 403 | `SCOPE_DENIED` | Key lacks landing scope. |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 user lacks permission. |
| 404 | `ENTITY_NOT_FOUND` | Block not in this page, missing sample or manifest file. |
| 409 | `LANDING_MODULE_NOT_ENABLED` | The Sites module is unavailable on this Bitrix24 account. |
| 422 | `BITRIX_ERROR` | Bitrix24 business refusal; message preserved. |
| 502 | `BITRIX_INVALID_RESPONSE` | Unexpected result or Bitrix24 response exceeds 8 MiB. |

[All system errors](/docs/errors).

## See also

- [Pages](/docs/entities/pages)
- [Read block content](/docs/entities/pages/block-content)
- [Catalog manifest](/docs/entities/pages/catalog-manifest)
