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

# Enroll User

> Enroll a face into a collection so you can authenticate (1:1) or search (1:N) against it later.

<div className="dj-endpoint">
  <span className={`dj-method dj-method-post`}>POST</span>
  <code>/api/v1/face/enroll</code>
</div>

Enroll a user’s face into a collection. Pass a face image as a URL or Base64 string, a `subject_id` you control, and the `collection_id` returned when you created the collection.

## Headers

| Header          | Required | Description                                         |
| --------------- | -------- | --------------------------------------------------- |
| `Authorization` | Yes      | Your app's secret key, sent as-is — *not* `Bearer`. |
| `AppId`         | Yes      | The App ID from your dashboard.                     |
| `Content-Type`  | Yes      | `application/json`                                  |

## Body parameters

| Parameter         | Type   | Required | Description                                                                          |
| ----------------- | ------ | -------- | ------------------------------------------------------------------------------------ |
| `face.image`      | string | Yes      | Face image as a URL or a Base64 string (strip any `data:image/jpeg;base64,` prefix). |
| `face.image_type` | string | Yes      | How `face.image` is encoded: `url` or `base64`.                                      |
| `subject_id`      | string | Yes      | Your identifier for this person in the collection.                                   |
| `collection_id`   | string | Yes      | The collection to enroll into.                                                       |

## Response

Returns an `entity` confirming the face was enrolled, with a `face_id`, image `quality_band`, whether it was `deduplicated`, and `created_at`.

| Field           | Type    | Description                                                                        |
| --------------- | ------- | ---------------------------------------------------------------------------------- |
| `collection_id` | string  | The collection the face was enrolled into. Echoes the `collection_id` you sent.    |
| `subject_id`    | string  | Your identifier for this person. Echoes the `subject_id` you sent.                 |
| `face_id`       | string  | Identifier of the enrolled face. Use this when authenticating or searching.        |
| `quality_band`  | string  | Image-quality rating of the enrolled face, e.g. `good`.                            |
| `deduplicated`  | boolean | `true` if this face was already enrolled for the subject and was not stored again. |
| `created_at`    | string  | ISO 8601 timestamp of when the face was enrolled.                                  |

## Errors

| Code  | Meaning                                                                                       |
| ----- | --------------------------------------------------------------------------------------------- |
| `400` | Bad request — a required field is missing or the image is malformed.                          |
| `401` | Unauthorized — check your key and `AppId` (no `Bearer` prefix).                               |
| `402` | Insufficient wallet balance. [Fund your wallet](/api-reference/core-concepts/wallet-billing). |
| `404` | No collection found for the supplied `collection_id`.                                         |
| `429` | Too many requests — back off and retry.                                                       |

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.dojah.io/api/v1/face/enroll" \
    -H "Authorization: {{secret_key}}" \
    -H "AppId: {{app_id}}" \
    -H "Content-Type: application/json" \
    -d '{
      "face": {
        "image": "https://images.dojah.io/face.jpg",
        "image_type": "url"
      },
      "subject_id": "1234576",
      "collection_id": "90570273-6652-4ff1-8054-f20b4e73cbd2"
    }'
  ```

  ```js Node.js theme={null}
  const res = await fetch("https://api.dojah.io/api/v1/face/enroll", {
    method: "POST",
    headers: {
      Authorization: process.env.DOJAH_SECRET_KEY,
      AppId: process.env.DOJAH_APP_ID,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      face: {
        image: "https://images.dojah.io/face.jpg",
        image_type: "url"
      },
      subject_id: "1234576",
      collection_id: "90570273-6652-4ff1-8054-f20b4e73cbd2"
    }),
  });
  const data = await res.json();
  ```

  ```python Python theme={null}
  import os, requests

  res = requests.post(
      "https://api.dojah.io/api/v1/face/enroll",
      headers={
          "Authorization": os.environ["DOJAH_SECRET_KEY"],
          "AppId": os.environ["DOJAH_APP_ID"],
      },
      json={
          "face": {
              "image": "https://images.dojah.io/face.jpg",
              "image_type": "url"
          },
          "subject_id": "1234576",
          "collection_id": "90570273-6652-4ff1-8054-f20b4e73cbd2"
      },
  )
  data = res.json()
  ```
</RequestExample>

<ResponseExample>
  ```json POST /api/v1/face/enroll theme={null}
  {
    "entity": {
      "collection_id": "90570273-6652-4ff1-8054-f20b4e73cbd2",
      "subject_id": "1234576",
      "face_id": "face-sandbox-001",
      "quality_band": "good",
      "deduplicated": false,
      "created_at": "2026-08-27T10:23:59.482Z"
    }
  }
  ```
</ResponseExample>
