# Bulk Enroll or Update Persons

## Bulk Enroll or Update Persons

<mark style="color:green;">`PUT`</mark> `/persons`

This endpoint is to enroll or update persons in bulk.

**Headers**

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| x-api-key    | `<your-api-key>`   |

**Body**

<table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code>collection_name</code></td><td><p>Required: Yes </p><p>Type: string</p><p>Example: </p><pre class="language-json"><code class="lang-json">"collection_name": "MyCollection"
</code></pre><p>Please create a collection first before enrolling person(s). Else an error "The requested entity could not be found." will return</p></td></tr><tr><td><code>face_storage_type</code></td><td><p>Required: Yes </p><p>Type: string</p><p>Accepted values: "NoStorage", "StoreThumbnails", "StoreFullImage" </p><p></p><p>Example: </p><pre class="language-json"><code class="lang-json">"face_storage_type": "StoreThumbnails"
</code></pre><p>"NoStorage" = do not store any face image "StoreThumbnails" = store only thumbnails (cropped face from the given image) "StoreFullImage" = store full base64 image</p></td></tr><tr><td><code>Persons</code></td><td><p>Required: Yes </p><p>Type: dict<br>Example: To enroll multiple persons in a specified collection:<br></p><pre class="language-json"><code class="lang-json">{
  "collection_name": "MyCollection",
  "face_storage_type": "StoreThumbnails",
  "persons": [
 {
      "face_base_64": "U2Vjb25kIGltYWdl",
      "metadata": {
        "DOB": "2000-01-01"
      },
      "person_id": "JD1",
      "person_name": "John Doe1"
    }, 
    {
      "face_base_64": "U2Vjb25kIGltYWdl",
      "metadata": {
        "DOB": "2001-01-01"
      },
      "person_id": "JD2",
      "person_name": "John Doe2"
    }
  ]
}

</code></pre><p><br>Enrolling or updating multiple persons in one collection is allowed. Each Base64 image should have only one face. Not supporting multiple persons enrollment/update to multiple collections.</p></td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
[
  {
    "code": "string",
    "message": "string",
    "metadata": {
      "additionalProp1": "string",
      "additionalProp2": "string",
      "additionalProp3": "string"
    }
  }
]
```

{% endtab %}

{% tab title="400" %}
The collection name specified is not valid

```json
{
  "code": "ERR_INVALID_COLLECTION_NAME",
  "message": "Collection names can only contain alphanumeric characters, underscores, hyphens, and periods."
}
```

{% endtab %}

{% tab title="401" %}
Please use an API Key to access this endpoint

```json
{
  "code": "ERR_API_KEY_NOT_PRESENT",
  "message": "The API key is missing from the request."
}
```

{% endtab %}

{% tab title="403" %}
API Key is invalid. Please provide a valid API Key

```json
{
  "code": "ERR_API_KEY_NOT_VALID",
  "message": "The API key is not valid."
}
```

{% endtab %}

{% tab title="404" %}
The collection with the specified name does not exist

```json
{
  "code": "ERR_NOT_FOUND",
  "message": "The requested entity could not be found."
}
```

{% endtab %}

{% tab title="412" %}
The posted JSON is malformed or contains fields that are not of the correct type

```json
{
  "code": "ERR_UNPROCESSABLE_CONTENT",
  "message": "The posted JSON is malformed or contains fields that are not of the correct type."
}
```

{% endtab %}

{% tab title="500" %}
An error occurred while connecting with the database, please retry your request later

```json
{
  "code": "ERR_DATABASE_ERROR",
  "message": "An error occurred while connecting with the database, please retry your request later."
}
```

{% endtab %}
{% endtabs %}
