## Full site export

`GET /v1/sites/:id/export`

Exports an entire site as a single object: site settings, folders, system pages, pages and their blocks. Use it to back up a site or to move its structure elsewhere.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Site identifier — a positive integer. List: [`GET /v1/sites`](/docs/entities/sites/list) |
| `scope` (query) | string | no | Internal landing scope: `KNOWLEDGE` / `GROUP` / `MAINPAGE`. Specify it if the site belongs to the corresponding scope. Otherwise `404 ENTITY_NOT_FOUND` is returned. An ordinary site requested with `scope` also returns `404` |
| `hooksDisable` (query) | string | no | Comma-separated settings to leave out of the export. Use the full key names from `fields.ADDITIONAL_FIELDS`, for example `GACOUNTER_USE,COPYRIGHT_SHOW`. The key is removed from the site and from every page. An empty value or an empty code in the list is rejected with `400 INVALID_PARAMS` |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/sites/3/export" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/sites/3/export" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/3/export', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Pages in export:', Object.keys(data.items).length)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/3/export', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
```

## Response fields

Export keys come as is, not converted to camelCase: `site_code`, `show_in_list`, `ADDITIONAL_FIELDS`. When there is nothing to export, `data` is `{ "items": {} }`.

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | `true` on success |
| `data.code` | string | Code of the site's home page, same as `fields.LANDING_ID_INDEX` |
| `data.site_code` | string | Site symbolic code wrapped in slashes: `/docs-export-demo/` |
| `data.name` | string | Site name |
| `data.description` | string \| null | Site description. `null` or an empty string when not set |
| `data.type` | string | Site type in lowercase: `page`, `store` |
| `data.charset` | string | Site encoding |
| `data.preview`, `data.preview2x`, `data.preview3x`, `data.preview_url` | string | Site preview URLs. An empty string when there is no preview |
| `data.show_in_list` | string | Whether the site is shown in the list: `Y` / `N` |
| `data.version` | number | Version of the site's internal structure |
| `data.fields.TITLE` | string | Site title |
| `data.fields.LANDING_ID_INDEX` | string | Home page code — a key in `data.items` |
| `data.fields.LANDING_ID_404` | string \| null | Code of the 404 error page. `"0"` or `null` when no page is assigned |
| `data.fields.ADDITIONAL_FIELDS` | object \| array | Site settings: counters, fonts, theme, buttons. The key names are the ones `hooksDisable` accepts. An empty array `[]` when there are no settings |
| `data.layout` | object \| array | Site layout: `code` — layout code, for example `empty` or `header_footer`, `ref` — layout areas, where the key is the area number and the value is the code of the page holding its content. For a layout without areas, `ref` is an empty array. When no layout is set, `data.layout` is an empty array `[]` |
| `data.folders` | object | Site folders. The key is the code of one of the folder's pages, not the code of the folder itself. The value is an array of the codes of all pages in the folder |
| `data.syspages` | object \| array | Site system pages: the key is the page type, for example `catalog` or `order`, the value is the page code. An empty array `[]` when the site has no system pages |
| `data.items` | object | Site pages. The key is the page code |
| `data.items.<code>.old_id` | string | Page identifier — the same as `id` in [`GET /v1/pages/:id`](/docs/entities/pages/get). Comes as a string |
| `data.items.<code>.code`, `.name`, `.type`, `.show_in_list`, `.version` | — | The same fields as on the site, for the page |
| `data.items.<code>.fields` | object | Page title `TITLE`, URL rule `RULE` and page settings `ADDITIONAL_FIELDS` |
| `data.items.<code>.layout` | object \| array | Page layout in the same shape as `data.layout`, or an empty array `[]` |
| `data.items.<code>.items` | object \| array | Blocks of the published version of the page. The key is `#block<id>`. A page without blocks and an unpublished page have an empty array `[]` |
| `data.items.<code>.items.<block>.old_id` | number | Block identifier in the published version of the page |
| `data.items.<code>.items.<block>.code` | string | Block code from the block library |
| `data.items.<code>.items.<block>.nodes` | object | Block content. The key is an element selector, the value is an array of values. For a component block, the key is the component name and the value is an object of its parameters |
| `data.items.<code>.items.<block>.style` | object | Styling classes: element selector → array of classes |

Blocks can carry other keys as well — `anchor`, `cards`, `attrs`, `dynamic`, `repo_block`, `menu`. They are present when the block has the corresponding data.

## Response example

Export of a test site: the home page with a block and one of the two pages in a folder. The block is trimmed to one element in `nodes` and one in `style`.

