# Reactivate Value Objects

Operation ID: `reactivateValueObjects`

Group: Value Accounting › Value Objects

[Open in the interactive reference](https://lensing.ai/api-docs/lensing/v1/endpoints/reactivateValueObjects)

`POST /value-accounting/value-objects/reactivate`

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Re-open value objects that were retired — each together with the mappings its retirement ended — in one all-or-nothing call. WRITES; returns an empty body. The reverse of the deactivate outcome of deleteValueObject (DELETE value-accounting/value-objects/:id) and the way to re-open a value object with everything its retirement closed (PATCH refuses endDate: null on an end before today for that reason — an end of today or later is cleared there directly; a later endDate on PATCH re-opens up to that day under the same screens). An end of today or later is accepted here too and cleared, the same end state as PATCH with endDate: null (the mappings ending with it follow) — never NOT_ENDED. Exactly the mappings ending on the value object's own end date are re-opened; a mapping ended on any other day is history (its link moved, or ended by itself) and stays closed, so retiring and re-opening is a round trip. A value object with no end date of its own is not retired, whatever history its mappings hold — except a half-retired one (open, but none of its mappings open), whose mappings sharing the latest end date are re-opened. Every id is screened before the first write: an unknown id is rejected with NOT_FOUND, a custom value object's shadow with REACTIVATE_VIA_FLOW (re-open it with its value through reactivateCustomValueObjects (POST value-accounting/custom-value-objects/reactivate)), a value object with nothing to re-open with NOT_ENDED, and one with a mapping to re-open whose record no longer exists with REFERENCE_NOT_FOUND — in that order — and in every case nothing is re-opened. ⛔ A value object is not re-opened when a mapping it would re-open names a record another of its own mappings maps open on a shared day from today on — two open links to one record: refused with MAPPING_EXISTS (checked before ONE_TO_ONE_EXISTS); end that mapping first through updateMappings of updateValueObject (PATCH value-accounting/value-objects/:id). ⛔ A value object is not re-opened while ANOTHER value object holds an open one-to-one link to the record its re-opened mappings would stand for alone: refused with ONE_TO_ONE_EXISTS (checked last), as are two value objects of one batch re-opening one-to-one links to the same record. Nothing is displaced: end the other link first.

Re-opens value objects that were retired, each together with the mappings its retirement ended, and returns an empty body.

This is the reverse of the DEACTIVATE outcome of deleteValueObject (DELETE value-accounting/value-objects/:id), and the way to re-open a value object together with everything its retirement closed (the only other re-open door is PATCH value-accounting/value-objects/:id moving a retired value object's `endDate` to a later day, under the same screens; a create or an association re-opens one only as a side effect, while its record is active): that delete end-dates the value object and every mapping still open with the same day, so clearing the value object's endDate alone would leave it reading active while the mappings that say what it stands for stay ended — which is why PATCH refuses `endDate: null` on an end that has passed (before today) and points here; an end of today or later never took effect and PATCH clears it directly. This call accepts such an end too and clears it — the same end state as PATCH with `endDate: null`, the mappings ending with it following; it is not refused as `NOT_ENDED`. It is a ROUND TRIP: exactly the mappings ending on the value object's own end date are re-opened; a mapping ended on any other day is history (its link moved to another record, or ended by itself) and stays closed. A value object with no end date of its own is not retired, whatever history its mappings hold — except a half-retired one (open, but none of its mappings open), whose mappings sharing the latest end date are re-opened.

ALL-OR-NOTHING: every id is screened before the first write. `NOT_FOUND` names ids that match no value object; `REACTIVATE_VIA_FLOW` a custom value object's shadow, which is re-opened with its value through reactivateCustomValueObjects (POST value-accounting/custom-value-objects/reactivate); `NOT_ENDED` value objects with nothing to re-open; `REFERENCE_NOT_FOUND` mappings it would re-open whose record no longer exists, which a value object cannot be re-opened to stand for. In that order; in every case nothing is re-opened. A value object is not re-opened when a mapping it would re-open names a record another of its own mappings maps open on a shared day from today on (MAPPING_EXISTS): end that mapping first. A value object is not re-opened while another value object holds an open one-to-one link to the record it would stand for (ONE_TO_ONE_EXISTS): end that link first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | string · v1 | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version `v1`. |
| `Idempotency-Key` | header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with `400 IDEMPOTENCY_NOT_SUPPORTED` rather than silently ignored. |

## Request body

Required, `application/json`: reactivateValueObjectsInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | array<string> | yes | Ids (UUIDs) of the value objects to re-open, as returned by the valueObjects data-set (GET value-accounting/value-objects) (filter[status][eq]=inactive lists the ones whose end date has passed; one the delete deactivated today still reads 'active' until tomorrow, so keep the id the delete was sent). Every id must exist and be retired, or the whole batch is rejected. Duplicates are collapsed. An empty array is a valid no-op. Ids are matched case-insensitively and returned in canonical lowercase. Example: `["6d2c8f31-b4a7-4e19-9f2b-77c0a1d4e5b2"]`. |

```json
{
  "ids": [
    "6d2c8f31-b4a7-4e19-9f2b-77c0a1d4e5b2"
  ]
}
```

## Response

`200` Success

```json
{
  "data": {},
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## Response headers

- `Idempotency-Replayed` — Present and `true` only when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent as `false`.

## Errors

| Code | Status |
| --- | --- |
| `NOT_FOUND` | 400 |
| `REACTIVATE_VIA_FLOW` | 400 |
| `NOT_ENDED` | 400 |
| `REFERENCE_NOT_FOUND` | 400 |
| `MAPPING_EXISTS` | 400 |
| `ONE_TO_ONE_EXISTS` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND, REACTIVATE_VIA_FLOW, NOT_ENDED, REFERENCE_NOT_FOUND, MAPPING_EXISTS, ONE_TO_ONE_EXISTS
- `401` — The request carries no valid access token.
- `403` — Not authorized
- `404` — Not found
- `409` — The Idempotency-Key is still being processed by another request.
- `422` — The Idempotency-Key was already used with a different request payload.
- `429` — Too many requests from this client address. The response has no body and no `Retry-After` header.
- `500` — Internal server error
