# Rename a page

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

Change what a tab says.

The key the page was settled is left alone, so a browser link that already went out keeps working. Only the wording moves.

## 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.
- `page` (uuid, required): The id of the page.
- `label` (string, optional): What the tab says. Up to 255 characters. It cannot be null.

## Returns

The page as it now stands. A label another page of the version already reads answers 422.

- `data` (object): The page.
- `data.type` (string): Always structure_version_page. 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.key` (string): How the page is addressed in a browser link. It is settled when the page is added and survives every rename.
- `data.attributes.label` (string): What the tab says.
- `data.attributes.position` (integer): Where the tab sits, counting from 1.
- `data.attributes.sections` (array): The blocks placed on this page. Empty here, since these endpoints answer with the page itself rather than with what is on it. 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/pages/a1f7b3c8-6e42-4d09-8b57-1c9e0f2a4d36 \
  -X PUT \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "label": "Health"
  }'
```

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

## Response

`200`

```json
{
    "data": {
        "type": "structure_version_page",
        "id": "a1f7b3c8-6e42-4d09-8b57-1c9e0f2a4d36",
        "attributes": {
            "key": "medical",
            "label": "Medical",
            "position": 2,
            "sections": []
        }
    }
}
```
