LUNA PLATFORM 5 API (v.6.20.1)

Download OpenAPI specification:Download

VisionLabs Luna Platform 5 API. The API version is 6.

OpenAPI specification is the only valid document providing up-to-date information about the service API.

The specification can be used:

  • By documentation generation tools to visualize the API.
  • By code generation tools.

All the documents and code generated using this specification can include inaccuracies and should be carefully checked.

OpenAPI specification can be received using the /docs/spec resource. The "Accept" header should be set to "application/x-yaml".

version

get version

Get versions of services.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{
  • "LUNA PLATFORM": {
    },
  • "luna-api": {
    },
  • "luna-events": {
    },
  • "luna-faces": {
    },
  • "luna-image-store-bodies-samples": {
    },
  • "luna-image-store-faces-samples": {
    },
  • "luna-image-store-images": {
    },
  • "luna-handlers": {
    },
  • "luna-tasks": {
    },
  • "luna-matcher-proxy": {
    },
  • "luna-remote-sdk": {
    },
  • "luna-lambda": {
    }
}

version options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

accounts

create account

Create an account.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID for new account creation.

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
login
required
string (login) [ 3 .. 128 ] characters ^[a-z0-9_\-\.]+@[a-z]+\.[a-z]{2,}$

Account email.

password
required
string (password) [ 3 .. 128 ] characters ^.{3,128}$

Account password.

account_type
required
string (account_type_for_creation)
Enum: "advanced_user" "user"

Specified user account type:

  • user - allows to interact with its own data

  • advanced_user - allows to interact with its own data and view other accounts data

description
string (account_description) <= 128 characters
Default: ""

Account description.

Responses

Request samples

Content type
application/json
{
  • "login": "mylogin@gmail.com",
  • "password": "string",
  • "account_type": "advanced_user",
  • "description": "main admin account"
}

Response samples

Content type
application/json
{}

accounts options

Get options for the resource.

header Parameters
Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID for new account creation.

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

account

get account

Get account.

Authorizations:
BasicAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

url = f"{baseUri}/account"
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="
}

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "login": "mylogin@gmail.com",
  • "account_type": "advanced_user",
  • "description": "main admin account",
  • "create_time": "2018-08-11T09:11:41.674Z",
  • "last_update_time": "2018-08-11T09:11:41.674Z"
}

patch account

Patch account. At least one field must be specified.

Authorizations:
BasicAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
non-empty
login
string (login) [ 3 .. 128 ] characters ^[a-z0-9_\-\.]+@[a-z]+\.[a-z]{2,}$

Account email.

password
string (password) [ 3 .. 128 ] characters ^.{3,128}$

Account password.

account_type
string (account_type_for_creation)
Enum: "advanced_user" "user"

Specified user account type:

  • user - allows to interact with its own data

  • advanced_user - allows to interact with its own data and view other accounts data

description
string (account_description) <= 128 characters
Default: ""

Account description.

Responses

Request samples

Content type
application/json
{
  • "login": "mylogin@gmail.com",
  • "password": "string",
  • "account_type": "advanced_user",
  • "description": "main admin account"
}

Response samples

Content type
application/json
Example
{
  • "error_code": 12022,
  • "desc": "Bad/incomplete input data",
  • "detail": "Failed to validate input json. Path: 'extra_field', message: 'extra fields not permitted'"
}

accounts options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

tokens

create token

Create a token.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
description
string (token_description) <= 128 characters
Default: ""

Token description.

expiration_time
required
string or null <date-time>

Token expiration time in RFC 3339 format. null means token will never expired.

required
object (permissions)

Token permissions. The value [] means the prohibition of all permissions.

visibility_area
string (visibility_area)
Default: "all"
Enum: "account" "all"

Specifies data visible for the token.

account - only data related to this account can be received using GET requests.

all - data of all existing accounts can be received using GET requests. This value can be set for advanced_user account. This option does not work for user account.

Responses

Request samples

Content type
application/json
{
  • "description": "main account token",
  • "expiration_time": "2050-11-11T11:11:11.111+03:00",
  • "permissions": {
    },
  • "visibility_area": "all"
}

Response samples

Content type
application/json
{
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k",
  • "token_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "url": "/6/tokens/557d54ec-29ad-4f3c-93b4-c9092ef12515",
}

get tokens

Get tokens.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

create_time__lt
string <date-time> (time)
Example: create_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object create_time.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object create_time.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create token
url = f"{baseUri}/tokens"
headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}
payload = {"permissions": {"face": ["view"]}, "description": "description"}
requests.post(url, json=payload, headers=headers)

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="
}
url = f"{baseUri}/tokens"
response = requests.get(url, headers=headers, params={"page": 1, "page_size": 10})

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "tokens": [
    ]
}

tokens options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

replace token

Update token. You cannot update a part of the token, so you should specify all the fields for your token.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
token_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

Token ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
description
string (token_description) <= 128 characters
Default: ""

Token description.

expiration_time
required
string or null <date-time>

Token expiration time in RFC 3339 format. null means token will never expired.

required
object (permissions)

Token permissions. The value [] means the prohibition of all permissions.

visibility_area
string (visibility_area)
Default: "all"
Enum: "account" "all"

Specifies data visible for the token.

account - only data related to this account can be received using GET requests.

all - data of all existing accounts can be received using GET requests. This value can be set for advanced_user account. This option does not work for user account.

Responses

Request samples

Content type
application/json
{
  • "description": "main account token",
  • "expiration_time": "2050-11-11T11:11:11.111+03:00",
  • "permissions": {
    },
  • "visibility_area": "account"
}

Response samples

Content type
application/json
{
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k",
  • "token_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "url": "/6/tokens/557d54ec-29ad-4f3c-93b4-c9092ef12515",
}

get token

Get token by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
token_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

Token ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library
import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="
}
url = f"{baseUri}/tokens"
payload = {"permissions": {"face": ["view"]}, "description": "description", "expiration_time": None}
tokenId = requests.post(url, json=payload, headers=headers).json()["token_id"]

url = f"{baseUri}/tokens/{tokenId}"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "description": "main account token",
  • "expiration_time": "2050-11-11T11:11:11.111+03:00",
  • "permissions": {
    },
  • "visibility_area": "account",
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k",
  • "token_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "create_time": "2018-08-11T09:11:41.674Z",
  • "last_update_time": "2018-08-11T09:11:41.674Z"
}

delete token

Delete token by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
token_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

Token ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library
import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="
}
url = f"{baseUri}/tokens"
payload = {"permissions": {"face": ["view"]}, "description": "description", "expiration_time": None}
tokenId = requests.post(url, json=payload, headers=headers).json()["token_id"]

