[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fsites\u002Fpreview":3,"docs-tabs-entities\u002Fsites\u002Fpreview":6},{"content":4,"lastmod":5},"## Site preview\n\n`GET \u002Fv1\u002Fsites\u002F:id\u002Fpreview`\n\nReturns the URL of the preview image for the site's home page. Use it to show a site thumbnail in a list or a card.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `id` (path) | number | yes | Site ID. List: [`GET \u002Fv1\u002Fsites`](\u002Fdocs\u002Fentities\u002Fsites\u002Flist) |\n| `scope` (query) | string | no | Site type: `KNOWLEDGE` — knowledge base, `GROUP` — workgroup site, `MAINPAGE` — home page. Omit the parameter for all other sites |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F42\u002Fpreview\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F42\u002Fpreview\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F42\u002Fpreview', {\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n  },\n})\n\nconst { data } = await res.json()\nif (data.previewUrl === null) {\n  console.log('The site has no preview')\n}\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fsites\u002F42\u002Fpreview', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data } = await res.json()\nif (data.previewUrl === null) {\n  console.log('The site has no preview')\n}\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | `true` on success |\n| `data.previewUrl` | string \\| null | URL of the preview image. Either a full URL or a path from the site root, for example `\u002Fpreview.jpg`. Prefix the path with the site's public address from [`GET \u002Fv1\u002Fsites\u002F:id\u002Fpublic-url`](\u002Fdocs\u002Fentities\u002Fsites\u002Fpublic-url). A protocol-relative URL `\u002F\u002Fhost\u002F...` is expanded to `https:\u002F\u002Fhost\u002F...`. `null` — the site has no preview |\n\n## Response example\n\nThe preview is given as a path from the site root:\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"previewUrl\": \"\u002Fpreview.jpg\"\n  }\n}\n```\n\nThe site has no preview:\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"previewUrl\": null\n  }\n}\n```\n\n## Error response example\n\n404 — the site does not exist or is not visible to the key:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"Site not found or not visible\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `INVALID_PARAMS` | `id` is not a positive integer |\n| 400 | `INVALID_SCOPE` | `scope` is not one of `KNOWLEDGE`, `GROUP`, `MAINPAGE` |\n| 404 | `ENTITY_NOT_FOUND` | No site with this `id` exists, or it is not visible to the key. A knowledge base, workgroup site or home page requires the `scope` parameter. An ordinary site requested with `scope` also returns `404` |\n| 409 | `LANDING_MODULE_NOT_ENABLED` | The Sites module is unavailable on the Bitrix24 account |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned the preview as something other than a string, or rejected the request. The reason is in `message` |\n| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access: the key's user is not an administrator, or the feature is unavailable on the Bitrix24 account |\n| 403 | `SCOPE_DENIED` | The key lacks the `landing` scope |\n| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens configured |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- **The `\u002Fpreview.jpg` path may lead to a placeholder.** On the Bitrix24 account we tested, 26 of 27 sites returned `\u002Fpreview.jpg`, and for all of them that path opened the same \"preview in progress\" image rather than a snapshot of the page. To tell a real preview from the placeholder, compare the image contents.\n\n## See also\n\n- [Site public URL](\u002Fdocs\u002Fentities\u002Fsites\u002Fpublic-url)\n- [Get a site](\u002Fdocs\u002Fentities\u002Fsites\u002Fget)\n- [Site list](\u002Fdocs\u002Fentities\u002Fsites\u002Flist)\n- [Sites](\u002Fdocs\u002Fentities\u002Fsites)\n- [Errors](\u002Fdocs\u002Ferrors)\n","2026-10-19",{},1795415302042]