# Move a section on its page

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

Put a block at a given place on its page, counting from 1.

Positions start again on each page, so this orders the block against the others on its own page and nothing else. Every one of them is numbered from 1 again afterwards, and a place past the end lands last.

## 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.
- `position` (integer, required): Where to put the block on its page, counting from 1.

## Returns

The placement with the place it now holds.

- `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/position \
  -X PUT \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "position": 1
  }'
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions/4/sections/904/position', {
  method: 'PUT',
  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    position: 1,
  }),
})
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/position', [
    'position' => 1,
]);
```

## 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": []
        }
    }
}
```