url = f"{baseUri}/tokens/{tokenId}"
response = requests.delete(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
{}

token options

Get options for the resource.

path Parameters
token_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 8950722f-3fd4-4223-b48f-03f95f0e8dfb

Token ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

credentials verifier

verify credentials

Verify account or login with password or token.

  • In the case of success account id verification, account_type will be returned
  • In the case of success login/password verification, account_id and account_type will be returned
  • In the case of success token verification, account_type and token permissions will be returned
  • In the case of failure verification, error will be returned
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
One of
login
required
string (login) [ 3 .. 128 ] characters ^[a-z0-9_\-\.]+@[a-z]+\.[a-z]{2,}$

Account email.

password
required
string (password) [ 3 .. 128 ] characters ^.{3,128}$

Account password.

Responses

Request samples

Content type
application/json
Example
{
  • "login": "mylogin@gmail.com",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "account_type": "advanced_user",
  • "permissions": {
    },
  • "account_id": "string"
}

credentials verifier options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

sdk

sdk resource

Detect faces and/or human bodies and estimate attributes on the input images. After the request is performed, the received data is not saved to the database or Image Store, it is only returned in the response.

The order of input images corresponds to the order of the elements in the output JSON.

If an input image is corrupted, an error is returned for the image. The processing of the other images continues in normal mode.

Notes for incoming data:

  • face or body bounding boxes passed with face or body warped image will be ignored.
Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
image_type
integer
Default: 0
Enum: 0 1 2

Type of input image. 0 - raw image, 1 - face warped image, 2 - body warped image.

estimate_people_count
integer (int01)
Default: 0
Enum: 0 1

Whether to estimate people count on the image.

âš  People counter licensing feature is required to be enabled to perform estimation.

multiface_policy
integer (multiface_policy)
Default: 1
Enum: 0 1 2

Multiple face detection policy:

  • 0 - do not process images with several detected faces.

    If detect_body is enabled, the system will attempt to detect a human body related to the detected face. If a human body is detected, its detection will be associated with the same event as the face.

    If there is no face detected in the image, no human body detections will be returned. Thus there will be no human body detection returned if detect_face is disabled.

  • 1 - process images with several detected faces and/or human bodies.

    If detect_body is enabled, all the detections of human bodies will be returned. Face detection and human body detection of the same person will be associated with the same event.

    The detections of human bodies are returned even if there were no faces found.

  • 2 - get the best face detection from the image. A single face of the best quality is detected in the image.

    If detect_body is enabled, the system will attempt to detect a human body related to the detected face. If a human body is detected, its detection will be associated with the same event as the face.

    If there is no face detected in the image, no human body detections will be returned. Thus there will be no human body detection returned if detect_face is disabled.

detect_face
integer (detect_face)
Default: 0
Enum: 0 1

Whether to detect faces on the image.

detect_body
integer (detect_body)
Default: 0
Enum: 0 1

Whether to detect human bodies on the image.

estimate_head_pose
integer (estimate_head_pose)
Default: 0
Enum: 0 1

Whether to estimate head pose in the image. The head pose is represented by pitch, yaw and roll angles.

Not supported with warped images (see warped_image or image_type parameter).

estimate_emotions
integer (estimate_emotions)
Default: 0
Enum: 0 1

Whether to estimate emotions in the image. The probability of the following emotions is estimated: "anger", "disgust", "fear", "happiness", "sadness", "surprise", "neutral".

estimate_mask
integer (estimate_mask)
Default: 0
Enum: 0 1

Whether to estimate mask in the image. The probability of the following masks states is estimated: "medical_mask", "missing", "occluded".

The estimated probability with the highest score is returned in the "predominant mask" parameter.

estimate_glasses
integer (estimate_glasses)
Default: 0
Enum: 0 1

Whether to estimate glasses in the image. One of the following parameters is returned: "eyeglasses", "sunglasses", "no_glasses".

estimate_liveness
integer (int01)
Default: 0
Enum: 0 1

Whether to estimate liveness in the image. The "quality" and "score" probabilities are estimated. Based on these probabilities, the following result is returned: "real", "spoof", "unknown".

Liveness is utilized for this estimation. See "Administrator’s manual" for details about Liveness requirements.

âš  Webcam or selfie photos are required. Otherwise the result may be incorrect.

âš  Liveness licensing feature is required to be enabled to perform liveness estimation.

Liveness estimation is not supported for samples (warped images). The image_type parameter should be set to "0".

estimate_deepfake
integer (int01)
Default: 0
Enum: 0 1

Whether to estimate deepfake feature on the image.

âš  Deepfake licensing feature is required to be enabled to perform deepfake estimation.

Not supported with warped images (see warped_image parameter).

estimate_landmarks68
integer (detect_landmarks68)
Default: 0
Enum: 0 1

Whether to detect basic 68-point facial landmarks in the image.

Not supported with warped images (see warped_image or image_type parameter).

estimate_landmarks5
integer (detect_landmarks5)
Default: 0
Enum: 0 1

Whether to detect basic 5-point facial landmarks in the image.

Not supported with warped images (see warped_image or image_type parameter).

estimate_quality
integer (estimate_quality)
Default: 0
Enum: 0 1

Whether to estimate input face image quality. Each of the following probabilities is estimated: "darkness", "light", "blurriness", "illumination", "specularity".

The quality factor is estimated for each probability. It's value is in the range [0..1] where 0 corresponds to low quality and 1 to high quality.

Note. Face recognition is not greatly affected by uneven illumination or high specularity.

estimate_gaze
integer (estimate_gaze)
Default: 0
Enum: 0 1

Whether to estimate gaze in the image. The gaze is represented by yaw angle and pitch angle for both eyes at once.

Not supported with warped images (see warped_image or image_type parameter).

estimate_eyes_attributes
integer (estimate_eyes_attributes)
Default: 0
Enum: 0 1

Whether to estimate eye attributes in the image. The "right_eye" and "left_eye" parameters are estimated, which contain the "state" (opened, closed or occluded) and "iris_landmarks" parameters.

estimate_mouth_attributes
integer (estimate_mouth_attributes)
Default: 0
Enum: 0 1

Whether to estimate mouth attributes in the image. Each of the following probabilities is estimated: "opened", "occluded", "smile", "score".

estimate_face_descriptor
integer (extract_descriptor)
Default: 1
Enum: 0 1
Example: estimate_face_descriptor=1

Whether to estimate face descriptor(s).

estimate_basic_attributes
integer (extract_basic_attributes)
Default: 0
Enum: 0 1

Whether to estimate face basic attributes (gender, age, ethnicity).

estimate_body_descriptor
integer (extract_descriptor)
Default: 1
Enum: 0 1
Example: estimate_body_descriptor=1

Whether to create human body descriptor(s).

estimate_upper_body
integer (int01)
Default: 0
Enum: 0 1

Whether to estimate human upper body on the image (headwear, clothing color, sleeve length).

estimate_lower_body
integer (int01)
Default: 0
Enum: 0 1

Whether to estimate human lower body on the image (lower garment, shoes).

estimate_accessories
integer (int01)
Default: 0
Enum: 0 1

Whether to estimate human body accessories on the image (backpack presence).

estimate_body_basic_attributes
integer (int01)
Default: 0
Enum: 0 1

Whether to estimate human body basic attributes on the image (age, gender).

estimate_body_warp
integer (estimate_body_warp)
Default: 0
Enum: 0 1

Whether to create a human body warped image in the Base64 format.

estimate_face_warp
integer (estimate_face_warp)
Default: 0
Enum: 0 1

Whether to create the face warped image in the Base64 format.

aggregate_attributes
integer (aggregate_attributes)

Whether to aggregate the following parameters:

  • face descriptor
  • body descriptor
  • face basic attributes (age, gender)
  • body basic attributes (apparent age, apparent gender)
  • mask states
  • emotions
  • liveness
  • deepfake
  • upper body attributes
  • lower body attributes
  • accessories

Aggregation will be performed only if the appropriate parameters for estimating the listed above parameters are enabled.

If set, all estimated parameters from each image will be aggregated and displayed in the aggregate_estimations field of the response body as single objects for all images.

Otherwise, all estimated parameters from each image will be displayed in the estimations field of the response body as separate objects for corresponding images.

pitch_threshold
integer (pitch_threshold) [ 0 .. 180 ]
Example: pitch_threshold=180

Maximum deviation pitch angle from 0. If the estimated value is equal or less than the threshold, the image is filtered.

Remove this parameter from the query, or set the parameter value to 180 if pitch angle filtration is not required.

When the value is set to "0", all the images are filtered.

roll_threshold
integer (roll_threshold) [ 0 .. 180 ]
Example: roll_threshold=180

Maximum deviation roll angle from 0. If the estimated value is equal or less than the threshold, the image is filtered.

Remove this parameter from the query, or set the parameter value to 180 if roll angle filtration is not required.

When the value is set to "0", all the images are filtered.

yaw_threshold
integer (yaw_threshold) [ 0 .. 180 ]
Example: yaw_threshold=180

Maximum deviation yaw angle from 0. If the estimated value is equal or less than the threshold, the image is filtered.

Remove this parameter from the query, or set the parameter value to 180 if yaw angle filtration is not required.

When the value is set to "0", all the images are filtered.

score_threshold
number (score_threshold) [ 0 .. 1 ]
Default: 0
Example: score_threshold=0.7

Descriptor quality score threshold. The higher the quality score for the image, the better the extraction results.

All the attributes with a quality score below the threshold will be ignored (and not stored in the DB). The function will proceed as usual with all the remaining descriptors (if left).

Consult VisionLabs about the recommended value of this parameter.

Note! This parameter is not related to the image quality estimated in the detect request (estimate_quality request parameter).

mask_states
Array of integers (mask_states) non-empty
Items Enum: 1 2 3
Example: mask_states=2&mask_states=3

Filter by mask states.

mask state value
missing 1
medical_mask 2
occluded 3
liveness_states
Array of integers (liveness_states) non-empty
Items Enum: 0 1 2
Example: liveness_states=1

Filter by liveness states.

liveness state value
spoof 0
real 1
unknown 2
deepfake_states
Array of integers (deepfake_states) non-empty
Items Enum: 0 1
Example: deepfake_states=1

Filter by deepfake states.

deepfake state value
fake 0
real 1
use_exif_info
integer
Default: 1
Enum: 0 1
Example: use_exif_info=1

Whether to try to auto orient image based on EXIF data.

The processed image should have EXIF data, otherwise auto orientation will not be performed.

Has no effect with tiff images (they're always auto oriented).

Ignored with warped images (see warped_image or image_type parameter).

extract_exif
integer (extract_exif)
Default: 0
Enum: 0 1

Whether to extract EXIF meta information from input JPEG images.

Exact output will vary since there are no mandatory requirements for both authoring software and digital cameras how to write the data.

This function will only parse the tags and output their names and values as they are. Please refer to JEITA CP-3451 EXIF specification for details.

header Parameters
Accept
string
Enum: "application/json" "application/msgpack"

Accept request header.

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Enum: "application/json" "multipart/form-data" "image/jpeg" "image/png" "image/bmp" "image/x-portable-pixmap" "image/tiff" "image/x-jpeg-base64" "image/x-png-base64" "image/x-bmp-base64" "image/x-tiff-base64" "image/x-portable-pixmap-base64"
Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema:
string <binary>

Responses

Request samples

Content type
No sample

Response samples

Content type
Example
{
  • "images_estimations": [
    ]
}

sdk options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

iso

iso resource

The resource performs a visual examination of frontal type images based on ISO/IEC 19794-5 standard. This means that the images that have passed the validation are standardized and attributes of the person's face meet the established requirements. For more information on the requirements for face attributes in the image, see ISO/IEC 19794-5 Clauses 7-10.

The output JSON contains the result of the check for each estimator. The image check is considered successful if the set of these results complies with the ISO standard.

The order of input images is corresponding to elements order in output JSON. If an image is broken, the resource will return an error for this image and other images will be correctly processed.

Notes for incoming data:

  • face or body bounding boxes passed with face or body warped image will be ignored.
Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
image_type
integer
Default: 0
Enum: 0 1

Image type of input image. 0 - raw image, 1 - face warped image.

multiface_policy
integer (iso_multiface_policy)
Default: 0
Enum: 0 1 2

multiple face detection policy:

  • 0 - multiple face detection not allowed

  • 1 - multiple face detection allowed

  • 2 - get only best face detection from the image

extract_exif
integer (extract_exif)
Default: 0
Enum: 0 1

Whether to extract EXIF meta information from input JPEG images.

Exact output will vary since there are no mandatory requirements for both authoring software and digital cameras how to write the data.

This function will only parse the tags and output their names and values as they are. Please refer to JEITA CP-3451 EXIF specification for details.

header Parameters
Accept
string
Enum: "application/json" "application/msgpack"

Accept request header.

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Enum: "application/json" "multipart/form-data" "image/jpeg" "image/png" "image/bmp" "image/x-portable-pixmap" "image/tiff" "image/x-jpeg-base64" "image/x-png-base64" "image/x-bmp-base64" "image/x-tiff-base64" "image/x-portable-pixmap-base64"
Request Body schema:
string <binary>

Responses

Request samples

Content type
No sample

Response samples

Content type
Example
{
  • "images": [
    ]
}

iso options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

samples

detect faces

Detect faces in input images, create samples, and estimate face properties.

Detections can be filtered out by head pose. The pose is defined by yaw, pitch and roll angles. To specify a filtering threshold per-angle, use corresponding query parameters (yaw_threshold, pitch_threshold and roll_threshold). By default no filtering is applied.

The estimated face properties are not saved to the Faces database. They are only returned in the response.

Samples are saved in the storage without the ability to disable saving. You can disable the saving of samples only using the handlers.

Notes for incoming data:

  • face or body bounding boxes passed with face or body warped image will be ignored.
Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
multiface_policy
integer (multiface_policy)
Default: 1
Enum: 0 1 2

Multiple face detection policy:

  • 0 - multiple face detection not allowed;

  • 1 - multiple face detection allowed;

  • 2 - get only best face detection from the image.

estimate_head_pose
integer (estimate_head_pose)
Default: 0
Enum: 0 1

Whether to estimate head pose in the image. The head pose is represented by pitch, yaw and roll angles.

Not supported with warped images (see warped_image or image_type parameter).

estimate_emotions
integer (estimate_emotions)
Default: 0
Enum: 0 1

Whether to estimate emotions in the image. The probability of the following emotions is estimated: "anger", "disgust", "fear", "happiness", "sadness", "surprise", "neutral".

estimate_mask
integer (estimate_mask)
Default: 0
Enum: 0 1

Whether to estimate mask in the image. The probability of the following masks states is estimated: "medical_mask", "missing", "occluded".

The estimated probability with the highest score is returned in the "predominant mask" parameter.

detect_landmarks68
integer (detect_landmarks68)
Default: 0
Enum: 0 1

Whether to detect basic 68-point facial landmarks in the image. Not supported with warped images (see warped_image parameter).

extract_exif
integer (extract_exif)
Default: 0
Enum: 0 1

Whether to extract EXIF meta information from input JPEG images.

Exact output will vary since there are no mandatory requirements for both authoring software and digital cameras how to write the data.

This function will only parse the tags and output their names and values as they are. Please refer to JEITA CP-3451 EXIF specification for details.

estimate_quality
integer (estimate_quality)
Default: 0
Enum: 0 1

Whether to estimate input face image quality. Each of the following probabilities is estimated: "darkness", "light", "blurriness", "illumination", "specularity".

The quality factor is estimated for each probability. It's value is in the range [0..1] where 0 corresponds to low quality and 1 to high quality.

Note. Face recognition is not greatly affected by uneven illumination or high specularity.

estimate_gaze
integer (estimate_gaze)
Default: 0
Enum: 0 1

Whether to estimate gaze in the image. The gaze is represented by yaw angle and pitch angle for both eyes at once.

Not supported with warped images (see warped_image or image_type parameter).

estimate_eyes_attributes
integer (estimate_eyes_attributes)
Default: 0
Enum: 0 1

Whether to estimate eye attributes in the image. The "right_eye" and "left_eye" parameters are estimated, which contain the "state" (opened, closed or occluded) and "iris_landmarks" parameters.

estimate_mouth_attributes
integer (estimate_mouth_attributes)
Default: 0
Enum: 0 1

Whether to estimate mouth attributes in the image. Each of the following probabilities is estimated: "opened", "occluded", "smile", "score".

pitch_threshold
integer (pitch_threshold) [ 0 .. 180 ]
Example: pitch_threshold=180

Maximum deviation pitch angle from 0. If the estimated value is equal or less than the threshold, the image is filtered.

Remove this parameter from the query, or set the parameter value to 180 if pitch angle filtration is not required.

When the value is set to "0", all the images are filtered.

roll_threshold
integer (roll_threshold) [ 0 .. 180 ]
Example: roll_threshold=180

Maximum deviation roll angle from 0. If the estimated value is equal or less than the threshold, the image is filtered.

Remove this parameter from the query, or set the parameter value to 180 if roll angle filtration is not required.

When the value is set to "0", all the images are filtered.

yaw_threshold
integer (yaw_threshold) [ 0 .. 180 ]
Example: yaw_threshold=180

Maximum deviation yaw angle from 0. If the estimated value is equal or less than the threshold, the image is filtered.

Remove this parameter from the query, or set the parameter value to 180 if yaw angle filtration is not required.

When the value is set to "0", all the images are filtered.

warped_image
integer (warped_image)
Default: 0
Enum: 0 1

Whether an input image is a sample or not.

use_exif_info
integer
Default: 1
Enum: 0 1
Example: use_exif_info=1

Whether to try to auto orient image based on EXIF data.

The processed image should have EXIF data, otherwise auto orientation will not be performed.

Has no effect with tiff images (they're always auto oriented).

Ignored with warped images (see warped_image or image_type parameter).

estimate_face_quality
integer
Default: 0
Enum: 0 1

Whether to estimate face quality.

It enables you to perform various face quality checks by thresholds which similar to ISO standard. For more information on the requirements for face attributes in the image, see ISO/IEC 19794-5 Clauses 7-10.

âš  ISO licensing feature is required to be enabled to perform face quality estimation.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Enum: "image/jpeg" "image/png" "image/bmp" "image/x-portable-pixmap" "image/tiff" "multipart/form-data" "application/json" "image/x-jpeg-base64" "image/x-png-base64" "image/x-bmp-base64" "image/x-tiff-base64" "image/x-portable-pixmap-base64"
Request Body schema:
string <binary>

Responses

Request samples

Content type
No sample

Response samples

Content type
application/json
Example
{
  • "images": [
    ]
}

detector options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

save face/body sample

Save face or body sample to the storage.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
samples_type
required
string
Enum: "faces" "bodies"

Samples type.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Enum: "image/jpeg" "image/png" "image/bmp" "image/tiff" "image/x-portable-pixmap"
Request Body schema:
One of
string <binary> (face_sample)

Image generated by VisionLabs algorithms.

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("face_warp.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/samples/faces"
response = requests.post(url, data=image, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "sample_id": "b5d6fd45-fcca-453d-ac05-3e594054b813",
  • "url": "/6/samples/bodies/b5d6fd45-fcca-453d-ac05-3e594054b813"
}

face/body samples options

Get options for the resource.

path Parameters
samples_type
required
string
Enum: "faces" "bodies"

Samples type.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get face/body sample

Get face or body sample by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
samples_type
required
string
Enum: "faces" "bodies"

Samples type.

sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create sample
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("face_warp.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/samples/faces"
sampleId = requests.post(url, data=image, headers=headers).json()["sample_id"]

# get sample
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/samples/faces/{sampleId}"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
Example
{}

check if face/body sample exists

Check if face or body sample with sample_id exists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
samples_type
required
string
Enum: "faces" "bodies"

Samples type.

sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create sample
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("face_warp.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/samples/faces"
sampleId = requests.post(url, data=image, headers=headers).json()["sample_id"]

# get sample
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/samples/faces/{sampleId}"
response = requests.head(url, headers=headers)

print(response.status_code)

remove face/body sample

Remove face or body sample by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
samples_type
required
string
Enum: "faces" "bodies"

Samples type.

sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create sample
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("face_warp.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/samples/faces"
sampleId = requests.post(url, data=image, headers=headers).json()["sample_id"]

# get sample
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/samples/faces/{sampleId}"
response = requests.delete(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
Example
{}

face/body sample options

Get options for the resource.

path Parameters
samples_type
required
string
Enum: "faces" "bodies"

Samples type.

sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get sample | previous version Deprecated

Get sample by ID using previous API version.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Response samples

Content type
application/json
Example
{}

check if sample exists | previous version Deprecated

Check if face or body sample with sample_id exists using previous API version.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

remove sample | previous version Deprecated

Remove sample by ID using previous API version.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Response samples

Content type
application/json
Example
{}

sample options | previous version Deprecated

Get options for the resource using previous API version.

path Parameters
sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get sample | legacy Deprecated

Get a face sample by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Response samples

Content type
application/json
Example
{}

check if face sample exists | legacy Deprecated

Check if face sample with sample_id exists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

remove face sample | legacy Deprecated

Remove sample by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Response samples

Content type
application/json
Example
{}

face sample options | legacy Deprecated

Get options for the resource.

path Parameters
sample_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

images

create images

Save images with unique ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Enum: "image/jpeg" "image/png" "image/bmp" "image/tiff" "image/x-portable-pixmap"

Type of transferring image.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

* (X-Luna-Meta-<user_defined_key>)
string
Example: <user_defined_value>

User-defined image metadata key-value. To store metadata values for multiple keys, the multiple headers should be defined.

Request Body schema:
string <binary> (binary_image)

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("face_warp.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/images"
response = requests.post(url, data=image, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{}

images options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

check if image exists

Check if image with image_id exists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
image_id
required
string <uuid> (image_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Image ID.

query Parameters
with_meta
integer
Default: 0
Enum: 0 1
Example: with_meta=1

Whether to retrieve user-defined image metadata.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create sample
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("face_warp.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/images"
imageId = requests.post(url, data=image, headers=headers).json()["image_id"]

# get image
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/images/{imageId}"
response = requests.head(url, headers=headers)

print(response.status_code)

delete image

Delete an image.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
image_id
required
string <uuid> (image_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Image ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create sample
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("face_warp.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/images"
imageId = requests.post(url, data=image, headers=headers).json()["image_id"]

# get image
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/images/{imageId}"
response = requests.delete(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
Example
{}

get image

Receive an origin image.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
image_id
required
string <uuid> (image_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Image ID.

query Parameters
with_meta
integer
Default: 0
Enum: 0 1
Example: with_meta=1

Whether to retrieve user-defined image metadata.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create sample
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("face_warp.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/images"
imageId = requests.post(url, data=image, headers=headers).json()["image_id"]

# get image
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/images/{imageId}"
response = requests.get(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
Example
{}

image options

Get options for the resource.

path Parameters
image_id
required
string <uuid> (image_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Image ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

objects

create objects

Save object with unique ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
required
string

Type of transferring information.

WARNING A value of this header will be used as a Content-Type header value for requests "GET object" and will be use for a mime type calculation.

Request Body schema: */*
string <binary>

Some user defined bytes. The service saves the bytes as is.

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "text/plain",
}

url = f"{baseUri}/objects"
response = requests.post(url, data="example", headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{}

objects options

Get options for the resource.

header Parameters
Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get object

Receiving objects.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
object_id
required
string <uuid> (object_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Object ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create objects
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "text/plain",
}

url = f"{baseUri}/objects"
objectId = requests.post(url, data="example", headers=headers).json()["object_id"]

# get object
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/objects/{objectId}"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.text)

Response samples

Content type
application/json
{}

check if object exists

Check if object with object_id exists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
object_id
required
string <uuid> (object_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Object ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create object
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "text/plain",
}

url = f"{baseUri}/objects"
objectId = requests.post(url, data="example", headers=headers).json()["object_id"]

# check objects
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/objects/{objectId}"
response = requests.head(url, headers=headers)

print(response.status_code)

delete object

Delete object

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
object_id
required
string <uuid> (object_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Object ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create object
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "text/plain",
}

url = f"{baseUri}/objects"
objectId = requests.post(url, data="example", headers=headers).json()["object_id"]

# get object
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/objects/{objectId}"
response = requests.delete(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
Example
{}

object options

Get options for the resource.

path Parameters
object_id
required
string <uuid> (object_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Object ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

attributes

extract attributes

Extract descriptors and basic attributes from samples.

All the extracted attributes are temporary.

Temporary attributes have a TTL (time to live) and will be removed from the database after the specified period.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
score_threshold
number (score_threshold) [ 0 .. 1 ]
Default: 0
Example: score_threshold=0.7

Descriptor quality score threshold. The higher the quality score for the image, the better the extraction results.

All the attributes with a quality score below the threshold will be ignored (and not stored in the DB). The function will proceed as usual with all the remaining descriptors (if left).

Consult VisionLabs about the recommended value of this parameter.

Note! This parameter is not related to the image quality estimated in the detect request (estimate_quality request parameter).

extract_descriptor
integer (extract_descriptor)
Default: 1
Enum: 0 1
Example: extract_descriptor=1

Whether to extract face descriptor(s).

extract_basic_attributes
integer (extract_basic_attributes)
Default: 0
Enum: 0 1

Whether to extract basic attributes (gender, age, ethnicity).

aggregate_attributes
integer (aggregate_attributes)

Whether to aggregate face attributes (descriptor and basic attributes). Aggregation will only be performed together with the extract_descriptor and/or extract_basic_attributes parameters.

If set, all extracted attributes from each image will be aggregated and stored as single objects.

Otherwise, all extracted attributes from each image will be stored for each sample as separate objects.

ttl
integer [ 1 .. 86400 ]
Default: 300

Lifetime for temporary attribute (seconds).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
Array ([ 1 .. 8 ] items)
string <uuid> (sample_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...

Sample ID.

Responses

Request samples

Content type
application/json
[
  • "f9f03668-27e3-4e23-9b55-681e5927905e",
  • "4967ccb7-b521-43b5-93ba-a0d266631bb2",
  • "dd98cf9c-ddf3-4962-a3c5-e8bd540a4fc7"
]

Response samples

Content type
application/json
Example
[
  • {
    },
  • {
    },
  • {
    }
]

extractor options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

create temporary attribute

New temporary attributes creation.

Note. Use this request when you need to add basic attributes or descriptors from external storage. Otherwise, use the extract attributes request.

All the extracted attributes are temporary.

Temporary attributes have a TTL (time to live) and will be removed from the database after the specified period.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
ttl
integer [ 1 .. 86400 ]
Default: 300

Lifetime for temporary attribute (seconds).

header Parameters
Content-Type
string
Enum: "application/json" "multipart/form-data"

Content type is application/json or multipart/form-data.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Request Body schema:
One of
required
Array of descriptor_data (object) or raw_descriptor_base64 (string) (face_descriptors) non-empty

List of descriptors with versions. Each descriptor is aggregated from the provided samples.

face_descriptor_samples
Array of strings <uuid> (attributes_samples) >= 0 items unique
Default: []

List of uniqie sample IDs which are resources for the estimated attributes.

WARNING: if the user does not set any attributes samples, faces with such attributes will be skipped during the process of updating attributes using new estimation algorithm.

required
object (basic_attributes_without_defaults)

Basic attributes.

basic_attributes_samples
Array of strings <uuid> (attributes_samples) >= 0 items unique
Default: []

List of uniqie sample IDs which are resources for the estimated attributes.

WARNING: if the user does not set any attributes samples, faces with such attributes will be skipped during the process of updating attributes using new estimation algorithm.

Responses

Request samples

Content type
Example
{
  • "face_descriptors": [
    ],
  • "face_descriptor_samples": [
    ],
  • "basic_attributes": {
    },
  • "basic_attributes_samples": [
    ]
}

Response samples

Content type
application/json
{}

get temporary attributes

Get temporary attributes by IDs.

For each attribute:

  • If the attribute TTL has not expired, the attribute data is returned.

  • If the TTL has expired, no data is returned for this attribute in the response.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
attribute_ids
required
string <list of uuid>

Comma-separated list of attribute IDs.

account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

targets
string <comma-separated items>
Default: "create_time, attribute_id, account_id, face_descriptor_samples, basic_attributes_samples, face_descriptor, basic_attributes_samples"
Example: targets=basic_attributes,basic_attributes_samples,account_id

Comma-separated list of temporary attributes targets. All targets are available by default.

descriptor_version
integer (descriptor_version)
Enum: 46 52 54 56 57 58 59 60
Example: descriptor_version=56

Descriptor version returned in the response. By default, the LUNA PLATFORM default descriptor version is used.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create attribute
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
payload = {
    "basic_attributes": {
        "age": 29,
        "gender": 0,
        "ethnicity": 3,
    },
}

url = f"{baseUri}/attributes"
attributeId = requests.post(url, json=payload, headers=headers).json()["attribute_id"]

# get attributes
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

params = {
    "attribute_ids": [
        attributeId,
    ],
    "targets": "basic_attributes,basic_attributes_samples,account_id",
}

url = f"{baseUri}/attributes"
response = requests.get(
    url, headers=headers, params=params
)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
Example
{
  • "attributes": [
    ]
}

temporary attributes options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get temporary attribute

Get temporary attribute by ID.

If the attribute TTL has not expired, the attribute data is returned.

Otherwise, the "Attributes not found" error is returned.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
attribute_id
required
string <uuid> (attribute_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the temporary attribute.

query Parameters
descriptor_version
integer (descriptor_version)
Enum: 46 52 54 56 57 58 59 60
Example: descriptor_version=56

Descriptor version returned in the response. By default, the LUNA PLATFORM default descriptor version is used.

targets
string <comma-separated items>
Default: "create_time, attribute_id, account_id, face_descriptor_samples, basic_attributes_samples, face_descriptor, basic_attributes_samples"
Example: targets=basic_attributes,basic_attributes_samples,account_id

Comma-separated list of temporary attributes targets. All targets are available by default.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create attribute
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
payload = {
    "basic_attributes": {
        "age": 29,
        "gender": 1,
        "ethnicity": 3,
    },
}

url = f"{baseUri}/attributes"
attributeId = requests.post(url, json=payload, headers=headers).json()["attribute_id"]

# get attributes
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"{baseUri}/attributes/{attributeId}"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
Example
{
  • "create_time": "2021-08-11T14:57:18.416928+03:00",
  • "attribute_id": "7fdf9225-3c06-4c21-b774-8bea99bcce20",
  • "account_id": "0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c",
  • "face_descriptor_samples": [
    ],
  • "basic_attributes_samples": [
    ],
  • "face_descriptor": "2xQ2gprbMUePw1s9gw9fvA==",
  • "basic_attributes": {
    }
}

check temporary attribute

Check if temporary attribute with attribute_id exists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
attribute_id
required
string <uuid> (attribute_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the temporary attribute.

query Parameters
descriptor_version
integer (descriptor_version)
Enum: 46 52 54 56 57 58 59 60
Example: descriptor_version=56

Descriptor version returned in the response. By default, the LUNA PLATFORM default descriptor version is used.

targets
string <comma-separated items>
Default: "create_time, attribute_id, account_id, face_descriptor_samples, basic_attributes_samples, face_descriptor, basic_attributes_samples"
Example: targets=basic_attributes,basic_attributes_samples,account_id

Comma-separated list of temporary attributes targets. All targets are available by default.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create attribute
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
payload = {
    "basic_attributes": {
        "age": 29,
        "gender": 1,
        "ethnicity": 3,
    },
}

url = f"{baseUri}/attributes"
attributeId = requests.post(url, json=payload, headers=headers).json()["attribute_id"]

# get attributes
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"{baseUri}/attributes/{attributeId}"
response = requests.head(url, headers=headers)

print(response.status_code)

delete attribute

Delete the attribute by its ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
attribute_id
required
string <uuid> (attribute_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the temporary attribute.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

# create attribute
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
payload = {
    "basic_attributes": {
        "age": 29,
        "gender": 1,
        "ethnicity": 3,
    },
}

url = "http://127.0.0.1:5000/6/attributes"
attributeId = requests.post(url, json=payload, headers=headers).json()["attribute_id"]

# get attributes
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"http://127.0.0.1:5000/6/attributes/{attributeId}"
response = requests.delete(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
Example
{}

temporary attributes attribute options

Get options for the resource.

path Parameters
attribute_id
required
string <uuid> (attribute_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the temporary attribute.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get temporary attribute samples

Get all the temporary attribute samples by the attribute ID.

If the attribute TTL has not expired, the attribute data is returned.

Otherwise, the "Attributes not found" error is returned.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
attribute_id
required
string <uuid> (attribute_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the temporary attribute.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create sample
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("image.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/detector"
sampleId = requests.post(url, data=image, headers=headers).json()["images"][0]["detections"]["samples"][0]["face"]["sample_id"]

# exreact attr
# create attribute
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
payload = {
    "basic_attributes": {
        "age": 29,
        "gender": 1,
        "ethnicity": 3,
    },
    "basic_attributes_samples": [
        sampleId,
    ],
}

url = f"{baseUri}/attributes"
attributeId = requests.post(url, json=payload, headers=headers).json()["attribute_id"]

# get attributes by id
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"{baseUri}/attributes/{attributeId}/samples"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "samples": [
    ]
}

temporary attribute samples options

Get options for the resource.

path Parameters
attribute_id
required
string <uuid> (attribute_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the temporary attribute.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

faces

create face

Create a face.

The face can be attached to one or several lists.

You can create new face using a temporary attribute ID or using external attribute data (descriptors and/or basic attributes).

You can also create the face without any attributes specified.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Enum: "application/json" "application/msgpack"

Format of a request body data.

Request Body schema:
attribute_set_by_attribute_id (object) or (attribute_no_account (attribute_with_descriptors_and_basic_attributes_no_account (object) or attribute_with_basic_attributes_no_account (object) or attribute_with_descriptors_no_account (object))) (face_attribute)

Face attributes.

You can specify attributes for the face using one of several ways:

  • by specifying the attribute ID of a temporary attribute

  • by specifying descriptors and basic attributes (with or without samples)

  • by specifying descriptors (with or without samples)

  • by specifying basic attributes (with or without samples)

The last three ways are used when you need to create the face using data stored in external storage.

external_id
string (face_external_id) <= 36 characters
Default: ""

User-defined external ID for the face. External ID can be used to link several faces which belong to one person.

user_data
string (face_user_data) <= 128 characters
Default: ""

User data associated with face.

avatar
string <uri-reference> (avatar) <= 256 characters
Default: ""

Avatar is a visual representation of the face.

The avatar can be used in the user interface.

You can use a sample or an external image as the avatar.

lists
Array of strings <uuid> (list_id) non-empty

Lists for linking face with them.

event_id
string <uuid> (event_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...

The event ID associated with the face creation.

Responses

Request samples

Content type
Example
{}

Response samples

Content type
application/json
{}

get faces

Get faces according to filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

create_time__lt
string <date-time> (time)
Example: create_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object create_time.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object create_time.

event_id
string <uuid> (event_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: event_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Event ID associated with the face creation.

face_id__lt
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: face_id__lt=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Face ID upper excluded bound. Faces in response will be sorted by their ids. If neither face_id__lt or face_id__gte is specified, the faces will be sorted by creation time.

face_id__gte
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: face_id__gte=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Face ID lower included bound. Faces in response will be sorted by their ids. If neither face_id__lt or face_id__gte is specified, the faces will be sorted by creation time.

face_ids
string <list of uuid>
Example: face_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of face IDs.

external_ids
string
Example: external_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of external IDs.

user_data
string
Example: user_data=user_data_text

Find all objects with user_data similar to this parameter. You can specify only part of the user_data value for this filter.

list_id
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: list_id=557d54ec-29ad-4f3c-93b4-c9092ef12515

List ID that contains faces.

targets
Array of strings (faces_targets)
Items Enum: "face_id" "account_id" "event_id" "user_data" "create_time" "external_id" "avatar" "lists"
Example: targets=face_id,user_data

Comma-separated list of face fields. If set, each face from result will contain only specified fields, otherwise, faces with all the fields will be returned.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces"
params = {
    "create_time__gte": "2018-08-11T09:11:41.674Z",
    "user_data": "face",
    "targets": "face_id,account_id,event_id,user_data,create_time",
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "faces": [
    ]
}

delete faces

Delete several faces by IDs.

When the faces are removed, attributes (descriptors and basic attributes) linked to the faces are deleted. Samples linked to the faces are not deleted.

If you need to delete faces according to some filters and with all samples, you can use the "garbage collection task" with target = faces and remove_samples flag enabled.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
ignore
integer (int01)
Default: 0
Enum: 0 1

Whether to ignore the error if the face to be deleted does not exist.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
face_ids
required
Array of strings <uuid> (face_id) non-empty

Comma-separated list of face IDs for removal.

Responses

Request samples

Content type
application/json
{
  • "face_ids": [
    ]
}

Response samples

Content type
application/json
{}

faces options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get face count

Count faces according to the filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

create_time__lt
string <date-time> (time)
Example: create_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object create_time.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object create_time.

face_ids
string <list of uuid>
Example: face_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of face IDs.

face_id__lt
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: face_id__lt=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Face ID upper excluded bound

face_id__gte
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: face_id__gte=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Face ID lower included bound

event_id
string <uuid> (event_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: event_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Event ID associated with the face creation.

external_ids
string
Example: external_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of external IDs.

user_data
string
Example: user_data=user_data_text

Find all objects with user_data similar to this parameter. You can specify only part of the user_data value for this filter.

list_id
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: list_id=557d54ec-29ad-4f3c-93b4-c9092ef12515

List ID that contains faces.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces/count"
params = {
    "create_time__gte": "2018-08-11T09:11:41.674Z",
    "user_data": "face",
}
response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "faces_count": 7
}

faces count options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get count of faces with attributes

Count faces with attributes.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces/attributes/count"

response = requests.get(
    url,
    headers=headers,
)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "faces_count": 7
}

get count of faces with attributes options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get face

Get face by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

query Parameters
targets
Array of strings (faces_targets)
Items Enum: "face_id" "account_id" "event_id" "user_data" "create_time" "external_id" "avatar" "lists"
Example: targets=face_id,user_data

Comma-separated list of face fields. If set, each face from result will contain only specified fields, otherwise, faces with all the fields will be returned.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces"
faceId = requests.post(url, headers=headers).json()["face_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"{baseUri}/faces/{faceId}"
response = requests.get(
    url,
    headers=headers,
)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "face_id": "426542d6-5509-4e5b-8a01-e2abd5c0a8c6",
  • "account_id": "b668c4a5-2191-476e-a261-3b4f9ce2e25e",
  • "event_id": "f9687459-986b-406d-9c1f-0d6289be5256",
  • "user_data": "fox1991",
  • "create_time": "2018-08-11T09:11:41.674Z",
  • "external_id": "2xQ2gprbMUePw1s9gw9fvA==",
  • "lists": [
    ]
}

patch face

Update face fields: user_data, external_id, event_id, avatar.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
external_id
string <= 36 characters

User-defined external ID for the face.

event_id
string or null <uuid> (event_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...

Event ID.

user_data
string <= 128 characters

User data associated with face.

avatar
string <uri-reference> (avatar) <= 256 characters
Default: ""

Avatar is a visual representation of the face.

The avatar can be used in the user interface.

You can use a sample or an external image as the avatar.

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{}

remove face

Remove face by ID.

When the face is removed, attributes (descriptors and basic attributes) linked to the face are deleted. Samples linked to the face are not deleted. If there are a small number of samples for face, then you can use the resources "get face attribute samples" > "remove face/body sample" > "delete face" (this resource). If you need to delete faces according to some filters and with all samples, you can use the "garbage collection task" with target = faces and remove_samples flag enabled.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}
url = f"{baseUri}/faces"
faceId = requests.post(
    url,
    headers=headers,
).json()["face_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces/{faceId}"
response = requests.delete(
    url,
    headers=headers,
)

print(response.status_code)

Response samples

Content type
application/json
Example
{}

check if face exists

Check if face with face_id exists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

query Parameters
targets
Array of strings (faces_targets)
Items Enum: "face_id" "account_id" "event_id" "user_data" "create_time" "external_id" "avatar" "lists"
Example: targets=face_id,user_data

Comma-separated list of face fields. If set, each face from result will contain only specified fields, otherwise, faces with all the fields will be returned.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces"
faceId = requests.post(
    url,
    headers=headers,
).json()["face_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces/{faceId}"
response = requests.head(
    url,
    headers=headers,
)

print(response.status_code)

face options

Get options for the resource.

path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

face attributes

put face attribute

Put face attribute.

This request changes all the attribute data corresponding to the specified face.

The attribute can be specified by temporary attribute ID or using external attribute data (descriptors and/or basic attributes).

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
One of
attribute_id
required
string <uuid> (attribute_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...

Attribute ID. This ID links the descriptor, basic attributes, and samples extracted from a single image.

Responses

Request samples

Content type
application/json
Example
{
  • "attribute_id": "b668c4a5-2191-476e-a261-3b4f9ce2e25e"
}

Response samples

Content type
application/json
Example
{}

get face attribute

Get face attribute by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

query Parameters
targets
string <comma-separated items>
Default: "create_time,basic_attributes,basic_attributes_samples,face_descriptor,face_descriptor_samples"

Comma-separated list of temporary attributes targets. Available targets: create_time, basic_attributes, basic_attributes_samples, face_descriptor, face_descriptor_samples.

descriptor_version
integer (descriptor_version)
Enum: 46 52 54 56 57 58 59 60
Example: descriptor_version=56

Descriptor version returned in the response. By default, the LUNA PLATFORM default descriptor version is used.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import base64

baseUri = "http://127.0.0.1:5000/6"

# create sample
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("image.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/detector"
sampleId = requests.post(url, data=image, headers=headers).json()["images"][0]["detections"]["samples"][0]["face"]["sample_id"]

# create attribute
with open("descriptor56", "rb") as file:
    descriptor = base64.b64encode(file.read()).decode()

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
params = {
    "ttl": 600,
}
payload = {
    "basic_attributes": {
        "age": 29,
        "gender": 0,
        "ethnicity": 3,
    },
    "basic_attributes_samples": [
        sampleId,
    ],
    "face_descriptor_samples": [
        sampleId,
    ],
    "face_descriptors": [
        {"descriptor": descriptor, "version": 56},
    ],
}
url = f"{baseUri}/attributes"
attributeId = requests.post(
    url, json=payload, headers=headers, params=params
).json()["attribute_id"]

# create face
payload = {
    "external_id": "2xQ2gprbMUePw1s9gw9fvA==",
    "attribute": {"attribute_id": attributeId},
}
headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}
url = f"{baseUri}/faces"
faceId = requests.post(
    url,
    headers=headers,
    json=payload,
).json()["face_id"]

# get face attribute by ID
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces/{faceId}/attributes"
response = requests.get(
    url,
    headers=headers,
)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "attributes": {
    }
}

delete face attribute

Remove face attribute by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import base64

baseUri = "http://127.0.0.1:5000/6"

# create sample
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}
with open("image.jpg", "rb") as image_file:
    image = image_file.read()
url = f"{baseUri}/detector"
sampleId = requests.post(url, data=image, headers=headers).json()["images"][0]["detections"]["samples"][0]["face"]["sample_id"]

# create attribute
with open("descriptor56", "rb") as file:
    descriptor = base64.b64encode(file.read()).decode()

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
params = {
    "ttl": 600,
}
payload = {
    "basic_attributes": {
        "age": 29,
        "gender": 0,
        "ethnicity": 3,
    },
    "basic_attributes_samples": [
        sampleId,
    ],
    "face_descriptor_samples": [
        sampleId,
    ],
    "face_descriptors": [
        {"descriptor": descriptor, "version": 56},
    ],
}
url = f"{baseUri}/attributes"
attributeId = requests.post(
    url, json=payload, headers=headers, params=params
).json()["attribute_id"]

payload = {
    "external_id": "2xQ2gprbMUePw1s9gw9fvA==",
    "attribute": {"attribute_id": attributeId},
}

# create face
headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}
url = f"{baseUri}/faces"
faceId = requests.post(
    url,
    headers=headers,
    json=payload,
).json()["face_id"]

# get face attribute by ID
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces/{faceId}/attributes"
response = requests.delete(
    url,
    headers=headers,
)

print(response.status_code)

Response samples

Content type
application/json
{}

faces attributes options

Get options for the resource.

path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get face attribute samples

Get face attribute samples by face ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import base64

baseUri = "http://127.0.0.1:5000/6"

# create sample
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
}

with open("image.jpg", "rb") as image_file:
    image = image_file.read()

url = f"{baseUri}/detector"
sampleId = requests.post(url, data=image, headers=headers).json()["images"][0]["detections"]["samples"][0]["face"]["sample_id"]

# create attribute
with open("descriptor56", "rb") as file:
    descriptor = base64.b64encode(file.read()).decode()

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
params = {
    "ttl": 600,
}
payload = {
    "basic_attributes": {
        "age": 29,
        "gender": 0,
        "ethnicity": 3,
    },
    "basic_attributes_samples": [
        sampleId,
    ],
    "face_descriptor_samples": [
        sampleId,
    ],
    "face_descriptors": [
        {"descriptor": descriptor, "version": 56},
    ],
}
url = f"{baseUri}/attributes"
attributeId = requests.post(
    url, json=payload, headers=headers, params=params
).json()["attribute_id"]

# create face
payload = {
    "external_id": "2xQ2gprbMUePw1s9gw9fvA==",
    "attribute": {"attribute_id": attributeId},
}
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces"
faceId = requests.post(
    url,
    headers=headers,
    json=payload,
).json()["face_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/faces/{faceId}/attributes/samples"
response = requests.get(
    url,
    headers=headers,
)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "samples": [
    ]
}

faces attributes samples options

Get options for the resource.

path Parameters
face_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the face (face_id received in the "create face" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

lists

create list

Create a list.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
user_data
string (list_user_data) <= 128 characters
Default: ""

User data associated with list.

Responses

Request samples

Content type
application/json
{
  • "user_data": "list of good persons"
}

Response samples

Content type
application/json
{}

get lists

Get lists according to the filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

create_time__lt
string <date-time> (time)
Example: create_time__lt=2018-08-11T09:11:41.674Z

Upper bound for list create_time.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for list create_time.

last_update_time__lt
string <date-time> (time)
Example: last_update_time__lt=2018-08-11T09:11:41.674Z

Upper excluded bound for list last_update_time.

last_update_time__gte
string <date-time> (time)
Example: last_update_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for list last_update_time.

user_data
string
Example: user_data=user_data_text

Find all objects with user_data similar to this parameter. You can specify only part of the user_data value for this filter.

user_data__eq
string
Example: user_data__eq=user_data_text

Find all objects with same user_data.

list_ids
string <list of uuid>

Comma-separated list of list IDs.

list_id__lt
string <uuid>

List ID upper excluding boundary.

list_id__gte
string <uuid>

List ID lower including boundary.

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

params = {
    "user_data": "good",
    "page_size": 20,
    "create_time__gte": "2020-10-10T09:11:41.674Z",
}
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/lists"
response = requests.get(url, params=params, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "lists": [
    ]
}

delete lists

Delete several lists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
with_faces
integer (int01)
Default: 0
Enum: 0 1

Whether to delete list with all its faces.

header Parameters
Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
list_ids
required
Array of strings <uuid> (list_id) non-empty

Comma-separated list of list IDs for removal.

Responses

Request samples

Content type
application/json
{
  • "list_ids": [
    ]
}

Response samples

Content type
application/json
{}

lists options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get list count

Count lists according to the filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

user_data
string
Example: user_data=user_data_text

Find all objects with user_data similar to this parameter. You can specify only part of the user_data value for this filter.

user_data__eq
string
Example: user_data__eq=user_data_text

Find all objects with same user_data.

create_time__lt
string <date-time> (time)
Example: create_time__lt=2018-08-11T09:11:41.674Z

Upper bound for list create_time.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for list create_time.

last_update_time__lt
string <date-time> (time)
Example: last_update_time__lt=2018-08-11T09:11:41.674Z

Upper excluded bound for list last_update_time.

last_update_time__gte
string <date-time> (time)
Example: last_update_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for list last_update_time.

list_ids
string <list of uuid>

Comma-separated list of list IDs.

list_id__lt
string <uuid>

List ID upper excluding boundary.

list_id__gte
string <uuid>

List ID lower including boundary.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# get list according to the filters
params = {
    "user_data": "good",
    "create_time__gte": "2020-10-10T09:11:41.674Z",
    "last_update_time__gte": "2020-10-10T09:11:41.674Z",
}
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/lists/count"
response = requests.get(url, params=params, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "lists_count": 3
}

lists count options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get list

Get list by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
list_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

List ID (list_id received in the "create list" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create list
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/lists"
listId = requests.post(url, headers=headers).json()["list_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/lists/{listId}"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "list_id": "c004aae2-f191-4a1a-9d2a-e5894f8cecbf",
  • "user_data": "good guys",
  • "account_id": "c004aae2-f191-4a1a-9d2a-e5894f8cecbf",
  • "create_time": "2018-08-11T09:11:41.674Z",
  • "last_update_time": "2018-08-11T09:11:41.674Z"
}

check if list exists

Check if list with list_id exists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
list_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

List ID (list_id received in the "create list" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create list
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/lists"
listId = requests.post(url, headers=headers).json()["list_id"]

# check list
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/lists/{listId}"
response = requests.head(url, headers=headers)

print(response.status_code)
print(response.json())

update list

Update the user_data field of the list.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
list_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

List ID (list_id received in the "create list" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
user_data
string <= 128 characters

User data associated with list.

Responses

Request samples

Content type
application/json
{
  • "user_data": "list of good persons"
}

Response samples

Content type
application/json
Example
{}

delete list

Delete list by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
list_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

List ID (list_id received in the "create list" request).

query Parameters
with_faces
integer (int01)
Default: 0
Enum: 0 1

Whether to delete list with all its faces.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# create list
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/lists"
listId = requests.post(url, headers=headers).json()["list_id"]

# delete list
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
params = {"with_faces": 1}
url = f"{baseUri}/lists/{listId}"
response = requests.delete(url, params=params, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
Example
{}

list options

Get options for the resource.

path Parameters
list_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

List ID (list_id received in the "create list" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

attach/detach faces to the list

Attach or detach faces to the list.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
list_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

List ID (list_id received in the "create list" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
action
required
string
Enum: "attach" "detach"

Expected action with list and faces.

face_ids
required
Array of strings <uuid> (face_id) non-empty

Faces to attach or detach to/from list.

Responses

Request samples

Content type
application/json
{
  • "action": "attach",
  • "face_ids": [
    ]
}

Response samples

Content type
application/json
Example
{}

link options

Get options for the resource.

path Parameters
list_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

List ID (list_id received in the "create list" request).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

matcher

matching faces

Performs matching of given references with given candidates.

Note! Descriptors must be extracted for reference(s) and candidate(s). Objects without descriptors cannot be matched.

The sources for candidates are faces, attributes and events. See the "compare two faces using their IDs", "compare two events using their IDs", and "compare events using filters" examples.

You can specify the "list_id" filter of the "faces" candidate to perform matching by the specified list. See the "search by list and creation time" examples.

The sources for references are faces, events, attributes, external IDs of faces, or descriptors (raw, SDK format, or binary XPK format).

Matching results are returned for the candidates that correspond to the specified filters. If none of the candidates corresponds to the filters (for example, a non-existent ID is set in the "event_ids" field or the "face_ids" field), there will be no matching result and no error returned. The result field will be empty. See the "nonexistent references errors" examples.

If a non-existent reference is set (for example, a non-existent ID is set in the "event_id" field or the "face_id" field), the corresponding error is returned. See the "no ID for reference face found" response example.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Content-Type
string
Enum: "application/json" "application/msgpack"

Format of a request body data.

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Accept
string
Default: application/json
Enum: "application/json" "application/msgpack"

Determines response mime-type which client to expect.

Request Body schema:
required
Array of candidate_face (object) or candidate_event (object) or candidate_attribute (object) [ 0 .. 30 ] items

Candidates for matching.

required
Array of any [ 1 .. 30 ] items

References for matching. Each reference is matched with all given candidates. You can specify one or several references of one or several types.

Responses

Request samples

Content type
Example
{
  • "candidates": [
    ],
  • "references": [
    ]
}

Response samples

Content type
Example
[
  • {
    }
]

matcher options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

human body matching

Matcher API allows to submit tasks to a service that searches for human bodies similar to a given reference(s) by matching them. A body attribute descriptor should be extracted for reference(s) and candidate(s).

The sources for references are events or binary descriptor. The sources for candidates is events.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Content-Type
string
Enum: "application/json" "application/msgpack"

Format of a request body data.

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Accept
string
Default: application/json
Enum: "application/json" "application/msgpack"

Determines response mime-type which client to expect.

Request Body schema:
required
Array of any [ 1 .. 30 ] items

References for matching. Each reference is matched with all given candidates. You can specify one or several references of one or several types.

required
Array of objects (candidate_event) [ 1 .. 30 ] items

Candidates for matching.

Responses

Request samples

Content type
{
  • "references": [
    ],
  • "candidates": [
    ]
}

Response samples

Content type
Example
[
  • {
    },
  • {
    }
]

matcher options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

raw matching

Matcher raw API allows to do similarity calculations for input descriptors.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Content-Type
string
Enum: "application/json" "application/msgpack"

Format of a request body data.

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Accept
string
Default: application/json
Enum: "application/json" "application/msgpack"

Determines response mime-type which client to expect.

Request Body schema:
required
Array of xpk_file_entity (object) or sdk_descriptor_entity (object) or raw_descriptor_entity (object) non-empty

Reference list for matching.

required
Array of xpk_file_entity (object) or sdk_descriptor_entity (object) or raw_descriptor_entity (object) non-empty

Candidates for matching.

Responses

Request samples

Content type
{
  • "references": [
    ],
  • "candidates": [
    ]
}

Response samples

Content type
{
  • "matches": [
    ]
}

matcher raw options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

handlers

create handler

Create a handler.

The handler determines the list of rules (policies) for processing of input images.

Handlers can be static or dynamic.

When the handler is static, you specify its policies and then you specify the created handler ID during the event creation.

When the handler is dynamic, you create it without predefined policies and then you specify them during event creation. You can create the dynamic handler by setting "handler_type" field to 1.

Some parameters from the storage_policy are enabled by default (for example, face_sample_policy > store_sample). Don't forget to disable saving the necessary objects to avoid overflowing the storage.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
description
string <= 128 characters

Description of the handler. Use it to distinguish the handler from other created handlers and filter handlers using "get handlers" and "get handler count" requests.

object (Policies)

The set of rules, which determine input images processing. The absence of policies indicates that the handler is dynamic.

handler_type
integer (handler_type)
Default: 0
Enum: 0 1 2

Whether to get only non-dynamic (0), dynamic (1) or lambda (2) handlers.

If type is non-dynamic:

  • Handler will use policies what assigned to it.

If type is dynamic:

  • Handler will use given policies for each event generation request.

If type is lambda:

  • All requests will be sent to lambda handler using lambda_id.
  • The format of the request and response body may not match what is specified for canonical handlers.
  • Logic of the request behavior completely depends on the lambda, written by the user.
  • For a description, see documentation of the lambda.
is_dynamic
boolean (is_dynamic)
Deprecated
Default: false

Dynamic handler flag. If the value is set to "true", the handler is created without predefined policies.

Use this flag to specify policies for each event created using resource "/handlers/{handler_id}/event". Use the request body schema "multipart/form-data" to specify policies.

lambda_id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...

Lambda ID.

Responses

Request samples

Content type
application/json
Example
{
  • "description": "Full handler example",
  • "policies": {
    },
  • "handler_type": 0
}

Response samples

Content type
application/json
{}

get handlers

Get handlers by filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

handler_type
integer
Enum: 0 1 2

Whether to get only handler with specific type (0 - static, 1 - dynamic, 2 - lambda).

If not specified handlers of any type will be received.

If handler_type specified, the deprecated is_dynamic parameter will be ignored.

is_dynamic
integer
Deprecated
Enum: 0 1

Whether to get only dynamic (1) or non-dynamic (0) handlers. If not specified handlers of both type will received.

description
string

Records with descriptions similar to this parameter will be processed.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

params = {
    "description": "handler",
    "handler_type": 1,
    "page": 1,
}

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/handlers"

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

handlers options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get handler count

Count handlers.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
description
string

Find all the handlers with description similar to this parameter.

account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

handler_type
integer
Enum: 0 1 2

Whether to get only handler with specific type (0 - static, 1 - dynamic, 2 - lambda).

If not specified handlers of any type will be received.

If handler_type specified, the deprecated is_dynamic parameter will be ignored.

is_dynamic
integer
Deprecated
Enum: 0 1

Whether to get only dynamic (1) or non-dynamic (0) handlers. If not specified handlers of both type will received.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

params = {
    "description": "handler",
    "handler_type": 0,
}

url = f"{baseUri}/handlers/count"

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "handlers_count": 5
}

handler count options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

validate handler policies

Validate handler policies before using them to create or update a handler.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
required
object (Policies)

The set of rules, which determine input images processing. The absence of policies indicates that the handler is dynamic.

Responses

Request samples

Content type
application/json
{
  • "policies": {
    }
}

Response samples

Content type
application/json
Example
{}

handler policies validator options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get handler

Get handler by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Handler ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

import requests

baseUri = "http://127.0.0.1:5000/6"

# create handler
headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}
url = f"{baseUri}/handlers"
payload = {"handler_type": 1}
dynamicHandlerId = requests.post(url, json=payload, headers=headers).json()["handler_id"]

# get handler
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="
}
url = f"{baseUri}/handlers/{dynamicHandlerId}"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "handler_id": "de0846a8-09b2-4c6f-8175-99cfae98cf6b",
  • "account_id": "3c3a83c2-c21e-4855-91b5-34e6b63fb12d",
  • "description": "first handler",
  • "policies": {
    },
  • "create_time": "2018-08-11T09:11:41.674Z",
  • "last_update_time": "2018-08-11T09:11:41.674Z",
  • "handler_type": 0
}

replace handler

Update handler. You cannot update a part of the handler, so you should specify all the fields for your handler.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Handler ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
description
string <= 128 characters

Description of the handler. Use it to distinguish the handler from other created handlers and filter handlers using "get handlers" and "get handler count" requests.

object (Policies)

The set of rules, which determine input images processing. The absence of policies indicates that the handler is dynamic.

handler_type
integer (handler_type)
Default: 0
Enum: 0 1 2

Whether to get only non-dynamic (0), dynamic (1) or lambda (2) handlers.

If type is non-dynamic:

  • Handler will use policies what assigned to it.

If type is dynamic:

  • Handler will use given policies for each event generation request.

If type is lambda:

  • All requests will be sent to lambda handler using lambda_id.
  • The format of the request and response body may not match what is specified for canonical handlers.
  • Logic of the request behavior completely depends on the lambda, written by the user.
  • For a description, see documentation of the lambda.
is_dynamic
boolean (is_dynamic)
Deprecated
Default: false

Dynamic handler flag. If the value is set to "true", the handler is created without predefined policies.

Use this flag to specify policies for each event created using resource "/handlers/{handler_id}/event". Use the request body schema "multipart/form-data" to specify policies.

lambda_id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...

Lambda ID.

Responses

Request samples

Content type
application/json
{
  • "description": "Handler example",
  • "policies": {
    },
  • "handler_type": 0,
  • "is_dynamic": false,
  • "lambda_id": "string"
}

Response samples

Content type
application/json
Example
{}

check if handler exists

Check if handler with handler_id exists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Handler ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}

url = f"{baseUri}/handlers"

payload = {"handler_type": 1}
dynamicHandlerId = requests.post(url, json=payload, headers=headers).json()["handler_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/handlers/{dynamicHandlerId}"
response = requests.head(url, headers=headers)

print(response.status_code)

remove handler

Remove handler by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Handler ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}

url = f"{baseUri}/handlers"

payload = {"handler_type": 1}
dynamicHandlerId = requests.post(url, json=payload, headers=headers).json()["handler_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/handlers/{dynamicHandlerId}"
response = requests.delete(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
Example
{}

handler options

Get options for the resource.

path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Handler ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

events

generate events

Process images and/or raw descriptors using the specified handler and generate events.

Specify the multipart/form-data schema if you need to specify the dynamic handler policies.

If the Events service support is disabled on the server, events will not be saved to the database.

Notes for incoming data:

  • set the image detection time, if necessary, otherwise it will be equal to the request time.
  • face or body bounding boxes passed with face or body warped image will presented as sample detection rect in generated event.

Objects to be processed must belong to the user account making the request.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Handler ID.

query Parameters
city
string (location_str) <= 36 characters
Example: city=New York

City where an event occurred.

area
string (location_str) <= 36 characters
Example: area=Manhattan

Area where an event occurred.

district
string (location_str) <= 36 characters
Example: district=Midtown

District where an event occurred.

street
string (location_str) <= 36 characters
Example: street=West 48th street

Street where an event occurred.

house_number
string (location_str) <= 36 characters
Example: house_number=220

House number where an event occurred.

longitude
number (longitude) [ -180 .. 180 ]
Example: longitude=36.616

Longitude in degrees, a part of composite geo position. Geo position is considered as properly specified if both longitude and latitude are set.

latitude
number (latitude) [ -90 .. 90 ]
Example: latitude=55.752

Latitude in degrees, a part of composite geo position. Geo position is considered as properly specified if both longitude and latitude are set.

external_id
string (event_external_id) <= 36 characters
Default: ""
Example: external_id=14159261415926

External ID for created events and faces (if store_face is enabled in handler).

When Unicode symbols (for example, the "+" symbol) are used in "external_id", the string should be encoded. Otherwise, the Unicode symbols will be lost. The "luna3" client library provides the encoding example

user_data
string (face_user_data) <= 128 characters
Default: ""
Example: user_data=face of person

User data for created events and faces (if store_face is enabled in handler).

image_type
integer
Default: 0
Enum: 0 1 2

Type of input image. 0 - raw image, 1 - face warped image, 2 - body warped image.

aggregate_attributes
integer (aggregate_attributes)

Whether to aggregate the following parameters:

  • face descriptor (not displayed in the response body)
  • body descriptor (not displayed in the response body)
  • face basic attributes (age, gender)
  • body basic attributes (apparent age, apparent gender)
  • mask states
  • emotions
  • liveness
  • deepfake
  • upper body
  • accessories

Aggregation will be performed only if the appropriate parameters for estimating the listed above parameters are enabled in the handler.

If set, all estimated parameters from each image will be aggregated and stored in the event as single objects for all images. In the response body, the aggregated face basic attributes of all images will be displayed in the face_attributes > basic_attributes field, and the other aggregated parameters will be displayed in the aggregate_estimations field.

Otherwise, all estimated parameters from each image will be stored in the event as separate objects. In the response body, the face basic attributes will be displayed in the face_attributes > basic_attributes field of the corresponding image, and the other parameters will be displayed in the detections > samples > face/body > detection > attributes field of the corresponding image.

source
string (source) <= 128 characters
Example: source=3rd Avenue

Additional information provided by user along with event.

stream_id
string <uuid> (stream_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: stream_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Stream ID.

tags
Array of strings (tag) >= 0 items [ items <= 36 characters ]
Example: tags=tag_1,tag_2

Comma-separated list of tags. Each event from result will contain all of given tags. Each tag can be at most 36 characters.

track_id
string (track_id) ^[a-zA-Z0-9_\-]{1,36}$
Example: track_id=useful_track_id_number_1

Event track ID.

use_exif_info
integer
Default: 1
Enum: 0 1
Example: use_exif_info=1

Whether to try to auto orient image based on EXIF data.

The processed image should have EXIF data, otherwise auto orientation will not be performed.

Has no effect with tiff images (they're always auto oriented).

Ignored with warped images (see warped_image or image_type parameter).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Luna-Event-Time
string <date-time> (time)
Examples:
  • 2018-12-16T15:29:59.300275-08:00 - time with timezone with an offset of -08:00 from UTC (Pacific Standard Time).
  • 2018-12-16T15:29:59.300275Z - utc time. The "Z" suffix denotes a UTC offset of 00:00 (Zulu).

User defined event time. All events will be saved with this time as "create_time".

Format of time is rfc3339. Any other format is ignored.

Luna-Event-End-Time
string <date-time> (time)
Examples:
  • 2018-12-16T15:29:59.300275-08:00 - time with timezone with an offset of -08:00 from UTC (Pacific Standard Time).
  • 2018-12-16T15:29:59.300275Z - utc time. The "Z" suffix denotes a UTC offset of 00:00 (Zulu).

User defined event end time. All events will be saved with this time as "end_time".

Format of time is rfc3339. All other format is ignored.

Content-Type
string
Enum: "image/jpeg" "image/png" "image/bmp" "image/x-portable-pixmap" "image/tiff" "multipart/form-data" "application/json" "image/x-jpeg-base64" "image/x-png-base64" "image/x-bmp-base64" "image/x-tiff-base64" "image/x-portable-pixmap-base64" "application/x-sdk-descriptor" "application/x-vl-xpk" "application/x-sdk-descriptor-base64" "applicaition/x-vl-xpk-base64"
Request Body schema:
string <binary>

Responses

Request samples

Content type
No sample

Response samples

Content type
application/json
Example
{
  • "images": [],
  • "events": [
    ],
  • "filtered_detections": {
    }
}

generate events options

Get options for the resource.

path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Handler ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

generate stream events (beta)

WARNING Experimental resource. Backwards compatibility is not guaranteed.

Process images using the specified handler and generate stream events.

If the Events service support is disabled on the server, events will not be saved to the database.

Notes for incoming data:

  • set the image detection time, if necessary, otherwise it will be equal to the request time.
  • face or body bounding boxes passed with face or body warped image will presented as sample detection rect in generated event.

Objects to be processed must belong to the user account making the request.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Handler ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/msgpack"

Format of a request body data.

Request Body schema: application/msgpack
aggregate_attributes
required
integer (aggregate_attributes)

Whether to aggregate attributes.

If the value is set to "0", a descriptor and basic attributes are extracted for each sample.

If the value is set to "1", you can create an aggregated descriptor, receive aggregated basic attributes, or both. The behavior depends on the extract_basic_attributes and extract_descriptor parameters:

  • If extract_descriptor is enabled, all the samples in the request will be used to create a single descriptor. An aggregated descriptor gives you more accurate results upon descriptors comparison.

  • If extract_basic_attributes is enabled, all the samples in the request will be used to extract basic attributes. Age, gender and ethnicity values received from several samples are more precise.

Make sure that all the samples in the request belong to the same person.

If there are several faces in the input image, an error occurs.

required
Array of any (event_sources_non_aggregated) non-empty
use_exif_info
integer (use_exif_info)
Default: 1
Enum: 0 1

Whether to try to auto orient image based on exif data

Has no effect with tiff images (they're always auto oriented).

Ignored with warped images (see warped_image or image_type parameter).

Responses

Response samples

Content type
application/json
Example
{
  • "images": [],
  • "events": [
    ],
  • "filtered_detections": {
    }
}

generate stream events options

Get options for the resource.

path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Handler ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

save event

Save event which was generated by the user. The event structure is similar to an event from handler response. Input events will send to the Sender also and to plugins. Therefore, these events are the same events except that events were generated an external handler. Handler ID must belong to a dynamic handler.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Dynamic handler ID.

query Parameters
wait_saving
integer
Default: 1
Enum: 0 1

Whether to wait for raw event saving.

If "0" is specified, the 202 status code will be expected in response to a successful request. This status code is returned after event is validated and added to the buffer. The system does not wait until the event is saved to the database. The event will be stored in the database after the response is sent.

If "1" is specified, the 201 status code will be expected in response to a successful request. This status code is returned only after event is stored in the database.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
Array of objects <= 100 items

List of body & face related detections.

source
string (source) <= 128 characters

Additional information that user provides with event.

stream_id
string <uuid> (stream_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...

Stream ID.

object (input_event_location)

Information about place where an event occurred.

external_id
string (event_external_id) <= 36 characters
Default: ""

User-defined external ID for the event.

user_data
string (event_user_data) <= 128 characters
Default: ""

User data associated with event.

track_id
string (track_id) ^[a-zA-Z0-9_\-]{1,36}$

Event track ID.

object (input_event_face)

Face associated with event.

Array of objects or null <= 30 items

Sorted list with match result for the event.

object or null (input_event_face_attribute)

User extracted event face attributes.

object or null (input_event_body_attribute)

User extracted event body attributes.

object (input_event_aggregate_estimations)

Aggregated attributes estimated from samples.

tags
Array of strings [ 0 .. 1000 ] items [ items <= 36 characters ]

List of tags.

create_time
string <date-time>

Time of the event creation.

end_time
string <date-time>

The end time of the event.

object (event_meta_common)

User defined metadata (JSON object). Size shouldn't exceed 2MB.

To be able to further search for meta using GET requests, JSON must have a valid format without spaces in field names. Use only latin letters, numbers, and single underscores in field names.

Responses

Request samples

Content type
application/json
{
  • "detections": [
    ],
  • "source": "3rd Avenue",
  • "stream_id": "b668c4a5-2191-476e-a261-3b4f9ce2e25e",
  • "location": {
    },
  • "external_id": "14159261415926",
  • "user_data": "some event",
  • "track_id": "useful_track_id_number_1",
  • "face": {
    },
  • "matches": [
    ],
  • "face_attributes": {
    },
  • "body_attributes": {
    },
  • "aggregate_estimations": {
    },
  • "tags": [
    ],
  • "create_time": "2018-08-11T09:11:41.674Z",
  • "end_time": "2018-08-11T09:11:41.674Z",
  • "meta": {
    }
}

Response samples

Content type
application/json
{}

save event options

Get options for the resource.

path Parameters
handler_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Dynamic handler ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get statistics on events

Get event statistics by target(s) with applied filters.

Event fields and/or functions (count, min, etc.) can be set as targets for aggregation of events.

Grouping by frequency or grouping by time intervals is available.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
Array of objects (targets) >= 0 items
Default: [{"column":"event_id","aggregator":"count"}]

You can specify one or several event fields and functions for them for data aggregation.

The table includes event fields and available functions for them:

Column Aggregator
count max min avg group_by
event_id + - - - +
external_id + - - - +
handler_id + - - - +
stream_id + - - - +
source + - - - +
top_matching_candidates_label + - - - +
top_similar_object_id + - - - +
top_similar_external_id + - - - +
top_similar_object_similarity + + + + -
create_time + + + - -
end_time + + + - -
face_id + - - - +
gender + + + + +
age + + + + +
emotion + + + + +
mask + + + + +
ethnic_group + + + + +
liveness + + + + +
deepfake + + + + +
user_data + - - - +
tags + + + - -
city + - - - +
area + - - - +
district + - - - +
street + - - - +
house_number + - - - +
geo_position + - - - -
track_id + - - - +
apparent_age + + + + +
apparent_gender + + + + +
sleeve_length + - - - +
headwear_state + + + + +
headwear_apparent_color + - - - +
upper_clothing_colors + - - - -
lower_garment_colors + - - - -
lower_garment_type + - - - +
shoes_apparent_color + - - - +
backpack_state + + + + +
meta.* + + + + -

Note! There must be at least one function different from group_by in the targets, otherwise an error occurs.

Array of objects (filters) >= 0 items

Specifies filters for events.

Operators available for each filter:

Filter Operator
like, nlike in, nin eq, neq gt, gte, lt, lte covered eq null
tags + - - - - -
source - + + - - +
stream_id - + + - - +
user_data - + + - - -
account_id - + + + - -
event_id - + + + - -
external_id - + + + - -
handler_id - + + + - -
top_similar_object_id - + + + - -
top_similar_external_id - + + + - -
top_matching_candidates_label - + + - - -
top_similar_object_similarity - - - + - -
face_id - + + + - -
gender - + + + - +
age - + + + - +
emotion - + + + - +
mask - + + + - +
ethnic_group - + + + - +
liveness - + + + - +
deepfake - + + + - +
city - + + - - +
area - + + - - +
district - + + - - +
street - + + - - +
house_number - + + - - +
geo_position - - - - + +
track_id - + + - - +
apparent_age - + + + - +
apparent_gender - + + + - +
sleeve_length - + + - - +
headwear_state - + + + - +
upper_clothing_colors - + - - - +
backpack_state - + + + - +
lower_garment_colors - + - - - +
headwear_apparent_color - + + - - +
lower_garment_type - + + - - +
shoes_apparent_color - + + - - +
meta.* + + + + - +
Array of objects (periods) >= 0 items

Specifies the period of event creation. All the events created during this period will be included in the statistics.

You can set the start and end of the period or only one of the bounds.

Note! You can specify only one period!

group_by
string (group_by)

Enables you to group events by creation time according to one of two ways:

  1. Grouping by time intervals - number and dimension
Parameter value Description
1m one minute
2h two hours
7d seven days
5w five weeks
3M three months
10y ten years
  1. The frequency grouping - one of the following
Parameter value Description
monthOfYear by month of year
weekOfYear by week of year
dayOfYear by day of year
dayOfMonth by day of month
dayOfWeek by day of week
hourOfDay by hours of day
minuteOfHour by minutes of hour

Responses

Request samples

Content type
application/json
{
  • "targets": [
    ],
  • "filters": [
    ],
  • "period": [
    ],
  • "group_by": "dayOfWeek"
}

Response samples

Content type
application/json
{
  • "fields": [
    ],
  • "stats": [
    ]
}

events statistics options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get events

Get events that satisfy filters.

Default filters for events:

  • create_time__lt - current date and time
  • create_time__gte - current date and time minus month

Default filters are not used if any of the following parameters are defined:

- list of event IDs (`event_ids`)
- lower event ID boundary (`event_id__gte`)
- upper event ID boundary (`event_id__lt`)
- lower create time boundary (`create_time__gte`)
- upper create time boundary (`create_time__lt`)

The target parameter determines field that will be shown for each event. If target is not set, the response will contain all the fields.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

target
Array of strings (events_targets)
Items Enum: "event_id" "account_id" "create_time" "end_time" "external_id" "handler_id" "stream_id" "source" "top_match" "match_result" "face_detections" "body_detections" "face_id" "attach_result" "gender" "age" "emotion" "ethnic_group" "tags" "user_data" "location" "mask" "liveness" "deepfake" "track_id" "body_basic_attributes" "upper_body" "lower_body" "accessories" "meta"
Example: target=create_time,event_id,face_detections

Comma-separated list of event fields. If set, each event from result will contain only specified fields, otherwise, events with all fields will be returned.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object create_time.

create_time__lt
string <date-time> (time)
Example: create_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object create_time.

end_time__gte
string <date-time> (time)
Example: end_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object end_time.

end_time__lt
string <date-time> (time)
Example: end_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object end_time.

sources
string
Example: sources=cam1,cam2,null

Comma-separated list of sources or null. Each event from result will contain one of given sources.

stream_ids
string <list of uuid.>
Example: stream_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of stream IDs or null.

cities
string
Example: cities=Moscow,New York,null

Comma-separated list of cities or null. Each event from result will contain one of given cities in "location" parameter.

areas
string
Example: areas=CAD,Manhattan,null

Comma-separated list of areas or null. Each event from result will contain one of given areas in "location" parameter.

districts
string
Example: districts=Mitino,Midtown,null

Comma-separated list of districts or null. Each event from result will contain one of given districts in "location" parameter.

streets
string
Example: streets=Arbat,West 48th street,null

Comma-separated list of streets or null. Each event from result will contain one of given streets in "location" parameter.

house_numbers
string
Example: house_numbers=1,220,null

Comma-separated list of house numbers or null. Each event from result will contain one of given house numbers in "location" parameter.

longitude (number) or null_filter (string)
Example: origin_longitude=36.616

Longitude origin in degrees, a part of composite geo position filter or null for undefined geo position. Geo position filter is a bounding box specified by coordinates of its center (origin) and some delta. Geo position filter is considered as properly specified if both origin_longitude and origin_latitude are set, and considered as properly empty if neither of origin_longitude, origin_latitude, longitude_delta, latitude_delta is set. Null filter applied only if origin_longitude or origin_latitude is set to 'null', and longitude_delta and latitude_delta is not set.

latitude (number) or null_filter (string)
Example: origin_latitude=55.752

Latitude origin in degrees, a part of composite geo position filter or null for undefined geo position. Geo position filter is a bounding box specified by coordinates of its center (origin) and some delta. Geo position filter is considered as properly specified if both origin_longitude and origin_latitude are set, and considered as properly empty if neither of origin_longitude, origin_latitude, longitude_delta, latitude_delta is set. Null filter applied only if origin_longitude or origin_latitude is set to 'null', and longitude_delta and latitude_delta is not set.

longitude_delta
number (longitude_delta) [ 0 .. 90 ]
Default: 0.01
Example: longitude_delta=0.01

Longitude delta in degrees, a part of composite geo position filter.

Geo position filter is a bounding box specified by coordinates of its center (origin) and some delta.

Geo position filter is considered as properly specified if both origin_longitude and origin_latitude are set, and considered as properly empty if neither of origin_longitude, origin_latitude, longitude_delta, latitude_delta is set.

If both origin_longitude and origin_latitude are set and longitude_delta is not set - the default value is applied.

WARNING: Bounding boxes with a vertex or border on the International Date Line (IDL) or the North or South pole are not fully supported due to features of database spatial index - filter result may be unexpected.

NOTE: highly recommended for citywide use only.

latitude_delta
number (latitude_delta) [ 0 .. 90 ]
Default: 0.01
Example: latitude_delta=0.01

Latitude delta in degrees, a part of composite geo position filter.

Geo position filter is a bounding box specified by coordinates of its center (origin) and some delta.

Geo position filter is considered as properly specified if both origin_longitude and origin_latitude are set, and considered as properly empty if neither of origin_longitude, origin_latitude, longitude_delta, latitude_delta is set.

If both origin_longitude and origin_latitude are set and latitude_delta is not set - the default value is applied.

WARNING: Bounding boxes with a vertex or border on the International Date Line (IDL) or the North or South pole are not fully supported due to features of database spatial index - filter result may be unexpected.

NOTE: highly recommended for citywide use only.

top_matching_candidates_label
string
Example: top_matching_candidates_label=matching_label

Top matching candidates label. Each event from result will contain given label.

top_similar_object_ids
Array of strings (external_id) [ items <= 36 characters ]
Example: top_similar_object_ids=14159261415926

Comma-separated list of top similar object IDs. Each event from result will contain one of given top similar object IDs.

top_similar_external_ids
Array of strings <uuid> (uuid)
Example: top_similar_external_ids=557d54ec-29ad-4f3c-93b4-c9092ef12515

Comma-separated list of top similar external IDs. Each event from result will contain one of given top similar external IDs.

top_similar_object_similarity__gte
number
Example: top_similar_object_similarity__gte=0.5

Top similar object similarity lower included bound.

top_similar_object_similarity__lt
number
Example: top_similar_object_similarity__lt=0.5

Top similar object similarity upper excluded bound.

age__lt
integer
Example: age__lt=50

Age upper excluded bound.

age__gte
integer
Example: age__gte=50

Age lower included bound.

integer or null_filter (string)
Example: gender=1

Gender. 1 - male, 0 - female, "null" - null value.

emotions
string <list of integer and null (1, 2, 3, 4, 5, 6, 7, null)>
Example: emotions=1,2,3,null

Comma-separated list of predominant emotions or null. Each event from result will contain one of the given emotions.

emotions value
anger 1
disgust 2
fear 3
happiness 4
neutral 5
sadness 6
surprise 7
not set null
masks
string <list of integer and null (1, 2, 3, null)>
Example: masks=1,2,3,null

Comma-separated list of predominant masks or null. Each event from result will contain one of the given mask state.

mask value
missing 1
medical_mask 2
occluded 3
not set null
ethnic_groups
string <list of integer and null (1, 2, 3, 4, null)>
Example: ethnic_groups=1,2,null

Comma-separated list of dominant ethnic group or null. Each event from result will contain one of the given ethnic groups.

ethnicity value
African american 1
Indian 2
Asian 3
Caucasian 4
Not set null
liveness
string <list of integer and null (0, 1 ,2, null)>
Example: liveness=1,2,null

Comma-separated list of dominant liveness or null. Each event from result will contain one of the given liveness.

liveness value
spoof 0
real 1
unknown 2
not set null
deepfake
string <list of integer and null (0, 1, null)>
Example: deepfake=0,null

Comma-separated list of dominant deepfakes or null. Each event from result will contain one of the given deepfake.

deepfake value
fake 0
real 1
not set null
Array of integers or null_filter (string)
Example: apparent_gender=1

Comma-separated list of apparent gender: 0 - female, 1 - male, 2 - undefined, "null" - null value. Each event from result will contain one of the given states.

apparent_age__gte
integer [ 0 .. 100 ]
Example: apparent_age__gte=50

Apparent age lower included bound.

apparent_age__lt
integer [ 0 .. 100 ]
Example: apparent_age__lt=50

Apparent age upper excluded bound.

Array of integers or null_filter (string)
Example: headwear_states=1

Comma-separated list of headwear states: 0 - absent, 1 - present, 2 - undefined, "null" - null value. Each event from result will contain one of the given states.

Array of headwear_color (string) or null_filter (string)
Example: headwear_apparent_colors=white,undefined,null

Comma-separated list of headwear apparent colors or null value. Each event from result will contain one of the given states.

sleeve_lengths
Array of strings
Items Enum: "short" "long" "undefined" null
Example: sleeve_lengths=short,null

Comma-separated list of sleeve length states or null value. Each event from result will contain one of the given states.

Array of clothing_color (strings) or null_filter (string)
Example: upper_clothing_colors=black,white

Comma-separated list of upper clothing colors or null for not specified colors. Each event from result will contain at least one of the given clothing colors.

Array of clothing_color (strings) or null_filter (string)
Example: lower_garment_colors=black,white

Comma-separated list of lower garment colors. Each event from result will contain at least one of the given clothing colors.

lower_garment_types
Array of strings
Items Enum: "undefined" "trousers" "shorts" "skirt"
Example: lower_garment_types=trousers,undefined,null

Comma-separated list of lower garment types. Each event from result will contain one of the given types.

Array of shoes_color (string) or null_filter (string)
Example: shoes_apparent_colors=white,undefined,null

Comma-separated list of shoes apparent colors or null value. Each event from result will contain one of the given states.

Array of integers or null_filter (string)
Example: backpack_states=1
face_ids
string <list of uuid>
Example: face_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of face IDs.

event_ids
string <list of uuid.>
Example: event_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of event IDs.

event_id__gte
string <uuid.>
Example: event_id__gte=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Event ID lower included bound. Events in response will be sorted by their ids. If neither event_id__lt or event_id__gte is specified, the faces will be sorted by creation time.

event_id__lt
string <uuid.>
Example: event_id__lt=346a5645-ec89-4806-820a-dbcb6e0dc381

Event ID upper excluded bound. Events in response will be sorted by their ids. If neither event_id__lt or event_id__gte is specified, the faces will be sorted by creation time.

handler_ids
string <list of uuid.>
Example: handler_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of handler IDs.

external_ids
string
Example: external_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of external IDs.

user_data
string
Example: user_data=user_data_text

Find all objects with user_data similar to this parameter. You can specify only part of the user_data value for this filter.

tags
Array of strings (tag) >= 0 items [ items <= 36 characters ]
Example: tags=tag_1,tag_2

Comma-separated list of tags. Each event from result will contain all of given tags. Each tag can be at most 36 characters.

string or null_filter (string)
Example: track_ids=track_id_number_1,track_id_number_2,null

Comma-separated list of track IDs. Each event from result will contain one of given track IDs. Each track ID can be at most 36 characters.

string or null_filter (string)
Example: meta.field_1__gt:numeric=36.6&meta.field_2.field_3__in=value,none&meta.field_4:integer=5

User-defined event meta's filters.

Parameter name pattern: meta.<path.to.field>__<operator>:<type>

Path to field is a dotted event meta's json field path.

Field comparison operator is optional one of eq (default), neq, like, nlike, in, nin, gt, gte, lt, lte.

Field data type is optional one of string (default), integer, numeric.

Allowed usage of filters is:

operator type
null string integer numeric
eq + + + +
neq + + + +
like - + - -
nlike - + - -
in + + + +
nin + + + +
gt - + + +
gte - + + +
lt - + + +
lte - + + +
order
string
Enum: "asc" "desc"

Sort order. If "desc" is set, the newest events will be shown first. If "asc" is set, the oldest events will be shown first.

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

params = {
    "age__lt": 90,
    "cities": "New York,Moscow",
    "track_ids": "There_and_Back_Again,Around_the_World",
    "emotions": "3,4,5,6,7",
}

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/events"

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "events": [
    ]
}

events options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get event

Get event by ID.

The target parameter determines field that will be shown for specified event. If target is not set, the response will contain all the fields.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
event_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Event ID.

query Parameters
target
Array of strings (events_targets)
Items Enum: "event_id" "account_id" "create_time" "end_time" "external_id" "handler_id" "stream_id" "source" "top_match" "match_result" "face_detections" "body_detections" "face_id" "attach_result" "gender" "age" "emotion" "ethnic_group" "tags" "user_data" "location" "mask" "liveness" "deepfake" "track_id" "body_basic_attributes" "upper_body" "lower_body" "accessories" "meta"
Example: target=create_time,event_id,face_detections

Comma-separated list of event fields. If set, an event from result will contain only specified fields, otherwise, an event with all fields will be returned.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import time

baseUri = "http://127.0.0.1:5000/6"

headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}

url = f"{baseUri}/handlers"
payload = {
    "description": "non_dynamic_handler",
    "policies": {},
    "handler_type": 0,
}
handlerId = requests.post(url, json=payload, headers=headers).json()["handler_id"]

with open("image.jpg", "rb") as image_file:
    image = image_file.read()

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
    "Luna-Event-Time": "2020-10-10T09:11:41.674Z",
}
url = f"{baseUri}/handlers/{handlerId}/events"

eventId = requests.post(
    url,
    headers=headers,
    data=image,
).json()["events"][0]["event_id"]

# We are waiting for the event to be created
time.sleep(5)

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/events/{eventId}"

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "create_time": "2020-10-11T09:11:41.674Z",
  • "end_time": "2020-10-11T09:11:41.674Z",
  • "event_id": "bd6df8ea-1df2-449d-b8e3-d1d40b215dc8",
  • "handler_id": "791f002e-919c-459d-b766-cba9f4130853",
  • "face_id": "e88b8804-fedb-4dc3-8a59-171caf416571",
  • "account_id": "a778c4a5-2191-476e-a261-3b4f9ce2e25e",
  • "external_id": "2xQ2gprbMUePw1s9gw9fvA==",
  • "source": "3rd Avenue",
  • "stream_id": "a778c4a5-2191-476e-a261-3b4f9ce2e25e",
  • "top_match": {
    },
  • "match_result": [
    ],
  • "face_detections": [
    ],
  • "body_detections": [
    ],
  • "attach_result": [
    ],
  • "gender": 1,
  • "age": 27,
  • "emotion": 5,
  • "mask": 1,
  • "ethnic_group": 3,
  • "tags": [
    ],
  • "user_data": "people are strange",
  • "location": {
    },
  • "track_id": "e3ed4e18-2983-418d-879a-825e4517fc6c",
  • "body_basic_attributes": {
    },
  • "upper_body": {
    },
  • "lower_body": {
    },
  • "accessories": {
    },
  • "meta": {
    }
}

check if event exists

Check if event with event_id exists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
event_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Event ID.

query Parameters
target
Array of strings (events_targets)
Items Enum: "event_id" "account_id" "create_time" "end_time" "external_id" "handler_id" "stream_id" "source" "top_match" "match_result" "face_detections" "body_detections" "face_id" "attach_result" "gender" "age" "emotion" "ethnic_group" "tags" "user_data" "location" "mask" "liveness" "deepfake" "track_id" "body_basic_attributes" "upper_body" "lower_body" "accessories" "meta"
Example: target=create_time,event_id,face_detections

Comma-separated list of event fields. If set, an event from result will contain only specified fields, otherwise, an event with all fields will be returned.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import time

baseUri = "http://127.0.0.1:5000/6"

headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}

url = f"{baseUri}/handlers"
payload = {
    "description": "non_dynamic_handler",
    "policies": {},
    "handler_type": 0,
}
handlerId = requests.post(url, json=payload, headers=headers).json()["handler_id"]

# emit event
with open("image.jpg", "rb") as image_file:
    image = image_file.read()

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
    "Content-Type": "image/jpeg",
    "Luna-Event-Time": "2020-10-10T09:11:41.674Z",
}
url = f"{baseUri}/handlers/{handlerId}/events"

eventId = requests.post(
    url,
    headers=headers,
    data=image,
).json()["events"][0]["event_id"]

# We are waiting for the event to be created
time.sleep(5)

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/events/{eventId}"

response = requests.head(url, headers=headers)

print(response.status_code)

event options

Get options for the resource.

path Parameters
event_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Event ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

task processing

clustering task

Create a clustering task.

The Filters section specifies which faces (or events) should be added to the cluster. The filters are combined with logical AND.

Available filters depend on the object type: events or faces.

You can receive a report about the finished clustering task using the reporter task.

Use the GET request on resource "/6/tasks/{task_id}/result" to receive the task results.

If there are no results of the created task and error "Object not found" is returned, use the GET request on resource "/6/tasks/errors/{error_id}" to receive the task errors.

Objects to be processed must belong to the user account making the request.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
description
string

User data provided for the current task.

required
object (clustering_task_content)

Clustering task content.

Responses

Request samples

Content type
application/json
{
  • "description": "clustering faces",
  • "content": {
    }
}

Response samples

Content type
application/json
{
  • "task_id": 17
}

clustering options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

reporter task

Create a task report in CSV format.

Now the report is only created for clustering tasks.

The report contains additional information about clustering objects (faces or events). You can specify additional information that will be added to the report. The first and the second columns in the report always correspond to a cluster number and an object ID.

Use the GET request on resource "/6/tasks/{task_id}/result" to receive the task results. The result is returned in ZIP archive, which contains a CSV file. If you set the save_images parameter, then the ZIP archive will also contain a folder with images.

If there are no results of the created task and error "Object not found" is returned, use the GET request on resource "/6/tasks/errors/{error_id}" to receive the task errors.

Objects to be processed must belong to the user account making the request.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
description
string

Provided user data for the current task.

required
object (ReporterTaskContent)

Reporter task content.

Responses

Request samples

Content type
application/json
{
  • "description": "report clustering events from cam1",
  • "content": {
    }
}

Response samples

Content type
application/json
{
  • "task_id": 17
}

reporter options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

exporter task

Collect event and/or face data and export them from LP to a CSV file. The file rows represent requested objects. Corresponding samples (if they were requested) are also returned.

Use the GET request on resource "/6/tasks/{task_id}/result" to receive the task results. The result is returned in ZIP archive, which contains a CSV file. If you set the save_images parameter, then the ZIP archive will also contain a folder with images.

If there are no results of the created task and error "Object not found" is returned, use the GET request on resource "/6/tasks/errors/{error_id}" to receive the task errors.

Objects to be processed must belong to the user account making the request.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
description
string (task_description) <= 128 characters

Task description.

required
any

Exporter task content.

Responses

Request samples

Content type
application/json
{
  • "description": "task description",
  • "content": {
    }
}

Response samples

Content type
application/json
{
  • "task_id": 31
}

exporter options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

linker task

Create a linker task.

The task enables you to attach faces to the specified list according to the filters.

You can use faces or events as objects for the task. When events are used, new face is created for each of the events.

A list is required for the task processing:

  • If you specified a list, the Tasks service checks its existence and displays an error if the list is not found.
  • If you set new list creation using create_list = 1, new list is created.

Use the GET request on resource "/6/tasks/{task_id}/result" to receive the task results.

If there are no results of the created task and error "Object not found" is returned, use the GET request on resource "/6/tasks/errors/{error_id}" to receive the task errors.

Objects to be processed must belong to the user account making the request.

If luna-image-store is disabled no subtask/task result will be stored.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
description
string

User data provided for the current task.

required
object (linker_task_content)

Linker task content.

Responses

Request samples

Content type
application/json
{
  • "description": "linker task one",
  • "content": {
    }
}

Response samples

Content type
application/json
{
  • "task_id": 29
}

linker options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

garbage collection task

Create a garbage collection task.

Use the GET request on resource "/6/tasks/{task_id}/result" to receive the task results.

If there are no results of the created task and error "Object not found" is returned, use the GET request on resource "/6/tasks/errors/{error_id}" to receive the task errors.

Objects to be processed must belong to the user account making the request.

WARNING: If you perform the task for faces with the remove_samples flag disabled, then the only way to delete samples is to execute the "remove face/body sample" resource.

If luna-image-store is disabled no subtask/task result will be stored.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
One of
description
string

User data provided for the current task.

required
object (GcEventsTaskContent)

Garbage collection task content to remove events.

Responses

Request samples

Content type
application/json
Example
{
  • "description": "gc task one",
  • "content": {
    }
}

Response samples

Content type
application/json
{
  • "task_id": 25
}

gc options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

cross-matching task

Create a cross-matching task.

The cross-matching task enables you to compare references (faces, attributes or events) with candidates (faces, attributes or events) according to the specified filters.

All the references are matched with all the candidates.

You can limit the number of candidates returned in matching results and set the minimum acceptable similarity threshold.

Use the GET request on resource "/6/tasks/{task_id}/result" to receive the task results.

If there are no results of the created task and error "Object not found" is returned, use the GET request on resource "/6/tasks/errors/{error_id}" to receive the task errors.

Objects to be processed must belong to the user account making the request.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
description
string

User data provided for the current task.

required
object (CrossMatchTaskContent)

Cross match task content.

Responses

Request samples

Content type
application/json
{
  • "description": "matching visitors with the list of VIP customers",
  • "content": {
    }
}

Response samples

Content type
application/json
{
  • "task_id": 15
}

cross match options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

ROC-curve calculating task

Create a ROC-curve calculating task.

ROC (or Receiver Operating Characteristic) is a performance measurement for the classification problem at various threshold settings. The ROC-curve is plotted with TPR (True Positive Rate) against the FPR (False Positive Rate).

TPR is a true positive match pair count divided by a count of total expected positive match pairs, and FPR is a false positive match pair count divided by a count of total expected negative match pairs. Each point (FPR, TPR) of the ROC-cure corresponds to a certain similarity threshold.

The model performance is determined by looking at the area under the ROC-curve (or AUC), the ROC-curve and the secondary main diagonal intersection point, where type I and type II error rates are equal. The model performance is also determined by getting into the top-N probability, i.e. probability of getting a positive match pair into the top-N for any match result group sorted by similarity.

Use the GET request on resource "/6/tasks/{task_id}/result" to receive the task results.

If there are no results of the created task and error "Object not found" is returned, use the GET request on resource "/6/tasks/errors/{error_id}" to receive the task errors.

Objects to be processed must belong to the user account making the request.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
description
string

User data provided for the current task.

required
object (roc_task_content)

ROC-curve calculating task content.

Responses

Request samples

Content type
application/json
{
  • "description": "matching famous people with customers",
  • "content": {
    }
}

Response samples

Content type
application/json
{
  • "task_id": 14
}

roc options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

estimator task

Create an estimator task.

Task allows to process images using established policies. Policies can be specified in the request or use saved ones by passing the handler ID.

The resource can accept three types of sources with images for processing:

  • ZIP archive
  • S3-like storage
  • Network disk
  • FTP server
  • Samba

Use the GET request on resource "/6/tasks/{task_id}/result" to receive the task results.

If there are no results of the created task and error "Object not found" is returned, use the GET request on resource "/6/tasks/errors/{error_id}" to receive the task errors.

WARNING: Check handler storage_policy before a task start, notification_policy and event_policy enable by default.

Objects to be processed must belong to the user account making the request.

If luna-image-store is disabled no subtask/task result will be stored.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
description
string

Provided user data for current task.

required
object (estimator_task_content)

Estimator task content.

Responses

Request samples

Content type
application/json
Example
{
  • "description": "estimator task with zip archive",
  • "content": {
    }
}

Response samples

Content type
application/json
{
  • "task_id": 123
}

estimator options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

task info

get tasks

Get tasks according to the filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

create_time__lt
string <date-time> (time)
Example: create_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object create_time.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object create_time.

end_time__lt
string <date-time> (time)
Example: end_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object end_time.

end_time__gte
string <date-time> (time)
Example: end_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object end_time.

task_ids
string <comma-separate task ids> (taskIds)
Example: task_ids=1,2,3

Comma-separated task IDs.

task_type
integer (task_type)
Enum: 0 1 2 3 4 5 6 7 8 9
Example: task_type=1

Task type.

task type value
unknown 0
linker 1
clusterization 2
report 3
garbage collection 4
additional extract 5
cross match 6
roc-curve calculation 7
export objects 8
estimate data 9
task_status
integer (taskStatus)
Enum: 0 1 2 3 4 5
Example: task_status=1

Task status.

task status value
pending 0
in progress 1
cancelled 2
failed 3
collect results 4
done 5
schedule_id
integer (schedule_id) >= 1

Schedule according to which the task was created

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/gc"
payload = {"content": {"target": "events"}}
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

params = {
    "task_id": taskId,
    "task_type": 4,
    "task_status": 5,
    "create_time__gte": "2018-08-11T09:11:41.674Z",
    "page": 1,
}

url = f"{baseUri}/tasks"
response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "tasks": [
    ]
}

tasks options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get tasks count

Count tasks according to the filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
create_time__lt
string <date-time> (time)
Example: create_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object create_time.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object create_time.

end_time__lt
string <date-time> (time)
Example: end_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object end_time.

end_time__gte
string <date-time> (time)
Example: end_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object end_time.

task_ids
string <comma-separate task ids> (taskIds)
Example: task_ids=1,2,3

Comma-separated task IDs.

task_type
integer (task_type)
Enum: 0 1 2 3 4 5 6 7 8 9
Example: task_type=1

Task type.

task type value
unknown 0
linker 1
clusterization 2
report 3
garbage collection 4
additional extract 5
cross match 6
roc-curve calculation 7
export objects 8
estimate data 9
task_status
integer (taskStatus)
Enum: 0 1 2 3 4 5
Example: task_status=1

Task status.

task status value
pending 0
in progress 1
cancelled 2
failed 3
collect results 4
done 5
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

schedule_id
integer (schedule_id) >= 1

Schedule according to which the task was created

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/gc"
payload = {"content": {"target": "events"}}
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

params = {
    "task_id": taskId,
    "task_type": 4,
    "task_status": 5,
    "create_time__gte": "2018-08-11T09:11:41.674Z",
    "page": 1,
}

url = f"{baseUri}/tasks/count"
response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "count": 13
}

tasks count options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get task

Get task by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
task_id
required
integer >= 1

Task ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/gc"
payload = {"content": {"target": "events"}}
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"{baseUri}/tasks/{taskId}"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "task_id": 13,
  • "account_id": "b668c4a5-2191-476e-a261-3b4f9ce2e25e",
  • "create_time": "2018-08-11T09:11:41.674Z",
  • "end_time": "2018-08-11T10:11:41.674Z",
  • "last_update_time": "2018-08-11T10:11:41.674Z",
  • "task_type": 1,
  • "task_status": 5,
  • "result_id": "b668c4a5-2191-476e-a261-3b4f9ce2e25e",
  • "count_task_parts_done": 10,
  • "count_task_parts_all": 10,
  • "content": {
    },
  • "description": "task description"
}

cancel task

Cancel task by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
task_id
required
integer >= 1

Task ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/gc"
payload = {"content": {"target": "events"}}
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"{baseUri}/tasks/{taskId}"
response = requests.patch(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
{}

delete task

Delete a task and the task results by the task ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
task_id
required
integer >= 1

Task ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/gc"
payload = {"content": {"target": "events"}}
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"{baseUri}/tasks/{taskId}"
response = requests.delete(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
Example
{}

task options

Get options for the resource.

path Parameters
task_id
required
integer >= 1

Task ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get task result

Get task result by the task ID.

In addition to the result of the task, the occurred errors can be returned in the response.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
task_id
required
integer >= 1

Task ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import time

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/gc"
payload = {"content": {"target": "events"}}
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

# wait for tasks to complete
time.sleep(5)

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"{baseUri}/tasks/{taskId}/result"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
Example
{
  • "result": [
    ],
  • "errors": [ ]
}

task result options

Get options for the resource.

path Parameters
task_id
required
integer >= 1

Task ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get subtasks

Get subtasks of a task by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
task_id
required
integer >= 1

Task ID.

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import time

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/gc"
payload = {"content": {"target": "events"}}
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

# wait for tasks to complete
time.sleep(5)

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"{baseUri}/tasks/{taskId}/subtasks"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "subtasks": [
    ]
}

subtasks options

Get options for the resource.

path Parameters
task_id
required
integer >= 1

Task ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

task errors

get task errors

Get errors of a task by the task ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
task_id
required
integer >= 1

Task ID.

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import time
from uuid import uuid4

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

payload = {
    "description": "matching famous people with customers",
    "content": {
        "markup": [
            {"face_id": str(uuid4()), "label": 1},
            {"face_id": str(uuid4()), "label": 2},
        ],
    },
}

url = f"{baseUri}/tasks/roc"
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

# wait for tasks to complete
time.sleep(5)

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

url = f"{baseUri}/tasks/{taskId}/errors"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{}

task errors options

Get options for the resource.

path Parameters
task_id
required
integer >= 1

Task ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get errors

Get errors according to the filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

task_ids
string <comma-separate task ids> (taskIds)
Example: task_ids=1,2,3

Comma-separated task IDs.

error_code
integer (error_code)

Error code.

error_ids
string <comma-separate task ids> (errorIds) non-empty
Example: error_ids=4,5,6

Comma-separated error IDs.

error_time__lt
string <date-time> (time)
Example: error_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object error_time.

error_time__gte
string <date-time> (time)
Example: error_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object error_time.

task_type
integer (task_type)
Enum: 0 1 2 3 4 5 6 7 8 9
Example: task_type=1

Task type.

task type value
unknown 0
linker 1
clusterization 2
report 3
garbage collection 4
additional extract 5
cross match 6
roc-curve calculation 7
export objects 8
estimate data 9
status_code
integer (status_code) [ 400 .. 599 ]
Example: status_code=500

HTTP status code.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import time
from uuid import uuid4

baseUri = "http://127.0.0.1:5000/6"

# create bad task
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
payload = {
    "description": "matching famous people with customers",
    "content": {
        "markup": [
            {"face_id": str(uuid4()), "label": 1},
            {"face_id": str(uuid4()), "label": 2},
        ],
    },
}
url = f"{baseUri}/tasks/roc"
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

# wait for tasks to complete
time.sleep(5)

# get tasks error id list
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/{taskId}/errors"
response = requests.get(url, headers=headers)
errorIds = [
    str(error["error_id"]) for error in response.json()["errors"]
]

# get error according to the filters
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
payload = {
    "errors": [
        {
            "error_id": ",".join(errorIds),
            "task_id": taskId,
            "error_time__gte": "2018-08-11T09:11:41.674Z",
        }
    ]
}

url = f"{baseUri}/tasks/errors"
response = requests.get(url, headers=headers, json=payload)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{}

errors options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get errors count

Count errors according to the filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

error_time__lt
string <date-time> (time)
Example: error_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object error_time.

error_time__gte
string <date-time> (time)
Example: error_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object error_time.

task_type
integer (task_type)
Enum: 0 1 2 3 4 5 6 7 8 9
Example: task_type=1

Task type.

task type value
unknown 0
linker 1
clusterization 2
report 3
garbage collection 4
additional extract 5
cross match 6
roc-curve calculation 7
export objects 8
estimate data 9
status_code
integer (status_code) [ 400 .. 599 ]
Example: status_code=500

HTTP status code.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import time
from uuid import uuid4

baseUri = "http://127.0.0.1:5000/6"

# create bad task
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
payload = {
    "description": "matching famous people with customers",
    "content": {
        "markup": [
            {"face_id": str(uuid4()), "label": 1},
            {"face_id": str(uuid4()), "label": 2},
        ],
    },
}
url = f"{baseUri}/tasks/roc"
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

# wait for tasks to complete
time.sleep(5)

# get tasks error id list
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/{taskId}/errors"
response = requests.get(url, headers=headers)
errorIds = [
    str(error["error_id"]) for error in response.json()["errors"]
]

# get error count
headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
payload = {
    "errors": [
        {
            "error_id": ",".join(errorIds),
            "task_id": taskId,
            "error_time__gte": "2018-08-11T09:11:41.674Z",
        }
    ]
}

url = f"{baseUri}/tasks/errors/count"
response = requests.get(url, headers=headers, json=payload)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "count": 18
}

task errors count options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get error

Get error by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
error_id
required
integer >= 1

Error ID.

query Parameters
error_id
integer (errorId)
Example: error_id=10

Error ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests
import time
from uuid import uuid4

baseUri = "http://127.0.0.1:5000/6"

# create bad task
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
payload = {
    "description": "matching famous people with customers",
    "content": {
        "markup": [
            {"face_id": str(uuid4()), "label": 1},
            {"face_id": str(uuid4()), "label": 2},
        ],
    },
}
url = f"{baseUri}/tasks/roc"
taskId = requests.post(url, headers=headers, json=payload).json()["task_id"]

# wait for tasks to complete
time.sleep(5)

# get tasks error id list
headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/{taskId}/errors"
response = requests.get(url, headers=headers)
errorId = [
    str(error["error_id"]) for error in response.json()["errors"]
][0]

url = f"{baseUri}/tasks/errors/{errorId}"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{}

error options

Get options for the resource.

path Parameters
error_id
required
integer >= 1

Error ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

task schedules

create tasks schedule

Create a new task schedule.

Execution of scheduled tasks will be regulated according to the trigger and optionally starts one task immediately (see start_immediately parameter in behavior section).

No task from the schedule will be executed if the previous task has not yet been completed.

Permissions for task objects.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

Content type is application/json.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
required
any (task_schedulable)

Task schedule.

required
object (schedule_trigger)

Task schedule trigger.

object (schedule_behaviour)

Schedule behaviour parameters.

Responses

Request samples

Content type
application/json
{
  • "task": {
    },
  • "trigger": {
    },
  • "behaviour": {
    }
}

Response samples

Content type
application/json
{
  • "schedule_id": 1
}

get tasks schedules

Get tasks schedules with filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

task_type
integer (task_type_schedulable_reply)
Enum: 1 2 3 4 5 6 7 8 9
Example: task_type=1

Task type.

Task type Value
Linker 1
Clusterization 2
Report 3
Garbage collection 4
Additional extract 5
Cross match 6
Roc-curve calculation 7
Export objects 8
estimator 9
create_time__lt
string <date-time> (time)
Example: create_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object create_time.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object create_time.

account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
params = {
        "create_time__lt": "2018-08-11T09:11:41.674Z", 
        "create_time_gte": "2050-08-11T09:11:41.674Z",
        "task_type": 1,
}
url = f"{baseUri}/tasks/schedules"
response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
[
  • {
    }
]

schedules options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get tasks schedule

Get tasks schedule by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
schedule_id
required
integer (schedule_id) >= 1

Schedule according to which the task was created

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

payload = {
    "task": {
        "task_type": 1,
        "content": {
            "create_list": 1,
            "objects_type": "faces",
            "filters": {
                "create_time__gte": "2018-08-11T09:11:41.674Z"
            },
        },
    },
    "trigger": {"cron": "5 4 * * *", "cron_timezone": "utc"},
    "behaviour": {"start_immediately": False, "create_stopped": False}
    
}

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/schedules"
response = requests.post(url, headers=headers, json=payload)
scheduleId = response.json()["schedule_id"]

url = f"{baseUri}/tasks/schedules/{scheduleId}"
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "schedule_id": 1,
  • "task_ids": [
    ],
  • "account_id": "string",
  • "task": {
    },
  • "trigger": {
    },
  • "status": "running",
  • "next_run_time": "2018-08-11T09:11:41.674Z",
  • "create_time": "2018-08-11T09:11:41.674Z",
  • "last_update_time": "2018-08-11T09:11:41.674Z"
}

replace tasks schedule

Replace tasks schedule:

  • if any task created by old schedule is running, it will be cancelled

  • schedule parameters will be replaced with the new ones

  • tasks will be executed according to the new schedule

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
schedule_id
required
integer (schedule_id) >= 1

Schedule according to which the task was created

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
required
any (task_schedulable)

Task schedule.

required
object (schedule_trigger)

Task schedule trigger.

object (schedule_behaviour)

Schedule behaviour parameters.

Responses

Request samples

Content type
application/json
{
  • "task": {
    },
  • "trigger": {
    },
  • "behaviour": {
    }
}

Response samples

Content type
application/json
{
  • "schedule_id": 1
}

patch tasks schedule

Pause/start tasks schedule.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
schedule_id
required
integer (schedule_id) >= 1

Schedule according to which the task was created

query Parameters
action
required
string
Enum: "pause" "start"

Pause/start tasks schedule.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

# create list
url = f"{baseUri}/lists"
listId = requests.post(url, headers=headers).json()["list_id"]

# create face
url = f"{baseUri}/faces"
faceId = requests.post(url, headers=headers).json()["face_id"]

payload = {
    "task": {
        "task_type": 1,
        "content": {
            "create_list": 0,
            "objects_type": "faces",
            "list_id": listId,
            "filters": {
                "face_ids": [faceId],
            },
        },
    },
    "trigger": {"cron": "5 4 * * *", "cron_timezone": "utc"},
    "behaviour": {"start_immediately": False, "create_stopped": False}

}

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/schedules"
response = requests.post(url, headers=headers, json=payload)
scheduleId = response.json()["schedule_id"]

# Patch schedule
params = {"action": "pause"}
response = requests.patch(url + f"/{scheduleId}", headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{}

delete tasks schedule

Delete tasks schedule.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
schedule_id
required
integer (schedule_id) >= 1

Schedule according to which the task was created

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}

# create list
url = f"{baseUri}/lists"
listId = requests.post(url, headers=headers).json()["list_id"]

# create face
url = f"{baseUri}/faces"
faceId = requests.post(url, headers=headers).json()["face_id"]

payload = {
    "task": {
        "task_type": 1,
        "content": {
            "create_list": 0,
            "objects_type": "faces",
            "list_id": listId,
            "filters": {
                "face_ids": [faceId],
            },
        },
    },
    "trigger": {"cron": "5 4 * * *", "cron_timezone": "utc"},
    "behaviour": {"start_immediately": False, "create_stopped": False}

}

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/tasks/schedules"
response = requests.post(url, headers=headers, json=payload)
scheduleId = response.json()["schedule_id"]

# Delete schedule
payload = {"action": "pause"}
response = requests.delete(url + f"/{scheduleId}", headers=headers, json=payload)

print(response.status_code)

Response samples

Content type
application/json
{}

schedule options

Get options for the resource.

path Parameters
schedule_id
required
integer (schedule_id) >= 1

Schedule according to which the task was created

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

verifiers

create verifier

Create a verifier.

The verifier determines a list of rules for processing and verification of input images.

You can set:

  • verification_threshold
  • detect_policy
  • extract_policy
  • storage_policy for attributes and face samples.

The created handler can be used in "raw verification" and "perform verification" requests.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
description
string <= 128 characters

Verifier user description.

object

Responses

Request samples

Content type
application/json
{
  • "description": "strict verifier",
  • "policies": {
    }
}

Response samples

Content type
application/json
{}

get verifiers

Get verifiers by filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

description
string

Records with descriptions similar to this parameter will be processed.

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}

url = f"{baseUri}/verifiers"

payload = {
    "description": "new verifier",
    "policies": {
        "verification_threshold": 0.5,
        "detect_policy": {
            "estimate_mask": 1
        },
        "extract_policy": {
            "extract_basic_attributes": 1
        },
        "storage_policy": {
            "attribute_policy": {
                "store_attribute": 1
            },
            "face_sample_policy": {
                "store_sample": 1
            }
        }
    }
}

# create verifier
requests.post(url, json=payload, headers=headers)

# get verifiers
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

verifiers options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

raw verification

This request performs verification of input descriptors.

"Similarity" and "verification status" are returned for each candidate.

"Verification status" is "True" if the received similarity is greater than the verification_threshold (specified in the verifier handler). Hence, the reference and the candidate are considered the same person.

You should specify descriptors as references and candidates for this request.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
verifier_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Verifier ID.

header Parameters
Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Enum: "application/json" "application/msgpack"

Format of a request body data.

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Request Body schema:
required
Array of xpk_file_entity_base64 (object) or sdk_descriptor_entity_base64 (object) or raw_descriptor_entity_base64 (object) non-empty

Reference list for verification.

required
Array of xpk_file_entity_base64 (object) or sdk_descriptor_entity_base64 (object) or raw_descriptor_entity_base64 (object) non-empty

Candidates for verification.

Responses

Request samples

Content type
{
  • "references": [
    ],
  • "candidates": [
    ]
}

Response samples

Content type
application/json
{
  • "matches": [
    ]
}

raw verification options

Get options for the resource.

path Parameters
verifier_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Verifier ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

perform verification

Verify given images and/or descriptors against specified objects set: faces IDs, events IDs, external IDs.

"Similarity" and "verification status" are returned for each candidate.

"Verification status" is "True" if the received similarity is greater than the verification_threshold (specified in the verifier handler). Hence, the reference and the candidate are considered the same person.

The input images are processed according to the specified policies and the received information is returned in the response.

Objects to be processed must belong to the user account making the request.

Notes for incoming data:

  • face or body bounding boxes passed with face or body warped image will be ignored.
Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
verifier_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Verifier ID.

query Parameters
face_ids
string <list of uuid>
Example: face_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of face IDs.

event_ids
string <list of uuid.>
Example: event_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of event IDs.

attribute_ids
string <list of uuid>
Example: attribute_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of attribute IDs.

external_ids
string
Example: external_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of external IDs.

image_type
integer
Default: 0
Enum: 0 1

Image type of input image. 0 - raw image, 1 - face warped image.

use_exif_info
integer
Default: 1
Enum: 0 1
Example: use_exif_info=1

Whether to try to auto orient image based on EXIF data.

The processed image should have EXIF data, otherwise auto orientation will not be performed.

Has no effect with tiff images (they're always auto oriented).

Ignored with warped images (see warped_image or image_type parameter).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Enum: "image/jpeg" "image/png" "image/bmp" "image/x-portable-pixmap" "image/tiff" "multipart/form-data" "application/json" "image/x-jpeg-base64" "image/x-png-base64" "image/x-bmp-base64" "image/x-tiff-base64" "image/x-portable-pixmap-base64" "application/x-sdk-descriptor" "application/x-sdk-descriptor-base64" "application/x-vl-xpk" "application/x-vl-xpk-base64"
Request Body schema:
string <binary>

Responses

Request samples

Content type
No sample

Response samples

Content type
application/json
{
  • "images": [
    ]
}

verification options

Get options for the resource.

path Parameters
verifier_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Verifier ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

count verifiers

Count verifiers that satisfy the filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

description
string

Records with descriptions similar to this parameter will be processed.

header Parameters
Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}

url = f"{baseUri}/verifiers"

payload = {
    "description": "new verifier",
    "policies": {
        "verification_threshold": 0.5,
        "detect_policy": {
            "estimate_mask": 1
        },
        "extract_policy": {
            "extract_basic_attributes": 1
        },
        "storage_policy": {
            "attribute_policy": {
                "store_attribute": 1
            },
            "face_sample_policy": {
                "store_sample": 1
            }
        }
    }
}

# create verifier
requests.post(url, json=payload, headers=headers)

url = f"{url}/count"

# get verifiers count
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "verifiers_count": 4
}

count verifiers options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get verifier

Get verifier by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
verifier_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Verifier ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}

url = f"{baseUri}/verifiers"

payload = {
    "description": "new verifier",
    "policies": {
        "verification_threshold": 0.5,
        "detect_policy": {
            "estimate_mask": 1
        },
        "extract_policy": {
            "extract_basic_attributes": 1
        },
        "storage_policy": {
            "attribute_policy": {
                "store_attribute": 1
            },
            "face_sample_policy": {
                "store_sample": 1
            }
        }
    }
}

# create verifier
response = requests.post(url, json=payload, headers=headers)
verifierId = response.json()["verifier_id"]

url = f"{url}/{verifierId}"

# get verifier
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "verifier_id": "b668c4a5-2191-476e-a261-3b4f9ce2e25e",
  • "account_id": "0468ca85-f6ca-4841-b30c-5ccc26b6f397",
  • "description": "simple verifier",
  • "policies": {
    },
  • "create_time": "2019-08-24T14:15:22Z",
  • "last_update_time": "2019-08-24T14:15:22Z",
  • "version": 111
}

replace verifier

Update the verifier. You can not update a part of verifier, so you should specify all the fields for your handler.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
verifier_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Verifier ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Value: "application/json"

Content type is application/json.

Request Body schema: application/json
description
string <= 128 characters

Verifier user description.

object

Responses

Request samples

Content type
application/json
{
  • "description": "strict verifier",
  • "policies": {
    }
}

Response samples

Content type
application/json
{
  • "version": 111
}

check if verifier exists

Check if verifier with verifier_id exists.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
verifier_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Verifier ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}

url = f"{baseUri}/verifiers"

payload = {
    "description": "new verifier",
    "policies": {
        "verification_threshold": 0.5,
        "detect_policy": {
            "estimate_mask": 1
        },
        "extract_policy": {
            "extract_basic_attributes": 1
        },
        "storage_policy": {
            "attribute_policy": {
                "store_attribute": 1
            },
            "face_sample_policy": {
                "store_sample": 1
            }
        }
    }
}

# create verifier
response = requests.post(url, json=payload, headers=headers)
verifierId = response.json()["verifier_id"]

url = f"{url}/{verifierId}"

# check verifier
response = requests.head(url, headers=headers)

print(response.status_code)

remove verifier

Remove verifier by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
verifier_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Verifier ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {"Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE="}

url = f"{baseUri}/verifiers"

payload = {
    "description": "new verifier",
    "policies": {
        "verification_threshold": 0.5,
        "detect_policy": {
            "estimate_mask": 1
        },
        "extract_policy": {
            "extract_basic_attributes": 1
        },
        "storage_policy": {
            "attribute_policy": {
                "store_attribute": 1
            },
            "face_sample_policy": {
                "store_sample": 1
            }
        }
    }
}

# create verifier
response = requests.post(url, json=payload, headers=headers)
verifierId = response.json()["verifier_id"]

url = f"{url}/{verifierId}"

# delete verifier
response = requests.delete(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
{}

verifier options

Get options for the resource.

path Parameters
verifier_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Verifier ID.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

ws

ws handshake

Ws handshake.

Attention!

Subscription to events occurs via WebSocket. Messages sent by ws you can view in callback section. Connection supports autoping.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
sources
string
Example: sources=cam1,cam2

Comma-separated list of sources. Each event from result will contain one of given sources.

stream_ids
string <list of uuid.>
Example: stream_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of stream IDs.

matching_candidates_labels
string
Example: matching_candidates_labels=matching_label_1,matching_label_2

Comma-separated list of matching candidates label. Each event from result will contain one or more given labels.

object_similarity__gte
number
Example: object_similarity__gte=0.5

Object similarity lower included bound (boundary for top matching candidate).

object_similarity__lt
number
Example: object_similarity__lt=0.5

Object similarity upper excluded bound (boundary for top matching candidate).

age__lt
integer
Example: age__lt=50

Age upper excluded bound.

age__gte
integer
Example: age__gte=50

Age lower included bound.

gender
integer
Enum: 0 1
Example: gender=1

Gender. 1 - male, 0 - female.

ethnic_groups
string <list of integer (1, 2, 3, 4)>
Example: ethnic_groups=1,2

Comma-separated list of dominant ethnic group. Each event from result will contain one of the given ethnic groups.

ethnicity value
African american 1
Indian 2
Asian 3
Caucasian 4
liveness
string <list of integer (0, 1 ,2)>
Example: liveness=1,2

Comma-separated list of dominant liveness. Each event from result will contain one of the given liveness.

liveness value
spoof 0
real 1
unknown 2
deepfake
string <list of integer(0, 1)>
Example: deepfake=0,1

Comma-separated list of dominant deepfakes. Each event from result will contain one of the given deepfake.

deepfake value
fake 0
real 1
tags
Array of strings (tag) >= 0 items [ items <= 36 characters ]
Example: tags=tag_1,tag_2

Comma-separated list of tags. Each event from result will contain all of given tags. Each tag can be at most 36 characters.

user_data
string
Example: user_data=user_data_text

Find all objects with user_data similar to this parameter. You can specify only part of the user_data value for this filter.

object
Example: geo_position=origin_longitude,36.616,origin_latitude,55.752

Geo position filter, i.e. geo bounding box specified by coordinates of its center (origin) and some delta. Each event from result will be covered by bbox specified.

cities
string
Example: cities=Moscow,New York

Comma-separated list of cities. Each event from result will contain one of given cities in "location" parameter.

areas
string
Example: areas=CAD,Manhattan

Comma-separated list of areas. Each event from result will contain one of given areas in "location" parameter.

districts
string
Example: districts=Mitino,Midtown

Comma-separated list of districts. Each event from result will contain one of given districts in "location" parameter.

streets
string
Example: streets=Arbat,West 48th street

Comma-separated list of streets. Each event from result will contain one of given streets in "location" parameter.

house_numbers
string
Example: house_numbers=1,220

Comma-separated list of house numbers. Each event from result will contain one of given house numbers in "location" parameter.

handler_ids
string <list of uuid.>
Example: handler_ids=8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc381

Comma-separated list of handler IDs.

masks
string <list of integer(1, 2, 3)>
Example: masks=1,2,3

Comma-separated list of predominant masks. Each event from result will contain one of the given mask state.

mask value
missing 1
medical_mask 2
occluded 3
emotions
string <list of integer (1, 2, 3, 4, 5, 6, 7)>
Example: emotions=1,2,3

Comma-separated list of predominant emotions. Each event from result will contain one of the given emotions.

emotions value
anger 1
disgust 2
fear 3
happiness 4
neutral 5
sadness 6
surprise 7
apparent_gender
Array of integers
Items Enum: 0 1 2
Example: apparent_gender=1

Comma-separated list of apparent gender: 0 - female, 1 - male, 2 - undefined. Each event from result will contain one of the given states.

apparent_age__gte
integer [ 0 .. 100 ]
Example: apparent_age__gte=50

Apparent age lower included bound.

apparent_age__lt
integer [ 0 .. 100 ]
Example: apparent_age__lt=50

Apparent age upper excluded bound.

headwear_states
Array of integers
Items Enum: 0 1 2
Example: headwear_states=1

Comma-separated list of headwear states: 0 - absent, 1 - present, 2 - undefined. Each event from result will contain one of the given states.

headwear_apparent_colors
Array of strings (headwear_color)
Items Enum: "undefined" "black" "white" "other"
Example: headwear_apparent_colors=white,undefined

Comma-separated list of headwear apparent colors. Each event from result will contain one of the given states.

sleeve_lengths
Array of strings
Items Enum: "short" "long" "undefined"
Example: sleeve_lengths=short,undefined

Comma-separated list of sleeve length states. Each event from result will contain one of the given states.

upper_clothing_colors
Array of strings (clothing_color)
Items Enum: "undefined" "black" "blue" "green" "gray" "orange" "purple" "red" "white" "yellow" "pink" "brown" "beige" "khaki" "multicolored"
Example: upper_clothing_colors=black,white

Comma-separated list of upper clothing colors. Each event from result will contain at least one of the given clothing colors.

lower_garment_colors
Array of strings (clothing_color)
Items Enum: "undefined" "black" "blue" "green" "gray" "orange" "purple" "red" "white" "yellow" "pink" "brown" "beige" "khaki" "multicolored"
Example: lower_garment_colors=black,white

Comma-separated list of lower garment colors. Each event from result will contain at least one of the given clothing colors.

lower_garment_types
Array of strings
Items Enum: "undefined" "trousers" "shorts" "skirt"
Example: lower_garment_types=trousers,undefined

Comma-separated list of lower garment types. Each event from result will contain one of the given types.

shoes_apparent_colors
Array of strings (shoes_color)
Items Enum: "undefined" "black" "white" "other"
Example: shoes_apparent_colors=white,undefined

Comma-separated list of shoes apparent colors. Each event from result will contain one of the given states.

backpack_states
Array of integers
Items Enum: 0 1 2
Example: backpack_states=1
header Parameters
Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

from luna3.lunavl.httpclient import LunaHttpClient

EXPECTED_EVENT_COUNT = 1

client = LunaHttpClient(origin='http://127.0.0.1:5000', api=6, login="luna@visionlabs.ru", password="luna")
with client.wsConnect() as ws:
    for _ in range(EXPECTED_EVENT_COUNT):
        WS_RESP = ws.recv()
        print(WS_RESP)

Response samples

Content type
application/json
{
  • "event": {
    },
  • "handler_id": "88c5dd7e-693b-4386-92bc-0c31a150a7d0",
  • "event-create-time": "2021-06-18T02:44:58.653485+03:00",
  • "event-end-time": "2021-06-18T02:44:58.653485+03:00",
  • "Luna-Request-id": "1623984298,375c6d96-09c7-4db3-91cc-f13e66288aa9"
}

ws handshake options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

liveness

predict liveness

Predict liveness probability in input images.

The response contains the probability that there is a real person in the image, and it is not a presentation attack.

"meta" and "x_meta" sections of the request are used for backward compatibility and are deprecated now.

The incoming images should correspond the requirements of the utilized Liveness version. See "Administrator’s manual" for details.

Liveness estimation is not supported for samples (warped images).

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
aggregate
integer
Default: 0
Enum: 1 0
Example: aggregate=1

Whether to aggregate liveness estimations.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Content-Type
string
Enum: "image/jpeg" "image/png" "image/bmp" "image/x-portable-pixmap" "image/tiff" "multipart/form-data" "application/json" "image/x-jpeg-base64" "image/x-png-base64" "image/x-bmp-base64" "image/x-tiff-base64" "image/x-portable-pixmap-base64"
Request Body schema:
object (LivenessMeta)
Deprecated

Device information. This information can significantly decrease the overall error rate.

The "meta" object is not mandatory. If you are not sure about any of the parameters, set "UNKNOWN" value or don't pass meta.

The specified meta is applied to all the images within the request.

x_meta
object
Deprecated

The JSON string with any additional information.

required
Array of image_binary_for_multipart (string) or image_base64_for_multipart (string) (image_list_for_multipart) non-empty

Responses

Request samples

Content type
No sample

Response samples

Content type
application/json
{}

liveness options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

documents

get openapi documentation

Get service OpenApi documentation. If Accept request header is of type application/x-yaml, returns documentation in yaml format or returns html documentation, if Accept is text/html.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Accept
required
string (accept_docs_handler)
Enum: "application/x-yaml" "text/html"

Acceptable type of receiving data.

Responses

Response samples

Content type
application/json
{}

get openapi documentation options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get development manual

Get sphinx documentation - Development Manual. After the request you will be redirected to the page /docs/dev/index.html

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get development documentation options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

config

get service configuration

Get service configuration. Passwords and tokens will be hidden in the response.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Accept
string
Enum: "application/json" "text/plain"

Acceptable type of receiving data.

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
    "Authorization": "Basic bHVuYUB2aXNpb25sYWJzLnJ1Omx1bmE=",
}
url = f"{baseUri}/config"

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
{
  • "INFLUX_MONITORING": {
    }
}

get config options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

features

get platform features

Get information about platform features:

  • relevance of the license (license)
  • enabled estimations (estimations)
  • enabled modules (components)
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
"Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
}
url = f"{baseUri}/features"

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "license": true,
  • "estimations": {
    },
  • "components": {
    }
}

features options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

plugins

get list of plugins

Get list of service plugins:

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
"Luna-Request-Id": "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a",
}
url = f"{baseUri}/plugins"

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "plugins": [
    ]
}

plugins options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

lambda [beta]

create lambda

Create a new lambda.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
required
string
Value: "multipart/form-data"

The request content type header.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: multipart/form-data
archive
required
string <binary>

Archive file with zip extension. Content-Type must be "application/zip".

required
object

Lambda credentials. Content-Type must be "application/json".

object

Parameters for lambda. Content-Type must be "application/json".

Responses

Request samples

# This example is written using requests library
from time import sleep
import json
from uuid import uuid4

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}
lambdaName = str(uuid4())
url = f"{baseUri}/lambdas/"
with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "credentials": (
            "credentials",
            json.dumps(
                {"lambda_name": lambdaName, "description": "test description"}
            ), "application/json"),
        "parameters": (
            "parameters",
            json.dumps(
                {"lambda_type": "standalone"}
            ), "application/json"),
    }

response = requests.post(url, headers=headers, files=files)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "lambda_id": "string"
}

get lambdas

Get lambdas according to filters.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

create_time__lt
string <date-time> (time)
Example: create_time__lt=2018-08-11T09:11:41.674Z

Upper bound for object create_time.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2018-08-11T09:11:41.674Z

Lower included bound for object create_time.

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

lambda_type
string
Enum: "standalone" "handlers"

Lambda type.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library
from time import sleep

from datetime import datetime, timedelta
from uuid import uuid4

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}
accountId = "00000000-0000-4000-a000-000000000156"
lambdaId = str(uuid4())
lambdaName = str(uuid4())
timeDelta = timedelta(days=1)
params = {
    "account_id": accountId,
    "create_time__lt": datetime.utcnow().isoformat("T") + "Z",
    "create_time__gte": (datetime.utcnow() - timeDelta).isoformat("T") + "Z",
    "page": 1,
    "page_size": 100,
    "lambda_type": "standalone"
}
url = f"{baseUri}/lambdas/"

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "lambdas": [
    ]
}

validation lambda

Validate lambda.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
required
string
Value: "multipart/form-data"

The request content type header.

Request Body schema: application/zip
archive
required
string <binary>

Archive file with zip extension. Content-Type must be "application/zip".

required
object

Parameters for lambda.

Responses

Request samples

# This example is written using requests library
from time import sleep

import json
import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}
url = f"{baseUri}/lambdas/validator"

with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "parameters": (
            "parameters",
            json.dumps({"lambda_type": "standalone"}),
            "application/json",
        )
    }

response = requests.post(url, headers=headers, files=files)

print(response.status_code)

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

put lambda

Update lambda. You cannot update a part of the lambda, so you should specify all the fields for your lambda.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
required
string
Value: "multipart/form-data"

The request content type header.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: multipart/form-data
archive
required
string <binary>

Archive file with zip extension. Content-Type must be "application/zip".

required
object

Lambda credentials. Content-Type must be "application/json".

object

Parameters for lambda. Content-Type must be "application/json".

Responses

Request samples

# This example is written using requests library
from time import sleep

import json
from uuid import uuid4

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}

# Create lambda
def wait4start(lambdaId: str) -> None:
    """
    Wait for lambda start

    Args:
        lambdaId: lambda id
    """
    for _ in range(150):
        reply = requests.get(f"{baseUri}/lambdas/{lambdaId}/status", headers=headers).json()
        if reply["status"] == "running":
            break
        if reply["status"] == "terminated":
            raise Exception(f"Expected successfully lambda running. Lambda id: {lambdaId}")
        sleep(1)
    else:
        raise Exception(f"Lambda execution took more than 150 seconds. Lambda id: {lambdaId}")

url = f"{baseUri}/lambdas/"
with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "credentials": (
            "credentials",
            json.dumps(
                {"lambda_name": str(uuid4()), "description": "new lambda description"}
            ), "application/json"),
        "parameters": (
            "parameters",
            json.dumps(
                {"lambda_type": "standalone"}
            ), "application/json"),
    }
response = requests.post(url, headers=headers, files=files)
lambdaId = response.json()["lambda_id"]
wait4start(lambdaId)

# Put lambda

files.update(
    {
      "credentials": (
            "credentials",
            json.dumps(
                {"lambda_name": str(uuid4()), "description": "new lambda description"}
            ), "application/json") 
    }
)
response = requests.put(url + lambdaId, headers=headers, files=files)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "version": 0
}

patch lambda

Patch lambda.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Content-Type
string
Value: "application/json"

The request content type header.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Request Body schema: application/json
non-empty
lambda_name
string (lambda_name)

Lambda name. Each user can create only lambdas with unique names.

description
string <= 256 characters

Lambda description.

Responses

Request samples

Content type
application/json
{
  • "lambda_name": "first-lambda",
  • "description": "very useful lambda"
}

Response samples

Content type
application/json
Example
{}

get lambda

Get lambda by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library
from time import sleep

import json

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}
lambdaId = "64e61920-f5ca-4caf-8f2e-d0217e2e6c0f"
url = f"{baseUri}/lambdas/{lambdaId}"
params = {
    "account_id": "00000000-0000-4000-a000-000000000156",
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "account_id": "string",
  • "lambda_id": "string",
  • "lambda_name": "first-lambda",
  • "description": "very useful lambda",
  • "version": 1,
  • "info": {
    },
  • "lambda_type": "standalone",
  • "create_time": "2019-08-24T14:15:22Z",
  • "last_update_time": "2018-08-11T09:11:41.674Z",
  • "additional_user_docker_commands": [ ],
  • "base_image": {
    }
}

check lambda existence

Check existence of the lambda by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library
from time import sleep

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}
lambdaId = "64e61920-f5ca-4caf-8f2e-d0217e2e6c0f"
url = f"{baseUri}/lambdas/{lambdaId}"

response = requests.head(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
{}

delete lambda

Remove lambda by ID.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library
from time import sleep

import requests
import json
from uuid import uuid4


baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}

# Create lambda
def wait4start(lambdaId: str) -> None:
    """
    Wait for lambda start

    Args:
        lambdaId: lambda id
    """
    for _ in range(150):
        reply = requests.get(f"{baseUri}/lambdas/{lambdaId}/status", headers=headers).json()
        if reply["status"] == "running":
            break
        if reply["status"] == "terminated":
            raise Exception(f"Expected successfully lambda running. Lambda id: {lambdaId}")
        sleep(1)
    else:
        raise Exception(f"Lambda execution took more than 150 seconds. Lambda id: {lambdaId}")

lambdaName = str(uuid4())
url = f"{baseUri}/lambdas/"
with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "credentials": (
            "credentials",
            json.dumps(
                {"lambda_name": lambdaName, "description": "lambda description"}
            ), "application/json"),
        "parameters": (
            "parameters",
            json.dumps(
                {"lambda_type": "standalone"}
            ), "application/json"),
    }
response = requests.post(url, headers=headers, files=files)
lambdaId = response.json()["lambda_id"]
wait4start(lambdaId)

# Delete lambda

url = f"{baseUri}/lambdas/{lambdaId}"

response = requests.delete(url, headers=headers)

print(response.status_code)

Response samples

Content type
application/json
{}

update lambda

Update lambda using latest base image.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the plugin.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library
from time import sleep

import json
from uuid import uuid4

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}

# Create lambda
def wait4start(lambdaId: str) -> None:
    """
    Wait for lambda start

    Args:
        lambdaId: lambda id
    """
    for _ in range(150):
        reply = requests.get(f"{baseUri}/lambdas/{lambdaId}/status", headers=headers).json()
        if reply["status"] == "running":
            break
        if reply["status"] == "terminated":
            raise Exception(f"Expected successfully lambda running. Lambda id: {lambdaId}")
        sleep(1)
    else:
        raise Exception(f"Lambda execution took more than 150 seconds. Lambda id: {lambdaId}")

lambdaName = str(uuid4())
url = f"{baseUri}/lambdas/"
with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "credentials": (
            "credentials",
            json.dumps(
                {"lambda_name": lambdaName, "description": "lambda description"}
            ), "application/json"),
        "parameters": (
            "parameters",
            json.dumps(
                {"lambda_type": "standalone"}
            ), "application/json"),
    }
response = requests.post(url, headers=headers, files=files)
lambdaId = response.json()["lambda_id"]
wait4start(lambdaId)

# Update lambda

url = f"{baseUri}/lambdas/{lambdaId}/update"
response = requests.post(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "version": 0
}

get lambda image creation status

Get lambda image creation status by lambda ID.

If lambda image creation is in progress, lambda status will be waiting.

After lambda image creation will end, the lambda image creation job will be removed and status will be not_found.

For more information about lambda and lambda images statuses see development manual.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library
from time import sleep

import json
from uuid import uuid4

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}

# Create lambda
def wait4start(lambdaId: str) -> None:
    """
    Wait for lambda start

    Args:
        lambdaId: lambda id
    """
    for _ in range(150):
        reply = requests.get(f"{baseUri}/lambdas/{lambdaId}/status", headers=headers).json()
        if reply["status"] == "running":
            break
        if reply["status"] == "terminated":
            raise Exception(f"Expected successfully lambda running. Lambda id: {lambdaId}")
        sleep(1)
    else:
        raise Exception(f"Lambda execution took more than 150 seconds. Lambda id: {lambdaId}")

lambdaName = str(uuid4())
url = f"{baseUri}/lambdas/"
with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "credentials": (
            "credentials",
            json.dumps({"lambda_name": lambdaName, "description": "lambda description"}),
            "application/json",
        ),
        "parameters": ("parameters", json.dumps({"lambda_type": "standalone"}), "application/json"),
    }

response = requests.post(url, headers=headers, files=files)
lambdaId = response.json()["lambda_id"]
wait4start(lambdaId)

# Get lambda image creation status

url = f"{baseUri}/lambdas/{lambdaId}/image/status"

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "status": "not_found"
}

get lambda image creation logs

Get lambda image creation logs by lambda ID.

During the creation of the lambda image, it is possible to get logs to monitor the progress.

For more information about lambda and lambda images logs see development manual.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

query Parameters
tail_lines
integer [ 0 .. 4294967296 ]

Number of strings what will be return.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library
from time import sleep

import json
from uuid import uuid4

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}

# Create lambda
def wait4start(lambdaId: str) -> None:
    """
    Wait for lambda start

    Args:
        lambdaId: lambda id
    """
    for _ in range(150):
        reply = requests.get(f"{baseUri}/lambdas/{lambdaId}/status", headers=headers).json()
        if reply["status"] == "running":
            break
        if reply["status"] == "terminated":
            raise Exception(f"Expected successfully lambda running. Lambda id: {lambdaId}")
        sleep(1)
    else:
        raise Exception(f"Lambda execution took more than 150 seconds. Lambda id: {lambdaId}")

lambdaName = str(uuid4())
url = f"{baseUri}/lambdas/"
with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "credentials": (
            "credentials",
            json.dumps({"lambda_name": lambdaName, "description": "lambda description"}),
            "application/json",
        ),
        "parameters": ("parameters", json.dumps({"lambda_type": "standalone"}), "application/json"),
    }

response = requests.post(url, headers=headers, files=files)
lambdaId = response.json()["lambda_id"]
wait4start(lambdaId)

# Get lambda image creation logs

url = f"{baseUri}/lambdas/{lambdaId}/image/logs"
params = {"tail_lines": 1}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "logs": [
    ]
}

get lambda status

Get lambda status by ID.

If lambda image creation is in progress, lambda status will be waiting.

For more information about lambda and lambda images statuses see development manual.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library
from time import sleep

import json
from uuid import uuid4

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}

# Create lambda
def wait4start(lambdaId: str) -> None:
    """
    Wait for lambda start

    Args:
        lambdaId: lambda id
    """
    for _ in range(150):
        reply = requests.get(f"{baseUri}/lambdas/{lambdaId}/status", headers=headers).json()
        if reply["status"] == "running":
            break
        if reply["status"] == "terminated":
            raise Exception(f"Expected successfully lambda running. Lambda id: {lambdaId}")
        sleep(1)
    else:
        raise Exception(f"Lambda execution took more than 150 seconds. Lambda id: {lambdaId}")

lambdaName = str(uuid4())
url = f"{baseUri}/lambdas/"
with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "credentials": (
            "credentials",
            json.dumps({"lambda_name": lambdaName, "description": "lambda description"}),
            "application/json",
        ),
        "parameters": ("parameters", json.dumps({"lambda_type": "standalone"}), "application/json"),
    }

response = requests.post(url, headers=headers, files=files)
lambdaId = response.json()["lambda_id"]
wait4start(lambdaId)

# Get lambda image creation status

url = f"{baseUri}/lambdas/{lambdaId}/status"

response = requests.get(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "status": "running"
}

get lambda logs

Get lambda logs by ID.

After lambda creation has been executed, there is possibility to get lambda logs.

For more information about lambda and lambda images logs see development manual.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

tail_lines
integer [ 0 .. 4294967296 ]

Number of strings what will be return.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library
from time import sleep

import json
from uuid import uuid4

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}

# Create lambda
def wait4start(lambdaId: str) -> None:
    """
    Wait for lambda start

    Args:
        lambdaId: lambda id
    """
    for _ in range(150):
        reply = requests.get(f"{baseUri}/lambdas/{lambdaId}/status", headers=headers).json()
        if reply["status"] == "running":
            break
        if reply["status"] == "terminated":
            raise Exception(f"Expected successfully lambda running. Lambda id: {lambdaId}")
        sleep(1)
    else:
        raise Exception(f"Lambda execution took more than 150 seconds. Lambda id: {lambdaId}")

lambdaName = str(uuid4())
url = f"{baseUri}/lambdas/"
with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "credentials": (
            "credentials",
            json.dumps({"lambda_name": lambdaName, "description": "lambda description"}),
            "application/json",
        ),
        "parameters": ("parameters", json.dumps({"lambda_type": "standalone"}), "application/json"),
    }

response = requests.post(url, headers=headers, files=files)
lambdaId = response.json()["lambda_id"]
wait4start(lambdaId)

# Get lambda image creation logs

url = f"{baseUri}/lambdas/{lambdaId}/logs"
params = {"tail_lines": 1}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "logs": [
    ]
}

lambda proxy [beta]

get lambda openapi documentation

Get lambda OpenApi documentation. If Accept request header is of type application/x-yaml, returns documentation in yaml format or returns html documentation, if Accept-Type is text/html

path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Accept
required
string (accept_docs_handler)
Enum: "application/x-yaml" "text/html"

Acceptable type of receiving data.

Responses

Response samples

Content type
application/json
{}

proxy post request to lambda

Proxy POST request to lambda.

Request and response headers, query parameters and body description must be provided by lambda documentation.

Described headers will be processed and received independently of lambda behavior. In case of bearer authorization, the token must include view permissions for lambdas to process request.

Authorizations:
BasicAuthBearerAuthLunaAccountIdAuth
path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

* (any_parameter)
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Any additional path parameter will be use as path parameter to lambda

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Luna-Account-Id
string <uuid> ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Deprecated
Example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

Account ID.

An account is a limitation for all the user actions (matching, removing, updating and other) on data which does not have corresponding account ID. For example: it is impossible to attach a face with one account ID to a list with another account ID.

User can make a limited set of requests without this header (requests with methods GET, HEAD, OPTIONS, match requests and getting events statistics requests).

Responses

Request samples

# This example is written using requests library
from time import sleep

import json
from uuid import uuid4

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}

# Create lambda
def wait4start(lambdaId: str) -> None:
    """
    Wait for lambda start

    Args:
        lambdaId: lambda id
    """
    for _ in range(150):
        reply = requests.get(f"{baseUri}/lambdas/{lambdaId}/status", headers=headers).json()
        if reply["status"] == "running":
            break
        if reply["status"] == "terminated":
            raise Exception(f"Expected successfully lambda running. Lambda id: {lambdaId}")
        sleep(1)
    else:
        raise Exception(f"Lambda execution took more than 150 seconds. Lambda id: {lambdaId}")

lambdaName = str(uuid4())
url = f"{baseUri}/lambdas/"
with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "credentials": (
            "credentials",
            json.dumps({"lambda_name": lambdaName, "description": "lambda description"}),
            "application/json",
        ),
        "parameters": ("parameters", json.dumps({"lambda_type": "standalone"}), "application/json"),
    }

response = requests.post(url, headers=headers, files=files)
lambdaId = response.json()["lambda_id"]
wait4start(lambdaId)

# Post proxy request to lambda
path = "main"
url = f"{baseUri}/lambdas/{lambdaId}/proxy/{path}"

response = requests.post(url, headers=headers)

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
Example
{}

proxy options request to lambda

Proxy OPTIONS request to lambda.

The response to options contains all the possible methods that can be proxyed to a lambda, but does not say which of them are implemented and which are not.

path Parameters
lambda_id
required
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

ID of the lambda.

* (any_parameter)
string <uuid> (uuid) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

Any additional path parameter will be use as path parameter to lambda

query Parameters
account_id
string <uuid> (account_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: account_id=8950722f-3fd4-4223-b48f-03f95f0e8dfb

Account ID filter. Will not have effect if Luna-Account-Id header is used for authorization

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library
from time import sleep

import json
from uuid import uuid4

import requests

baseUri = "http://127.0.0.1:5000/6"

headers = {
    "Authorization": "Basic bHVuYV9sYW1iZGFAdmlzaW9ubGFicy5ydTpsdW5h",
}

# Create lambda

lambdaName = str(uuid4())
url = f"{baseUri}/lambdas/"
with open("lambda.zip", "rb") as archive:
    files = {
        "archive": ("lambda.zip", archive.read(), "application/zip"),
        "credentials": (
            "credentials",
            json.dumps({"lambda_name": lambdaName, "description": "lambda description"}),
            "application/json",
        ),
        "parameters": ("parameters", json.dumps({"lambda_type": "standalone"}), "application/json"),
    }

response = requests.post(url, headers=headers, files=files)
lambdaId = response.json()["lambda_id"]
wait4start(lambdaId)

# Put proxy request to lambda
path = "main"
url = f"{baseUri}/lambdas/{lambdaId}/proxy/{path}"

response = requests.options(url, headers=headers)

print(response.status_code)
print(response.headers)

Response samples

Content type
application/json
Example
{}

health

get health

Get health of service.

query Parameters
include_luna_services
integer
Default: 0
Enum: 0 1

Whether to perform healthchecks for dependent LUNA services.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library

import requests

baseUri = "http://127.0.0.1:5000/6"

# make request
url = f"{baseUri}/healthcheck"
response = requests.get(url, params={"include_luna_services": 1})

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "execution_time": 0.123
}

healthcheck options

Get options for the resource.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}

get health (redirect)

Get health of service (redirect).

query Parameters
include_luna_services
integer
Default: 0
Enum: 0 1

Whether to perform healthchecks for dependent LUNA services.

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Request samples

# This example is written using requests library

import requests

# make request
url = f"http://127.0.0.1:5000/healthcheck"
response = requests.get(url, params={"include_luna_services": 1})

print(response.status_code)
print(response.json())

Response samples

Content type
application/json
{
  • "execution_time": 0.123
}

healthcheck options (redirect)

Get options for the resource (redirect).

header Parameters
Luna-Request-Id
string^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4...
Example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a

External request ID. Helps to uniquely identify messages in system logs that correspond to particular requests. If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.

Responses

Response samples

Content type
application/json
{}