# Register a selfie

> Register a single-face selfie (Rekognition IndexFaces MaxFaces=1). (POST /v1/collections/{id}/selfies)

Source: https://sightradar.com/docs/api/selfies/register-a-selfie

Register a single-face selfie (Rekognition `IndexFaces` MaxFaces=1).
Returns a `point_id` you can later pass to `search-by-id`.

### Example request

```bash
curl -X POST "https://api.sightradar.com/v1/collections/$ID/selfies" \
  -H "Authorization: Bearer $SR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"userId":"<userId>"}'
```

### Parameters

| Name              | In     | Type     | Description                                                                                                                                                                                                                    |
| ----------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` **required** | path   | `string` |                                                                                                                                                                                                                                |
| `userId`          | query  | `string` | Required (also accepted in body).                                                                                                                                                                                              |
| `selfieId`        | query  | `string` | Optional; defaults to a content hash.                                                                                                                                                                                          |
| `Idempotency-Key` | header | `string` | Opt-in idempotency. A replay under the same key is never re-charged. For a selfie register it returns 200 with the stored result (Idempotent-Replay: true) when the registration identity matches; every other op returns 409. |

### Request body (application/json)

| Field                 | Type     | Description                      |
| --------------------- | -------- | -------------------------------- |
| `url`                 | `string` | Public image URL.                |
| `gcsKey`              | `string` | Google Cloud Storage object key. |
| `photoId`             | `string` | Optional per-image key.          |
| `userId` **required** | `string` |                                  |
| `selfieId`            | `string` |                                  |

Also accepts: `multipart/form-data`.

### Status codes

| Status | Meaning                                                                                                                                                                                                                   |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `200`  | Selfie processed (check face\_found). On a settled idempotent replay of the SAME registration (same collection + userId + selfieId), the body is the reduced SelfieReplayResult and the Idempotent-Replay header is true. |
| `400`  | userId missing or bad image.                                                                                                                                                                                              |
| `401`  | Missing or invalid API key.                                                                                                                                                                                               |
| `402`  | Wallet balance too low for this operation.                                                                                                                                                                                |
| `429`  | Per-key RPS or per-customer concurrency limit exceeded.                                                                                                                                                                   |
| `502`  | Engine error (the credit hold is refunded automatically).                                                                                                                                                                 |
