## Move a block down

`POST /v1/pages/:pageId/blocks/:blockId/down`

Moves a block one position down in the page draft, swapping it with the neighbouring block below.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `pageId` (path) | number | yes | Page ID. List: [`GET /v1/pages`](/docs/entities/pages/list) |
| `blockId` (path) | number | yes | ID of a block in the draft of page `pageId`. List: [`GET /v1/pages/:pageId/blocks`](/docs/entities/pages/blocks/list) without the `version` parameter. A block from another page, a block in the trash and an ID from the published version return `404` |
| `scope` (query) | string | no | Site type: `KNOWLEDGE` — knowledge base, `GROUP` — workgroup site, `MAINPAGE` — main page. Omit the parameter for pages of other sites |

No body is needed: the call accepts an empty request or `{}`. Any field in the body is rejected with `400 INVALID_PARAMS`.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/pages/2417/blocks/29453/down" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/pages/2417/blocks/29453/down" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### JavaScript — personal key

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/2417/blocks/29453/down", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
  body: JSON.stringify({}),
})
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/pages/2417/blocks/29453/down", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN", "Content-Type": "application/json"},
  body: JSON.stringify({}),
})
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.pageId` | number | Page ID |
| `data.blockIds` | number[] | IDs of all draft blocks, hidden ones included, in page order after the move |

## Response example

```json
{
  "success": true,
  "data": {
    "pageId": 2417,
    "blockIds": [
      29451,
      29453,
      29455
    ]
  }
}
```

## Error response example

409 — the block is already last on the page:

```json
{
  "success": false,
  "error": {
    "code": "BLOCK_WRONG_SORT",
    "message": "Block cannot move beyond the page order."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 409 | `BLOCK_WRONG_SORT` | `Block cannot move beyond the page order.` — the block is already last on the page |
| 400 | `INVALID_PARAMS` | `Path ids must be positive safe integers.` — `pageId` or `blockId` is not a positive integer |
| 400 | `INVALID_PARAMS` | `Body must be a JSON object.` — the body is not a JSON object |
| 400 | `INVALID_PARAMS` | `Unsupported body field.` — the body contains any field |
| 400 | `FST_ERR_CTP_EMPTY_JSON_BODY` | The `Content-Type: application/json` header is sent with an empty body. Send a `{}` body or drop the header |
| 400 | `INVALID_SCOPE` | `scope must be KNOWLEDGE, GROUP or MAINPAGE, or omitted.` — `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |
| 404 | `ENTITY_NOT_FOUND` | `Blocks not found on this page.` — the block is not in the draft of page `pageId`: it belongs to another page, is in the trash, was deleted, the ID comes from the published version, or page `pageId` does not exist. The IDs of such blocks are listed in `error.blockIds` |
| 404 | `ENTITY_NOT_FOUND` | `Page or block not found.` — Bitrix24 did not find the page or block during the move |
| 422 | `BITRIX_NO_EFFECT` | `Bitrix24 returned an invalid block descriptor; the action cannot be confirmed.` — Bitrix24 returned a block descriptor that could not be parsed |
| 422 | `BITRIX_NO_EFFECT` | `Bitrix24 did not acknowledge the action.` — Bitrix24 did not confirm the move |
| 422 | `BITRIX_NO_EFFECT` | `Bitrix24 did not return the page block order.` — after the move, Bitrix24 did not return the block order |
| 422 | `BITRIX_NO_EFFECT` | `Bitrix24 returned an invalid block order.` — the block order contains an invalid ID |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the action. The error text comes from Bitrix24 |
| 403 | `SCOPE_DENIED` | The API key does not have the `landing` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only. The request is rejected before Bitrix24 is called |
| 403 | `BITRIX_ACCESS_DENIED` | The Bitrix24 user the key is issued for has no permission to edit the page |
| 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 | `LANDING_MODULE_NOT_ENABLED` | The Sites module is not available on the Bitrix24 account |
| 409 | `PORTAL_ADDRESS_CHANGED` | A self-hosted Bitrix24 moved to a new address, but the key's webhook was issued for the old one. Reissue the key's webhook |
| 429 | `RATE_LIMITED` | The Bitrix24 request limit is exceeded. Retry the request in 1-2 seconds |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 did not respond, returned a server error, or sent a response larger than 8 MiB |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time |

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

## Known specifics

- **Moving several positions is a move call.** To place a block right after a given block, call [`POST /v1/pages/:pageId/blocks/:blockId/move`](/docs/entities/pages/blocks/move) with `toPageId` equal to `pageId` and with `afterBlockId`.
- **A failure after the write does not cancel the shift.** Responses `422 BITRIX_NO_EFFECT`, `429`, `502` and `503` do not mean that the block stayed in place, and a retry shifts it again. Before retrying, re-read the page blocks with [`GET /v1/pages/:pageId/blocks`](/docs/entities/pages/blocks/list).
- **The call changes the page draft.** Site visitors see the change after the page is published with `POST /v1/pages/:id/publication`. See [Pages](/docs/entities/pages) for details.

## See also

- [Move a block up](/docs/entities/pages/blocks/up)
- [Move a block](/docs/entities/pages/blocks/move)
- [List page blocks](/docs/entities/pages/blocks/list)
- [Pages](/docs/entities/pages)
- [Errors](/docs/errors)
