REST API: data sources

Create a data source

Create a data source and set how its images are handled.

Purpose

A data source is a named origin of images in your account. Its settings decide which features are detected on every image of the source, when a new person is created automatically, and to which person lists. Images you send for the source are attributed to it through group_id and source_id.

Request

POST <API_BASE_URL>/source/create. All calls are POST under your API address. Replace <API_BASE_URL> with the API address provided with your access.

Send a permanent API token in the token field of the body, or a user token in the token header. See authentication.

Content type: application/json.

FieldTypeRequiredDescription
tokenstring (uuid)if no headerYour permanent API token. Required unless you send a user token in the token header.
group_idstringyesThe group the source belongs to.
namestringyesThe name of the new source.
feature_checkarray of object or stringnoFeatures to detect on every image of the source: a name or an array of names such as age, gender, mood, glasses or mask.
new_person_thresholdvaluenoThe match threshold below which a new person is created automatically. The value never creates no person; no_match uses the platform default, which is recommended.
new_person_square_minvaluenoThe smallest face side, in pixels, from which a person is created automatically.
new_person_yaw_maxvaluenoThe largest left or right rotation, in degrees, at which a person is created automatically.
new_person_pitch_maxvaluenoThe largest up or down tilt, in degrees, at which a person is created automatically.
person_list_addarray of string (uuid)noAn array of person list identifiers. Persons created automatically are added to each of them.
person_list_searcharray of objectnoOne or more person lists in which to search for matches. Each item holds a list identifier and alert messages.

Response

HTTP 201. The source was created in the group.

FieldTypeDescription
statusstringAlways ok on this body.
source_idstring (uuid)The identifier of the source just created.

Errors

  • 400: The body failed validation. The answer has status of error and a details list with one entry per offending field (path, expected, actual).
  • 401: The token is missing, expired or unknown.

A refusal can also come before the operation runs: an address outside your IP allowlist, a token bound to another address, or a body that is not valid JSON. See response format and errors.

Example

Request:

curl -X POST "<API_BASE_URL>/source/create" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "<your permanent API token>",
    "group_id": "<group id>",
    "name": "Front door",
    "new_person_threshold": "no_match",
    "person_list_add": [
      "<person list id>"
    ]
  }'

Response:

{
  "status": "ok",
  "source_id": "<source id>"
}

Questions about the face API?

Write to us and we will help.

Talk to us