Luna Video Agent API (v.1.28.0)

Download OpenAPI specification:

'VisionLabs Luna Video Agent'

videosdk

video analytics

Request for video analysis based on the specified analytics parameters eg facial estimations.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Content-Type
string
Value: "application/json"
Request Body schema: application/json
required
object (deferred_task)

Deferred task setting. If enabled analytics will run in background. Task result and status can be received by /1/video/tasks/{task_id}

required
object

Video information.

required
Array of any

A list of parameters for comprehensive video analytics.

Responses

Request samples

Content type
application/json
{
  • "deferred_task": {
    },
  • "video": {
    },
  • "analytics": [
    ]
}

Response samples

Content type
Example
{
  • "video_data": {
    },
  • "analytics": [
    ]
}

video tasks

get task

Get video task by ID.

path Parameters
task_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

task ID.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "task_id": "string",
  • "status": 0,
  • "progress": 0.42,
  • "result_url": "string"
}

streams

create stream

Create stream.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Content-Type
string
Value: "application/json"

Content type is application/json.

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

Account ID.

Request Body schema: application/json
required
name
string <= 128 characters
Default: "stream"

Stream name.

description
string <= 512 characters
Default: ""

Stream description.

required
stream data with static orientation strategy (object) or stream data with video-info orientation strategy (object)
object

Stream location parameters.

event_source_group
string (event_source_group) <= 256 characters ^[a-zA-Z0-9_\-]+$

Additional information about stream source.

source
string (source) <= 128 characters

Additional information that user provides with event.

object

Stream autorestart parameters.

required
Array of objects (analytics_with_schedules_labeled) non-empty

Analytics.

object (stream_notification_policy)

stream processing notification policy

Responses

Request samples

Content type
application/json
{
  • "name": "stream",
  • "description": "",
  • "data": {
    },
  • "location": {
    },
  • "event_source_group": "group-123",
  • "source": "3rd Avenue",
  • "autorestart": {
    },
  • "analytics": [
    ],
  • "notification_policy": {
    }
}

Response samples

Content type
application/json
{
  • "stream_id": "b5d6fd45-fcca-453d-ac05-3e594054b813",
  • "url": "/2/streams/b5d6fd45-fcca-453d-ac05-3e594054b813"
}

get streams

Get streams according to filters. The results are sorted by stream creation order, the oldest streams shown first.

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=557d54ec-29ad-4f3c-93b4-c9092ef12515

Account id of stream owner.

stream_ids
Array of strings <uuid> (stream_id) [ items <uuid >^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... ]
Example: stream_ids=ae09126e-70a6-49c7-923f-df2320f08639,68b363eb-600a-4e72-afb3-8c4196e385ce

Stream ID filter. Only streams with the specified ids will be returned in the response.

stream_id__gte
string <uuid> (stream_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: stream_id__gte=ae09126e-70a6-49c7-923f-df2320f08639

Stream id lower included bound.

stream_id__lt
string <uuid> (stream_id) ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]...
Example: stream_id__lt=ae09126e-70a6-49c7-923f-df2320f08639

Stream id upper excluded bound.

names
Array of strings (stream_name) [ items <= 128 characters ]
Example: names=name1,name2

Stream name filter. Only streams with the specified names will be returned in the response.

reference
string (stream_reference) <= 2083 characters
Example: reference=https://upload.wikimedia.org/wikipedia/commons/2xQ2gprbMUePw1s9gw9fvA==

Stream reference filter. Only streams with the specified reference will be returned in the response.

statuses
Array of integers (stream_status)
Items Enum: 0 1 2 3 4 5 6 7 8
Example: statuses=1,2

Stream status filter - comma-separated list of status values. Only streams with the specified statuses will be returned in the response.

create_time__gte
string <date-time> (time)
Example: create_time__gte=2021-09-21T11:11:41.674Z

Entity create time lower including bound filter in RFC 3339 format. Only entities with the creation time greater than or equal to the specified boundary will be returned in the response.

create_time__lt
string <date-time> (time)
Example: create_time__lt=2021-09-21T19:11:41.674Z

Entity create time upper excluding bound filter in RFC 3339 format. Only entities with the creation time lower than the specified boundary will be returned in the response.

sources
string
Example: sources=cam1,cam2

Comma-separated list of sources. Each stream from result will contain one of the given sources.

event_source_groups
string
Example: event_source_groups=group-1,group-2

Comma-separated list of source groups. Each stream from result will contain one of the given event source groups.

order
string
Default: "desc"
Enum: "asc" "desc"

The sort order.

By default, the results will be sorted in order of stream appearance in the database (may not match stream create_time). If "desc" is set, the newest streams will be shown first. If "asc" is set, the oldest streams will be shown first.

But if some stream ID range filters specified (<entity>_id__gte or <entity>_id__lt), the results will be sorted by ID.

order_column
string
Enum: "create_time" "name"

The sort column.

WARNING: if some stream ID range filters specified (stream_id__gte or stream_id__lt), the results will be sorted by stream ID.

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

targets
string
Default: "stream_id,account_id,name,description,data,location,source,version,create_time,last_error,groups,status,splittable,analytics,notification_policy"
Example: targets=data,notification_policy

Comma-separated list of stream target fields. Available targets: stream_id, account_id, name, description, data, location, source, event_source_group, version, create_time, last_error, groups, status, splittable, analytics, notification_policy

WARNING: If enriched is set to 0, this parameter will be ignored.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

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

get stream

Get the stream by ID.

path Parameters
stream_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 stream (stream_id received in the "create stream" request).

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=557d54ec-29ad-4f3c-93b4-c9092ef12515

Account id of stream owner.

