# Delete every selfie of a user (immediate, not restorable)

> Deletes every selfie registered under userId in the collection (Rekognition DeleteUser analog). (DELETE /v1/collections/{id}/users/{userId})

Source: https://sightradar.com/docs/api/selfies/delete-every-selfie-of-a-user

Deletes every selfie registered under `userId` in the collection
(Rekognition `DeleteUser` analog). Free and synchronous, with the same
contract as the selfie delete: immediate, not restorable, verified (503
if a matching selfie remains; retry), and idempotent (an unknown
`userId` returns 200 with `deleted: []`).

`deleted_selfie_ids` lists the selfieIds that were removed. Photo faces
are not touched: SightRadar stores no link between a photo face and a
user, so to remove the person from indexed photos use
`DELETE /v1/collections/{id}/photos/{photoId}`.

### Example request

```bash
curl -X DELETE "https://api.sightradar.com/v1/collections/$ID/users/$USERID" \
  -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.                                                                             |
| `userId` **required** | path  | `string`  | The userId supplied at selfie registration (at most 512 bytes).                            |
| `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`  | The user's selfies deleted (or none were stored).                                                                                       |
| `400`  | The 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. |
