# Record an event in the life of a unit

> `POST /batteries/{batteryId}/lifecycle-events` · Scope: `condition` · operationId `createLifecycleEvent`

Editor and above, or an API key with the `condition` scope (source `api`, ADR-017). `occurred_on` lies
between the manufacturing date and today. `evidence_ids` name
documents of the evidence library (a diagnostic report, a repair protocol). Events are records: they
do not change the unit's data; condition values are reported with `updateCondition`, second life with
`createSecondLifeBattery`.

## Path parameters

- **batteryId** `string (uuid)` (required)

## Request body (`application/json`)

- **description** `string`
- **evidence_ids** `string (uuid)[]`
- **occurred_on** `string (date)` (required)
- **type** `string` (required, one of: `placed_on_market`, `put_into_service`, `inspection`, `repair`, `component_replaced`, `condition_update`, `waste`, `recycled`, `custom`): The event types members and service partners report.

## Responses

### 201 (`application/json`)

The event.

- **api_key** `ApiKeyRef`: An organisation API key (ADR-017) that reported an event (source `api`) or staged an import (ADR-026).
  - **id** `string (uuid)` (required)
  - **name** `string` (required)
- **battery_id** `string (uuid)` (required)
- **created_at** `string (date-time)` (required)
- **description** `string`
- **evidence** `EvidenceRef[]` (required)
  - **access_tier** `string` (required, one of: `public`, `legitimate_interest`, `authority`, `internal`): Access tier of a field on the passport (Art. 77(2), Annex XIII).
  - **filename** `string` (required)
  - **id** `string (uuid)` (required)
  - **kind** `string` (required, one of: `declaration_of_conformity`, `test_report`, `dismantling_manual`, `safety_instructions`, `datasheet`, `diagnostic_report`, `study`, `image`, `other`)
  - **revision** `integer` (required)
  - **superseded** `boolean` (required)
  - **title** `string` (required)
- **field_keys** `string[]` (required): The condition fields this event updated.
- **id** `string (uuid)` (required)
- **occurred_on** `string (date)` (required)
- **partner** `ServicePartnerRef`
  - **email** `string (email)` (required)
  - **name** `string`
  - **request_id** `string (uuid)` (required)
- **related_battery_id** `string (uuid)`: Second life: the successor (on the predecessor's event) or the predecessor (on the successor's).
- **related_serial_number** `string`
- **reported_by** `UserRef`
  - **display_name** `string` (required)
  - **id** `string (uuid)` (required)
- **source** `string` (required, one of: `manual`, `supplier`, `api`, `system`): `manual` (a member), `supplier` (a service-partner link), `api` (an API key, M7), `system`.
- **type** `string` (required, one of: `placed_on_market`, `put_into_service`, `inspection`, `repair`, `component_replaced`, `condition_update`, `repurposed`, `reused`, `remanufactured`, `waste`, `recycled`, `custom`): What happened to a unit. `condition_update` is recorded by condition updates, `repurposed`, `reused` and `remanufactured` by `createSecondLifeBattery`; the others are reported.

### 400 (`application/problem+json`)

The request is malformed or failed validation (`validation_error`), or a token is invalid or expired (`invalid_token`).

### 401 (`application/problem+json`)

The API key is missing, unknown or revoked (`unauthenticated`).

### 403 (`application/problem+json`)

The API key may not perform this action (`forbidden`): it lacks the operation's scope, or the action needs more than a viewer's rights.

### 404 (`application/problem+json`)

The resource does not exist in the organisation of the API key, or the public passport is unknown (`not_found`).

### 409 (`application/problem+json`)

The request conflicts with the current state (`conflict`), e.g. a stale `If-Match` version.

### default (`application/problem+json`)

Any other problem, e.g. `internal_error`.

## Example

```bash title="cURL"
curl -X POST "https://passport.kabin.sh/api/v1/batteries/{batteryId}/lifecycle-events" \
  -H "Authorization: Bearer $BATTERYPASS_API_KEY" \
  -H "Content-Type: application/json" \
  -d @body.json
```
