# Move a section to another page

`PUT /api/v1/templates/{template}/versions/{version}/sections/{section}/page`

Move a block from one tab of a draft to another.

The block lands last on the page it arrives at, and the page it left is numbered from 1 again. The section is untouched: only where it sits changes.

The page has to belong to the same version. One from another version, or another template, answers 404.

## Parameters

- `template` (uuid, required): The id of the template. A path that is not a uuid answers 404 without a query being run, so neither the slug nor a sequential number reaches anything here.
- `version` (integer, required): The number of the version within its template, counting from 1, which is the number shown in the version history and the number a change note refers to. It is not a row id, so version 1 of one template and version 1 of another are different things reached through different templates.
- `section` (integer, required): The id of the placement, which is not the id of the section. It is the id a placement comes back with when a version is read.
- `page_id` (uuid, required): The page to move it to, which has to be a page of this version.

## Returns

The placement, now on its new page.

- `data` (object): The placement.
- `data.type` (string): Always structure_version_section. It names the kind of record, so a caller holding several kinds can tell them apart without looking at where they came from.
- `data.id` (string): The id of this record, as a string even when it reads as a number. It is what every endpoint naming this record takes.
- `data.attributes` (object): Everything the record holds.
- `data.attributes.position` (integer): Where the block sits on its page, counting from 1 again on each page.
- `data.attributes.title` (string): What the block is headed: the override when there is one, and the name of the section otherwise. It is what to show a reader.
- `data.attributes.title_override` (string): The heading chosen for this placement alone, or null when the section name is used. What a section is called here belongs to the assembly rather than to the section.
- `data.attributes.section_id` (string): The id of the reusable section behind the placement. The same section may appear in several templates and in several versions of one template.
- `data.attributes.section_name` (string): What the section is called in the section library.
- `data.attributes.section_version_number` (integer): Which version of the section is placed here. A placement names a version and not a section, which is what stops a change made through another template reaching this one.
- `data.attributes.section_version_status` (string): One of draft, published or retired, for the section version rather than the template version. A template version cannot be published while a section it carries is still a draft.
- `data.attributes.is_collapsed_by_default` (boolean): Whether the block starts folded shut when somebody opens the record.
- `data.attributes.fields` (array): What the section collects. Empty here, since these endpoints answer with the placement rather than with the section contents. Read the version to get the whole structure.

## Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in `X-RateLimit-Remaining`.

## Request

```sh
curl https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions/4/sections/904/page \
  -X PUT \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "page_id": "a1f7b3c8-6e42-4d09-8b57-1c9e0f2a4d36"
  }'
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions/4/sections/904/page', {
  method: 'PUT',
  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    page_id: 'a1f7b3c8-6e42-4d09-8b57-1c9e0f2a4d36',
  }),
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->put('https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions/4/sections/904/page', [
    'page_id' => 'a1f7b3c8-6e42-4d09-8b57-1c9e0f2a4d36',
]);
```

## Response

`200`

```json
{
    "data": {
        "type": "structure_version_section",
        "id": "904",
        "attributes": {
            "position": 1,
            "title": "Where they live",
            "title_override": "Where they live",
            "section_id": "d5e8c012-9a34-4b76-8f21-3e7c5a0b1d94",
            "section_name": "Address",
            "section_version_number": 2,
            "section_version_status": "published",
            "is_collapsed_by_default": false,
            "fields": []
        }
    }
}
```
