# Change a placement

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

Change what a block is headed here and whether it starts folded shut.

This touches the placement and never the section. The section keeps its name, its fields and its version, and every other template placing it is unaffected.

Sending title_override as null goes back to the name of the section.

## 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.
- `title_override` (string, optional): What to head the block here, or null to use the name of the section.
- `is_collapsed_by_default` (boolean, optional): Whether the block starts folded shut. It cannot be null.

## Returns

The placement as it now stands.

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

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

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