
## Page templates

`GET /v1/page-templates`

Lists codes for creating a page from a template. A code can be `empty` or an application code containing @. Check available and the site type before creating a page.

Requires the `landing` scope. Available to a READONLY key.

## Request parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `scope` | string | no | Query: KNOWLEDGE, GROUP or MAINPAGE; omit for an ordinary site. |
| `siteType` | string | no | Query: template type, default page; must match the site. |

## 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 | true |
| `data` | array | Operation result. |
| `data[].code` | string | Template code. |
| `data[].title` | string | title |
| `data[].description` | string | description |
| `data[].siteType` | string | siteType |
| `data[].available` | boolean | Whether the template is available. |
| `data[].appCode` | string | Optional application code. |
| `data[].previewUrl` | string | Optional preview address; credential URLs are redacted. |

```json
{
  "success": true,
  "data": [
    {
      "code": "empty",
      "title": "Empty",
      "description": "",
      "siteType": "PAGE",
      "available": true
    }
  ]
}
```

## Errors

| HTTP | Code | Condition |
|---|---|---|
| 400 | `INVALID_PARAMS` | Invalid body shape or parameter value. |
| 400 | `INVALID_SCOPE` | Invalid scope. |
| 401 | `TOKEN_MISSING` | No Bitrix24 credentials. |
| 403 | `SCOPE_DENIED` | The key lacks landing. |
| 403 | `BITRIX_ACCESS_DENIED` | The Bitrix24 user lacks permission. |
| 422 | `BITRIX_ERROR` | Bitrix24 business refusal; its message is preserved. |
| 422 | `BITRIX_NO_EFFECT` | Bitrix24 did not confirm the action or return the expected result. |

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

400 — invalid scope:

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

## See also

- [Pages](/docs/entities/pages)
- [Page templates](/docs/entities/page-templates)