```json
{
  "success": true,
  "data": {
    "charset": "UTF-8",
    "code": "docs-export-demo/home",
    "site_code": "/docs-export-demo/",
    "name": "Docs export demo",
    "description": null,
    "preview": "",
    "preview2x": "",
    "preview3x": "",
    "preview_url": "",
    "show_in_list": "Y",
    "type": "page",
    "version": 3,
    "fields": {
      "ADDITIONAL_FIELDS": [],
      "TITLE": "Docs export demo",
      "LANDING_ID_INDEX": "docs-export-demo/home",
      "LANDING_ID_404": null
    },
    "layout": [],
    "folders": {
      "docs-export-demo/shoes": [
        "docs-export-demo/shoes",
        "docs-export-demo/boots"
      ]
    },
    "syspages": [],
    "items": {
      "docs-export-demo/home": {
        "old_id": "2401",
        "code": "docs-export-demo/home",
        "name": "Home",
        "description": null,
        "preview": "",
        "preview2x": "",
        "preview3x": "",
        "preview_url": "",
        "show_in_list": "N",
        "type": "page",
        "version": 3,
        "fields": {
          "TITLE": "Home",
          "RULE": null,
          "ADDITIONAL_FIELDS": []
        },
        "layout": [],
        "items": {
          "#block29423": {
            "old_id": 29423,
            "code": "27.one_col_fix_title_and_text_2",
            "access": "X",
            "anchor": "b29421",
            "nodes": {
              ".landing-block-node-title": [
                "The Creative Team"
              ]
            },
            "style": {
              ".landing-block-node-title": [
                "landing-block-node-title js-animation fadeIn g-mb-20 g-color"
              ]
            }
          }
        }
      },
      "docs-export-demo/shoes": {
        "old_id": "2403",
        "code": "docs-export-demo/shoes",
        "name": "Shoes",
        "description": null,
        "preview": "",
        "preview2x": "",
        "preview3x": "",
        "preview_url": "",
        "show_in_list": "N",
        "type": "page",
        "version": 3,
        "fields": {
          "TITLE": "Shoes",
          "RULE": null,
          "ADDITIONAL_FIELDS": []
        },
        "layout": [],
        "items": []
      }
    }
  }
}
```

## Error response example

404 — site not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Site not found or not visible"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `id` is not a positive integer |
| 400 | `INVALID_PARAMS` | `hooksDisable` is empty or contains an empty code between commas |
| 400 | `INVALID_SCOPE` | `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |
| 404 | `ENTITY_NOT_FOUND` | No site with this `id`, the site is not accessible to the key's user, or it belongs to a different `scope` |
| 409 | `LANDING_MODULE_NOT_ENABLED` | The Sites module is unavailable on this Bitrix24 account. Ask a Bitrix24 account administrator to enable it — until then a retry returns the same refusal |
| 413 | `SITE_EXPORT_TOO_LARGE` | The export exceeds 8 MiB. The response is not truncated — this method cannot export the site as a whole |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the export or returned it in an unexpected form. The reason is in `message` |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access: the key's user is not an administrator, or the feature is unavailable on the Bitrix24 account |
| 403 | `SCOPE_DENIED` | The API key does not have the `landing` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |

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

## Known specifics

- **Strings with credentials are hidden.** If a string in the export contains a Bitrix24 REST webhook URL or an `auth`, `token`, `access_token`, `refresh_token` or `client_secret` parameter, the whole string is replaced with `[REDACTED]`. This also applies to object keys. When moving the site, set such values again.
- **The export is unavailable in batch requests.** [`POST /v1/batch`](/docs/batch) accepts only the `list`, `search`, `get`, `create`, `update`, `delete` and `fields` actions — export each site with a separate call.
- **Blocks of unpublished pages are not exported.** The page is included in the export, but its `items` is empty until the page is published with [`POST /v1/pages/:id/publication`](/docs/entities/pages). For a published page, blocks come from the published version, so their `old_id` values differ from the identifiers in the draft.
- **The response is large.** An export of a 13-page site is about 190 KB: `ADDITIONAL_FIELDS` and `nodes` hold the HTML markup of blocks and fonts. To shrink the response, leave out unneeded settings with `hooksDisable`.

## See also

- [Get a site](/docs/entities/sites/get)
- [Site settings](/docs/entities/sites/settings)
- [List pages](/docs/entities/pages/list)
- [Sites](/docs/entities/sites)
- [Batch](/docs/batch)
