> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kaireonai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Restore

> Restore soft-deleted entities by clearing their deletedAt timestamp.

The Restore API allows administrators to recover entities that were soft-deleted. When an entity is deleted in KaireonAI, it is not immediately removed from the database -- instead, a `deletedAt` timestamp is set. This endpoint clears that timestamp, making the entity active again. **Admin only.**

## Base path

```
/api/v1/restore
```

***

## Restore a soft-deleted entity

```
POST /api/v1/restore?entityType={type}&id={id}
```

Restores a single soft-deleted entity by clearing its `deletedAt` timestamp.

### Query parameters

| Parameter    | Required | Type   | Description                                            |
| ------------ | -------- | ------ | ------------------------------------------------------ |
| `entityType` | **Yes**  | string | The type of entity to restore (see valid types below). |
| `id`         | **Yes**  | string | The ID of the entity to restore.                       |

### Valid entity types

| Entity Type         | Description                                |
| ------------------- | ------------------------------------------ |
| `category`          | Top-level offer category (business issue). |
| `subCategory`       | Child grouping under a category.           |
| `channel`           | Delivery channel.                          |
| `placement`         | Channel placement.                         |
| `flowRoute`         | Decision flow routing rule.                |
| `offer`             | Decisioning offer (action).                |
| `creative`          | Content variant / treatment.               |
| `outcomeType`       | Outcome type definition.                   |
| `qualificationRule` | Qualification rule.                        |
| `contactPolicy`     | Contact policy rule.                       |
| `decisionFlow`      | Decision flow pipeline.                    |
| `triggerRule`       | Trigger rule.                              |
| `guardrailRule`     | Guardrail rule.                            |
| `rankingProfile`    | Multi-objective ranking profile.           |
| `summaryDefinition` | Interaction summary definition.            |

### Example request

```bash theme={null}
curl -X POST "https://playground.kaireonai.com/api/v1/restore?entityType=offer&id=clx_abc123" \
  -H "X-Tenant-Id: my-tenant"
```

### Response `200`

```json theme={null}
{
  "restored": true,
  "entityType": "offer",
  "id": "clx_abc123"
}
```

### Error codes

| Code  | Reason                                                 |
| ----- | ------------------------------------------------------ |
| `400` | Missing `entityType` or `id` query parameter.          |
| `400` | Invalid `entityType` (not in the supported list).      |
| `400` | Entity not found, not soft-deleted, or restore failed. |

### Example error

```json theme={null}
{
  "error": "Entity not found or not soft-deleted"
}
```

***

## Role requirements

| Method | Minimum role |
| ------ | ------------ |
| POST   | `admin`      |

<Note>
  Only entities that have been soft-deleted (i.e., have a non-null `deletedAt` timestamp) can be restored. Attempting to restore an entity that was never deleted or was hard-deleted will return a `400` error.
</Note>
