# Change a life event type

`PUT /api/v1/life-event-types/{lifeEventType}`

Change what a nature is called, what it covers, how it is drawn and which category it is filed under.

A nature the product supplied is changed like any other. is_system stops a nature being deleted and stops nothing else, so a household that calls a phone call something else writes it here.

Moving a nature to another category puts it last there, because the order inside a category is an order somebody chose and an arrival has no claim on a place in it.

Nothing a life event has recorded changes, since a life event names its nature rather than copying it. Renaming a nature renames it on every life event already recorded with it, which is the point.

Once you write your own words they stand in every language. The wording the product supplied reads in the language of whoever is looking, and renaming gives that up.

## Parameters

- `lifeEventType` (uuid, required): The id of the nature. A path that is not a uuid answers 404 without a query being run.
- `life_event_category_id` (uuid, optional): The category to file the nature under. A category belonging to somebody else answers 404. It cannot be null.
- `name` (string, optional): What the nature is called. Up to 255 characters. Markup and surrounding blank space are stripped, and a name left with nothing in it is refused. It cannot be null.
- `description` (string, optional): A sentence saying what the nature covers. Up to 255 characters, stripped the same way. Null clears it.
- `icon` (string, optional): The glyph drawn beside the nature, from the catalogue the product ships. Anything else is refused.
- `colour` (string, optional): The tint the nature is drawn in, from the palette the product ships. Anything else is refused.
- `updates_last_in_touch` (boolean, optional): Whether its life events set the Last in touch date of the contacts they are recorded with. Left out, it stays as it is. A change works the date out again for everybody who took part in one, shortly after the answer.

## Returns

The life event type object as it now reads.

- `data` (object): The nature.
- `data.type` (string): Always life_event_type. 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.life_event_category_id` (uuid): The category the nature is filed under. Moving a nature to another category is an ordinary change, and the life events recorded with it are regrouped along with it.
- `data.attributes.name` (string): What the nature is called. One the product supplied reads in the language you ask for, until somebody renames it, after which their words stand in every language. Up to 255 characters, reduced to plain text, so no markup survives here.
- `data.attributes.description` (string): A sentence saying what the nature covers, shown where somebody chooses one. Up to 255 characters, or null when nobody wrote one.
- `data.attributes.icon` (string): The glyph drawn beside the nature, chosen from the catalogue the product ships, or null to read by name alone.
- `data.attributes.colour` (string): The tint the nature is drawn in, chosen from the palette the product ships, or null to take the ordinary one.
- `data.attributes.position` (integer): Where the nature sits inside its category, counting from 1. Retired natures are numbered along with the rest, so one switched back on finds the place it had.
- `data.attributes.is_system` (boolean): Whether the product supplied the nature with the account. It governs one thing and one thing only: a supplied nature cannot be deleted. It may be renamed, redrawn, moved and retired like any other.
- `data.attributes.is_active` (boolean): Whether the nature is offered when a life event is recorded. False takes it out of that choice and touches nothing already written.
- `data.attributes.updates_last_in_touch` (boolean): Whether a life event of this nature sets last_interaction_at, the Last in touch date, on the contacts it is recorded with. True for a moment shared with them, such as a call or a meal, and false for news about one of them, such as a move.
- `data.attributes.created_at` (timestamp): When the nature was added, as a count of seconds since 1970 rather than a written date.
- `data.attributes.updated_at` (timestamp): When it last changed, as a count of seconds. Equal to created_at until it first changes.
- `data.links` (object): Where to find this record.
- `data.links.self` (string): The absolute address this record is read from.

## 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/life-event-types/8b2e5c70-1a94-4f38-b6d2-0e7c94a35f18 \
  -X PUT \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "life_event_category_id": "5f8b3c21-9d07-4a64-8e12-7b0a4d6c3e95",
      "name": "Board game night",
      "description": "An evening around a table with a box of cardboard.",
      "icon": "activity",
      "colour": "bg-sky-500",
      "updates_last_in_touch": "false"
  }'
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/life-event-types/8b2e5c70-1a94-4f38-b6d2-0e7c94a35f18', {
  method: 'PUT',
  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    life_event_category_id: '5f8b3c21-9d07-4a64-8e12-7b0a4d6c3e95',
    name: 'Board game night',
    description: 'An evening around a table with a box of cardboard.',
    icon: 'activity',
    colour: 'bg-sky-500',
    updates_last_in_touch: 'false',
  }),
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->put('https://my.monicahq.com/api/v1/life-event-types/8b2e5c70-1a94-4f38-b6d2-0e7c94a35f18', [
    'life_event_category_id' => '5f8b3c21-9d07-4a64-8e12-7b0a4d6c3e95',
    'name' => 'Board game night',
    'description' => 'An evening around a table with a box of cardboard.',
    'icon' => 'activity',
    'colour' => 'bg-sky-500',
    'updates_last_in_touch' => 'false',
]);
```

## Response

`200`

```json
{
    "data": {
        "type": "life_event_type",
        "id": "8b2e5c70-1a94-4f38-b6d2-0e7c94a35f18",
        "attributes": {
            "life_event_category_id": "5f8b3c21-9d07-4a64-8e12-7b0a4d6c3e95",
            "name": "Board game night",
            "description": "An evening around a table with a box of cardboard.",
            "icon": "activity",
            "colour": "bg-sky-500",
            "position": 2,
            "is_system": false,
            "is_active": true,
            "updates_last_in_touch": true,
            "created_at": 1756339200,
            "updated_at": 1756425600
        },
        "links": {
            "self": "https://my.monicahq.com/api/v1/life-event-types/8b2e5c70-1a94-4f38-b6d2-0e7c94a35f18"
        }
    }
}
```
