## List page templates

`GET /v1/page-templates`

Returns the templates used to create a site page. Pass the template code when you create a page from a template.

## Parameters

| Parameter | Type | Required | Default | Description |
|----------|-----|:-----:|-----------|----------|
| `siteType` (query) | string | no | `page` | Site type to return templates for: `page` — landing page, `knowledge` — knowledge base, `group` — group knowledge base. An empty or whitespace-only string is rejected with `400 INVALID_PARAMS`. A value that matches no template returns an empty array |
| `scope` (query) | string | no | — | Internal landing scope: `KNOWLEDGE` — knowledge base, `GROUP` — group knowledge base, `MAINPAGE` — main page. Omit it for a regular site |

The list is returned in full, without pagination.

## Examples

### curl — personal key

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/page-templates?siteType=page" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/page-templates?siteType=page" \
  -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/page-templates?siteType=page", {
  method: "GET",
  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/page-templates?siteType=page", {
  method: "GET",
  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 | Always `true` on success |
| `data` | array | Page templates |
| `data[].code` | string | Template code for the `templateCode` field when [creating a page from a template](/docs/entities/pages/from-template). A code without `/` or `@` is a standalone template, for example `empty` — a blank page. A code with `/` is a page from a set, for example `wiki-dark/main`. A code with `@` is a template from an application, where the part before `@` matches `appCode` |
| `data[].title` | string | Template name in the language of the Bitrix24 account |
| `data[].description` | string | Template description. An empty string if there is no description |
| `data[].siteType` | string | Site type the template is intended for, in upper case: `PAGE`, `KNOWLEDGE`, `GROUP`. Mirrors the requested `siteType` |
| `data[].available` | boolean | Whether a page can be created from this template |
| `data[].appCode` | string | Code of the application that added the template. Absent for templates without an application |
| `data[].previewUrl` | string | Preview image URL. Either a full URL with `https://` or a scheme-relative URL starting with `//`. Absent if the template has no preview |

## Response example

The example shows two templates from the full list:

```json
{
  "success": true,
  "data": [
    {
      "code": "empty",
      "title": "Blank page",
      "description": "Build your own site from scratch and attract customers!",
      "siteType": "PAGE",
      "available": true,
      "previewUrl": "//example.bitrix24.com/bitrix/components/bitrix/landing.demo/data/page/empty/preview.jpg"
    },
    {
      "code": "requisites/main",
      "title": "Business card site",
      "description": "Find all the information you need about our company",
      "siteType": "PAGE",
      "available": true
    }
  ]
}
```

## Error response example

400 — `scope` is not one of the allowed values:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_SCOPE",
    "message": "scope must be KNOWLEDGE, GROUP or MAINPAGE, or omitted."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `siteType must be a non-empty string, for example page.` — `siteType` is empty or whitespace-only |
| 400 | `INVALID_SCOPE` | `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |
| 422 | `BITRIX_NO_EFFECT` | `Bitrix24 did not return page templates.` — Bitrix24 did not return the template list |
| 422 | `BITRIX_NO_EFFECT` | `Bitrix24 returned an invalid template descriptor.` — the template code in the Bitrix24 response is missing or is not a string |
| 403 | `SCOPE_DENIED` | The API key does not have the `landing` scope |
| 403 | `BITRIX_ACCESS_DENIED` | The Bitrix24 user on whose behalf the key was issued has no access to sites |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `INVALID_API_KEY` | The key in `X-Api-Key` is not found or has been revoked |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 409 | `PORTAL_ADDRESS_CHANGED` | The on-premise Bitrix24 moved to a new address, while the key's webhook was issued for the old one. Reissue the key's webhook |
| 429 | `RATE_LIMITED` | Bitrix24 request limit exceeded. Retry the request in 1-2 seconds |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 did not respond or returned a server error |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond within the allotted time. The read can be retried |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- **A template code is bound to the site type.** A code works only for a site of the type you requested it for in `siteType`.
- **Unknown query parameters are ignored.** A parameter the method does not recognize causes no error and does not change the result.

## See also

- [Create a page from a template](/docs/entities/pages/from-template)
- [Pages](/docs/entities/pages)
- [Layout templates](/docs/entities/site-templates)
- [Error codes](/docs/errors)