targets
string
Default: "stream_id,account_id,name,description,data,location,source,version,create_time,last_error,groups,status,splittable,analytics,notification_policy"
Example: targets=data,notification_policy

Comma-separated list of stream target fields. Available targets: stream_id, account_id, name, description, data, location, source, event_source_group, version, create_time, last_error, groups, status, splittable, analytics, notification_policy

WARNING: If enriched is set to 0, this parameter will be ignored.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "stream_id": "b668c4a5-2191-476e-a261-3b4f9ce2e25e",
  • "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "name": "stream",
  • "description": "some description",
  • "data": {
    },
  • "location": {
    },
  • "event_source_group": "string",
  • "source": "string",
  • "version": 1,
  • "create_time": "2018-08-11T09:11:41Z",
  • "last_error": null,
  • "status": 0,
  • "analytics": [
    ],
  • "notification_policy": {
    }
}

remove stream

Remove the stream by ID.

path Parameters
stream_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 stream (stream_id received in the "create stream" request).

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=557d54ec-29ad-4f3c-93b4-c9092ef12515

Account id of stream owner.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{}

patch stream

Stop/resume stream processing.

Due to peculiarities of patching implementation it is possible that stream patching can not be performed immediately and 0 patched count will be returned. In this case, repeat the request after a short time.

path Parameters
stream_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 stream (stream_id received in the "create stream" request).

query Parameters
action
required
string
Enum: "stop" "resume"

stop - stop stream processing, stream status will be switched to stop resume - resume stream processing, stream status will be switched to pending

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "patched_count": 1
}

streams logs

get streams logs

Get streams logs according to filters. The results are sorted by log creation order, the new streams logs shown first.

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=557d54ec-29ad-4f3c-93b4-c9092ef12515

Account id of stream owner.

stream_ids
Array of strings <uuid> (stream_id) [ items <uuid >^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]... ]
Example: stream_ids=ae09126e-70a6-49c7-923f-df2320f08639,68b363eb-600a-4e72-afb3-8c4196e385ce

Stream ID filter. Only streams with the specified ids will be returned in the response.

statuses
Array of integers (stream_status)
Items Enum: 0 1 2 3 4 5 6 7 8
Example: statuses=1,2

Stream status filter - comma-separated list of status values. Only streams with the specified statuses will be returned in the response.

targets
Array of strings
Default: "stream_id&targets=status&targets=error&targets=log_time&targets=last_processed_frame_time&targets=analytic_index"
Items Enum: "stream_id" "status" "error" "log_time" "last_processed_frame_time" "analytic_index"
Example: targets=status

List of comma-separated stream logs targets.

log_time__lt
string <date-time> (time)
Example: log_time__lt=2021-09-21T19:11:41.674Z

Stream log record time upper excluding bound filter in RFC 3339 format. Only stream logs with the record time lower than the specified boundary will be returned in the response.

log_time__gte
string <date-time> (time)
Example: log_time__gte=2021-09-21T11:11:41.674Z

Stream log record time lower including bound filter in RFC 3339 format. Only stream log with the record time greater than or equal to the specified boundary will be returned in the response.

page
integer >= 1
Default: 1

Page number.

page_size
integer [ 1 .. 1000 ]
Default: 10

Number of items on page.

analytic_indexes
string
Example: analytic_indexes=0,1

Comma-separated list of analytics indexes. Each index from result will contain one of the given indexes.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

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

delete stream logs

Delete streams logs older than specified date excluding last log entry.

Also you can run streams logs auto deletion by using LUNA_STREAMS_LOGS_CLEAR_INTERVAL setting. For more information see development documentation.

query Parameters
log_time__lt
string <date-time> (time)
Example: log_time__lt=2021-09-21T19:11:41.674Z

Stream log record time upper excluding bound filter in RFC 3339 format. Only stream logs with the record time lower than the specified boundary will be deleted.

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "deleted_count": 1000
}

ws

ws events handshake

Ws events handshake. The resource is designed to receive realtime events from analytics.

Attention!

Subscription to events occurs via WebSocket. Messages sent by ws you can view in callback section. Connection supports autoping.

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

Stream ID for events you need to subscribe to.

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

Account id of stream owner.

analytic_index
required
integer (analytic_index) >= 0

Analytics of interest index.

Responses

Request samples

import asyncio
import websockets

async def main():
    uri = "ws://127.0.0.1:5240/2/ws?stream_id=70c75b04-1ec8-4aa1-930c-ddad9e47b54b&analytic_index=0"  # Note filtering by gender!
    async with websockets.connect(uri) as websocket:
        while True:
            data = await websocket.recv()
            print(data)


asyncio.run(main())

Response samples

Content type
application/json
{
  • "stream_status": "in_progress",
  • "error": "decoding error",
  • "analytics_results": {
    }
}

agent info

get agent info

get agent info

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "agent_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
  • "analytics": [
    ],
  • "streams": {
    },
  • "groups": [
    ]
}

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-Type is text/html

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with 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 development manual

Get sphinx documentation - Development Manual. After the request you will be redirected to the page /docs/dev/index.html

header Parameters
Accept
string
Value: "application/json"

Preferred response content type

Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with 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 <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Accept
string
Enum: "application/json" "text/plain"

acceptable type of receiving data

Responses

Response samples

Content type
{
  • "INFLUX_MONITORING": {
    }
}

plugins

get list of plugins

Get list of service plugins

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

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

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 <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "execution_time": 0.123
}

version

get version

get service version

header Parameters
Luna-Request-Id
string <timestamp,uuid> ^[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 that correspond to particular requests, in system logs. If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.

Responses

Response samples

Content type
application/json
{
  • "Version": {
    }
}