# Add a life event category

`POST /api/v1/life-event-categories`

Add a category of your own, when the eight the product supplies do not sort your vocabulary the way you think of it.

The category goes at the end of the list and is offered straight away. It holds nothing until natures are filed under it, and a category holding nothing is a perfectly ordinary state: Other is supplied that way.

A category does no work beyond grouping, filtering and counting. Adding one called Health changes no life event behaviour. Contact history is determined by participants, not by categories or natures.

## Body parameters

- `name` (string, required): What the category is called. Up to 255 characters. Markup and surrounding blank space are stripped, and a name left with nothing in it is refused.

## Returns

The life event category object that was added.

- `data` (object): The category.
- `data.type` (string): Always life_event_category. 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 category is called. A category 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.position` (integer): Where the category sits in the settings, the pickers and the journal filters, counting from 1. Retired categories 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 category with the account. It governs one thing and one thing only: a supplied category cannot be deleted. It may be renamed, moved and retired like any other.
- `data.attributes.is_active` (boolean): Whether the category and the natures under it are offered when a life event is recorded. False removes the whole category from that choice and touches nothing already written.
- `data.attributes.life_event_type_count` (integer): How many life event natures are filed under the category, retired ones counted. It is what decides whether the category may be deleted.
- `data.attributes.created_at` (timestamp): When the category 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-categories \
  -X POST \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "name": "Volunteering"
  }'
```

```javascript
const response = await fetch('https://my.monicahq.com/api/v1/life-event-categories', {
  method: 'POST',
  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    name: 'Volunteering',
  }),
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->post('https://my.monicahq.com/api/v1/life-event-categories', [
    'name' => 'Volunteering',
]);
```

## Response

`201`

```json
{
    "data": {
        "type": "life_event_category",
        "id": "a71d6e04-2b58-4c39-9f80-3e5c1a7b2d46",
        "attributes": {
            "name": "Volunteering",
            "position": 9,
            "is_system": false,
            "is_active": true,
            "life_event_type_count": 0,
            "created_at": 1756339200,
            "updated_at": 1756425600
        },
        "links": {
            "self": "https://my.monicahq.com/api/v1/life-event-categories/a71d6e04-2b58-4c39-9f80-3e5c1a7b2d46"
        }
    }
}
```
