# Delete one selfie (immediate, not restorable)

> Deletes one registered selfie (Rekognition DeleteFaces analog) by the selfieId you supplied to POST… (DELETE /v1/collections/{id}/selfies/{selfieId})

Source: https://sightradar.com/docs/api/selfies/delete-one-selfie

Deletes one registered selfie (Rekognition `DeleteFaces` analog) by the
`selfieId` you supplied to `POST /v1/collections/{id}/selfies`. Every
stored version of that selfie is removed. Free and synchronous.

* **Immediate only.** There is no soft mode and no restore: the vectors
are physically removed before the 200 is returned.
* **Verified.** A 200 means no matching selfie remains. If one is still
stored after the delete, the response is a 503 and you should retry;
the delete is idempotent, so a retry converges.
* **Idempotent.** An unknown or already-deleted `selfieId` returns 200
with `deleted: []`.

If the same `selfieId` was registered under several users, pass
`?userId=` to delete only that user's copy. An empty `?userId=` is a
400, never a delete of every copy.

Photo faces are not touched; to remove a person from indexed photos use
`DELETE /v1/collections/{id}/photos/{photoId}`.

### Example request

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

Put each id in the path percent-encoded, as a single path segment. An id with `/`, `?`, `#`, `%` or a space otherwise addresses a different URL. In code, use your HTTP library's path encoding (for example `encodeURIComponent` in JavaScript or `urllib.parse.quote(id, safe="")` in Python).

### Parameters

| Name                    | In    | Type      | Description                                                                                |
| ----------------------- | ----- | --------- | ------------------------------------------------------------------------------------------ |
| `id` **required**       | path  | `string`  | Collection id.                                                                             |
| `selfieId` **required** | path  | `string`  | The selfieId supplied at registration (at most 512 bytes).                                 |
| `userId`                | query | `string`  | Only delete the copy registered under this userId.                                         |
| `compliance`            | query | `boolean` | Record the erasure as compliance-class in your audit trail. The delete itself is the same. |

### Response body

| Field                             | Type          | Description                                                                                                                               |
| --------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `collection_id` **required**      | `string`      |                                                                                                                                           |
| `selfie_id`                       | `string`      | The selfieId from the path (selfie delete only).                                                                                          |
| `user_id`                         | `string`      | The userId from the path (user delete) or from `?userId=` (selfie delete, only when given).                                               |
| `deleted` **required**            | `string[]`    | Point ids of the removed selfies (the `point_id` returned at registration, the Rekognition FaceId analog). Empty when nothing was stored. |
| `deleted_selfie_ids` **required** | `string[]`    | The selfieIds that were removed.                                                                                                          |
| `deleted_user_ids` **required**   | `string[]`    | The userIds whose selfies were removed.                                                                                                   |
| `unsuccessful` **required**       | `object[]`    | Always empty: a delete that cannot be completed is a 503, never a partial 200.                                                            |
| `deleted_count` **required**      | `integer`     | Number of entries in `deleted`.                                                                                                           |
| `mode` **required**               | `"immediate"` | Always immediate; selfie and user deletes have no soft mode.                                                                              |
| `compliance` **required**         | `boolean`     | Echoes `?compliance=true`.                                                                                                                |
| `verified` **required**           | `boolean`     | Always true on a 200. The engine checked that no matching selfie remains.                                                                 |
| `restorable` **required**         | `boolean`     | Always false; there is no restore for a selfie or user delete.                                                                            |

### Status codes

| Status | Meaning                                                                                                                                 |
| ------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| `200`  | Selfie deleted (or was never stored).                                                                                                   |
| `400`  | The selfieId or userId is empty, longer than 512 bytes, or contains '/', '', a control character, or is '.' / '..'.                     |
| `401`  | Missing or invalid API key.                                                                                                             |
| `403`  | The account is read-only.                                                                                                               |
| `404`  | Resource not found.                                                                                                                     |
| `502`  | Deletion service unavailable.                                                                                                           |
| `503`  | The delete could not be verified (a matching selfie is still stored), or deletion is temporarily shed. Retry; the delete is idempotent. |
