# Recreate a purged collection

> Brings back a collection whose deletion has fully completed (status=deleted) as a new, empty collection under the… (POST /v1/collections/{id}/recreate)

Source: https://sightradar.com/docs/api/collections/recreate-a-purged-collection

Brings back a collection whose deletion has fully completed
(`status=deleted`) as a new, empty collection under the same id. Nothing
from before the delete comes back: re-index the photos you still need.
Free.

`POST /v1/collections` keeps returning 409 for a deleted id, and indexing
into one is refused, so a stale job can never revive it by accident.
Recreating it has to be this explicit call.

Returns 409 while the collection is still `active`, `deletion_pending`
(use restore instead) or `deleting`; when the erasure was
compliance-class; when deletion was not verified complete; or while work
accepted before the delete is still queued or running.

### Example request

```bash
curl -X POST "https://api.sightradar.com/v1/collections/$ID/recreate" \
  -H "Authorization: Bearer $SR_API_KEY"
```

### Parameters

| Name              | In   | Type     | Description    |
| ----------------- | ---- | -------- | -------------- |
| `id` **required** | path | `string` | Collection id. |

### Response body

| Field           | Type                                                        | Description                                                                                                                                                                                                |
| --------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `collection_id` | `string`                                                    |                                                                                                                                                                                                            |
| `status`        | `"active" \| "deletion_pending" \| "deleting" \| "deleted"` |                                                                                                                                                                                                            |
| `counts_source` | `string`                                                    | Where the counts came from: `postgres` = the gateway's count registry (the normal case), `engine` = a live read from the engine (a collection whose registry counts are not ready yet, or `?verify=true`). |
| `photo_count`   | `integer`                                                   |                                                                                                                                                                                                            |
| `face_count`    | `integer`                                                   |                                                                                                                                                                                                            |
| `selfie_count`  | `integer`                                                   |                                                                                                                                                                                                            |
| `created_at`    | `string`                                                    |                                                                                                                                                                                                            |
| `purge_after`   | `string`                                                    | Present on `deletion_pending` collections: when the soft delete becomes permanent.                                                                                                                         |

### Status codes

| Status | Meaning                                                         |
| ------ | --------------------------------------------------------------- |
| `200`  | Collection recreated, active and empty.                         |
| `401`  | Missing or invalid API key.                                     |
| `403`  | Account is read-only.                                           |
| `404`  | Resource not found.                                             |
| `409`  | Not recreatable. The error message says which condition failed. |
