# Change a possession tag

`PUT /api/v1/possession-tags/{possessionTag}`

Rename a possession tag or set its colour. Neither can be null.

Changing only the case of its own name is allowed. The change is written to the account log.

## Parameters

- `possessionTag` (uuid, required): The id of the possession tag. A tag belonging to somebody else answers 404.
- `name` (string, optional): The new name. Up to 50 characters. Markup and surrounding blank space are stripped, and a name left with nothing in it is refused. A name another tag of the account already has, ignoring case, is refused with “You already have a tag with this name.”
- `colour` (string, optional): One of the vault colours: #3f5fd0, #4f8a49, #9a6a24, #9a3f2b, #6b4fa8, #2f7f86, #a8447a or #4a4a52.

## Returns

The possession tag object as it now reads.

- `data` (object): The possession tag.
- `data.type` (string): Always possession_tag. 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.name` (string): What the tag reads, such as Insured or To sell.
- `data.attributes.colour` (string): One of the eight vault colours, as a hexadecimal value.
- `data.attributes.created_at` (timestamp): When the tag was added, as a count of seconds since 1970.
- `data.attributes.updated_at` (timestamp): When its name or colour last changed, as a count of seconds, or null.
- `data.links` (object): Where to find this record.
- `data.links.self` (string): The absolute address this record is read from.
- `data.links.web` (string): The settings screen where the tags of the account are managed, which opens for somebody signed in rather than for a key. It is the link to give a person.

## 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/possession-tags/7a3e9c15-2b84-4d60-9f17-c5e8a2d4b031 \
  -X PUT \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "name": "Insured",
      "colour": "#2f7f86"
  }'
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/possession-tags/7a3e9c15-2b84-4d60-9f17-c5e8a2d4b031', {
  method: 'PUT',
  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    name: 'Insured',
    colour: '#2f7f86',
  }),
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->put('https://my.monicahq.com/api/v1/possession-tags/7a3e9c15-2b84-4d60-9f17-c5e8a2d4b031', [
    'name' => 'Insured',
    'colour' => '#2f7f86',
]);
```

## Response

`200`

```json
{
    "data": {
        "type": "possession_tag",
        "id": "7a3e9c15-2b84-4d60-9f17-c5e8a2d4b031",
        "attributes": {
            "name": "Insured",
            "colour": "#2f7f86",
            "created_at": 1761436800,
            "updated_at": 1761440400
        },
        "links": {
            "self": "https://my.monicahq.com/api/v1/possession-tags/7a3e9c15-2b84-4d60-9f17-c5e8a2d4b031",
            "web": "https://my.monicahq.com/settings/account/possession-tags"
        }
    }
}
```
