API Documentation

Irisity Alarm Filter Beta supports SMTP and HTTPS as the main ways of connecting to the system. Other custom integrations may be added at a later date.

SMTP and email setup

The SMTP server in the camera/NVR/... needs to be set to point to the Irisity Alarm Filter one. Authentication details are provided separately by Irisity.

An example can be found below:

  To: <see details below>@alarmfilter.irisity.io   From: <any-valid-email>   Username: <given by Irisity>   Password: <given by Irisity>   Email Server (SMTP): s.alarmfilter.irisity.io   Port: 587   Encryption: TLS

HTTPS setup

To send alarms via HTTPS, a valid URL and authentication need to be set up in camera/NVR/...

Authentication is done through an API-KEY which is provided separately by Irisity. The API-KEY can be provided through the HTTP header X-API-KEY or through a query parameter ‘apikey’ in the request. Notice that passing the API-KEY through the http-header is preferred as this does not expose the API-KEY, however, not all cameras/NVRs support this.

An example can be found below:

  URL: https://in.alarmfilter.irisity.io   Port: 443   API-KEY: <given by Irisity>   

Incoming email alarm parsing

Each alarm sent to the alarm filter must contain either a short video clip (preferred) or multiple image frames that jointly make up a video sequence from a surveillance camera. This video or image sequence will be called video, video clip, and clip, interchangeably.

The video or separate images should be at least three frames long, preferably 6-10 frames. At least three images/frames are required for the filter to detect motion in the video.

Based on the video clip, each incoming alarm video will be classified as either a True alarm or a False alarm.

For SMTP, the video or images are sent as attachments to the email. For HTTPS, the video or images are sent through the body of the HTTP request.

True alarms

True alarms are alarms that contain human activity, meaning people or vehicles moving.

False alarms

False alarms are other alarms.

Filtering performance

You can expect the Irisity Alarm Filter to filter out more than 95% of all incoming False alarms while removing very few True alarms.

APIs

The incoming email service will parse incoming emails using one of multiple API providers. If no specific API is specific, the Generic provider will be used.

Currently, these providers exist for SMTP:

  • Generic
  • Hikvision-1

The following providers exist for HTTPS:

  • Generic

The details of each API will be detailed in the following sections.

Camera incoming ID

The main goal of the parsing is to tie each incoming alarm to a unique incoming ID. Each camera needs to have a unique incoming ID. Depending on the API used and the parameters sent, this unique name will be either assigned (most common) or explicitly set. The incoming id will always be calculated for each incoming alarm, and we recommend where possible to set it explicitly. Examples of setting the incoming camera id explicitly:

Parsing - it starts with the recipient (to) address

The main method of parsing emails starts with the recipient (to) address of the email. This is because most surveillance cameras and network equipment have very limited support for user-definable data and parameters anywhere else. Depending on the API used special parsing may be done that uses other fields, such as the email body or attachments.

The main method of parsing HTTP requests is done by passing in query parameters in the HTTP query request.

In the documentation below square bracket [...] will be used to show template variables and user-definable input. [camera-incoming-id] means that the unique ID of that camera is expected, an example provided by a user could be camera-841748. Note that the square brackets should be omitted when transforming the templates to the real world.

Specific API parameters are given in the [key]=[value] format. Keys are always transformed to lowercase, meaning casing typically does not matter.

Note for IMMIX users

The simplest way to set up cameras for easy integration with IMMIX is to make the incoming camera ID match IMMIX's IDs. IMMIX supports three different identifiers:

  • Server ID ("S number", originating device identifier) - S1234 Typically used to correlate a group of cameras to a Site in IMMIX
  • Alarm Input ID ("A number", alarm input number) - A123 Typically used to specify alarm details, alarm type, etc.

The most typical example would be to specify S-number and A-number.

Some examples using the SMTP API:

  • TO: [email protected] or equivalently [email protected] or: [email protected] Would send 1234 as the S number and 12 as the A number to Immix. In the Alarm Filter system, the incoming camera idparameter would be S1234-A12 and the camera name would be S1234 A12.
  • TO: [email protected] Would send 1234 as the S number. The camera would be named S1234
  • TO: S1234-A12&[email protected] Would send 1234 as the S number and 12 as the A number to Immix. In the Alarm Filter system, the incoming camera idparameter would be S1234-A12 and the camera would be placed in a folder called My site 1
  • TO: folder=My-site-1&camera=Camera-1-North-gate&[email protected] or shortened f=My-site-1&c=Camera-1-North-gate&[email protected]
    • All parameters are specified explicitly by name.
    • Would send 1234 as the S number and 12 as the A number to Immix.
    • In the Alarm Filter system, the incoming camera idparameter would be S1234-A12
    • The camera would be in a folder called My site 1
    • The user-facing name of the camera would be Camera 1 North gate

Allowed length, characters, and query string parameters

Email addresses are limited in the characters they support. Our parsing is based on a subset of URL query strings. Supported characters are:

  • Letters (A–Z and a–z), numbers (0–9), and the character - (hyphen).
    • When - (hyphen) is used it will be transformed to (space) when generating user-facing names.
  • While special character encoding is technically supported, we do not recommend using it. Character encoding is done using the %HH hexadecimal representation of that character.

Formally, email addresses are bound by the RFC5322 standard (Wikipedia), which supports query strings. However, many devices have additional constraints, see below.

Restrictions for SMTP:

Max length 64+63 characters (or just 64 in total)

The RFC standard specifies

  • Max 64 characters for the User part of an email (before the @)
  • Max 63 characters for the Domain part of an email (after the @)

where an email address is [User]@[Domain]. There are, however, devices that set the total limit to 64 characters.

Lacking support in many cameras and NVRs!

Due to lacking support in many cameras and other network equipment, we provide a fallback:

  • & can be replaced by . in all examples below (ampersand replaced by a dot).
  • = can be replaced by _ in all examples below (equals replaced by underscore).

This means that the following two email recipient addresses are equivalent and will be parsed the same way:

folder=folder-1&[email protected]

Shortening the email address

The length limit can sometimes be a problem. We therefore support shorthands:

  • Each parameter listed below has a shorthand:
    • api= can be replaced with a=
    • camera= can be replaced with c=
    • folder= can be replaced with f=
    • nvr= can be replaced with n=

Recipient field format

The recipient field takes one of two main formats

  • [incoming-camera-id]@alarmfilter.irisity.io This method is used when the unique incoming ID is known
  • [param1]=[value1]&[param2]=[value2]&[param3]=[value3][email protected]

Selecting the right API

To select the right api, the api=[the-selected-api] parameter is used. The shorthand for api= is a=.

Four examples are given below

  • SMTP: [email protected] HTTPS: https://in.alarmfilter.irisity.io?camera=camera-841748 No api parameter is given, meaning the Generic API is selected
  • SMTP:api=hikvision-1&[other-parameters]@alarmfilter.irisity.io The hikvision-1 api is selected
  • SMTP:a=hikvision-1&[other-parameters]@af.irisity.io An equivalent shorthand version of the above
  • api=unknown-api In cases where the selected API is unknown, the email will be disregarded and the error logged.

Generic API

Emails are parsed using the generic API unless another is explicitly specified. This API gets all information from the email recipient (to) address or the query parameters to the HTTPS request.

The parameters that can be specified are:

  • [incoming-camera-id], see above
  • folder=[deep_-_folder_-_path] to set a folder/site prefix.
    • _-_ (underscore-dash-underscore) will be converted to /, meaning subfolder
  • camera=[camera-name] to set the camera name

When the camera name is specified it is recommended to also specify a site-unique folder to avoid two cameras getting the same incoming camera id.

Either incoming-camera-id or camera needs to be specified.

Generic API examples

  • Example 1 - Incoming ID

Will directly correlate the incoming alarm to the camera with the unique incoming camera id camera-841748

  • Example 2 - Folders
    • SMTP:folder=Site-ABC&[email protected]
    • HTTPS: https://in.alarmfilter.irisity.io?folder=Site-ABC&camera=Camera-123

Uses the recommended folder + camera name structure to generate a unique incoming camera id.

The incoming camera id name will be site-abc_-_camera-123

The camera, when created in the system, will be called Camera 123 and placed in the folder Site ABC

  • Example 3 - Folder levels
    • SMTP:folder=US-EAST_-_Connies-Construction&[email protected]
    • HTTPS: https://in.alarmfilter.irisity.io?folder=US-EAST_-_Connies-Construction&camera=Camera-12

Uses the recommended folder + camera name structure to generate a unique incoming camera id.

_-_ is used to separate two folder levels

The incoming camera id will be us-east_-_connies-construcion_-_camera-12

The camera, when created in the system, will be called Camera 12 and placed in the folder tree US EAST / Connies Construction

  • Example 4 - Shorthands and replacement characters
    • HTTPS: https://in.alarmfilter.irisity.io?f=US-EAST_-_Connies-Construction&c=Camera-12

Equivalent to Example 3, but with shorthands and replacement characters to support more equipment and to get below 64 characters in length.

  • Example 5 - Not recommended

The above example will generate the unique incoming ID using only the camera name, meaning that when another Camera-14 is added to the system, the results will be unpredictable.

Hikvision-1

The hikvision-1 has been created to deal with the fact that many Hikvision NVRs and DVRs are unable to specify different Recipient (to) email addresses for different connected cameras. It uses the parameters specified by the user, as well as convention-based metadata set by Hikvision in alarm clip file names and the email body to generate a unique incoming camera id.

The supported parameters are

  • api=hikvision-1, required to select the api
  • folder=[deep__folder__path] to set a folder/site prefix.
    • _-_ (underscore-dash-underscore) will be converted to /, meaning subfolder
  • nvr=[nvr-name] to set the NVR/DVR name
    • When specified it is recommended to also specify a site-unique folder to avoid two cameras getting the same incoming camera id.

Examples

  • api=hikvision-1&folder=Site-ABC&[email protected]
    • uses the recommended folder + NVR name structure in combination with Hikvision-generated metadata to generate a unique incoming camera id.
    • the incoming camera id will be similar to site-abc_-_nvr-123_-_A12 for the case when channel 12 triggered the alarm
    • the camera when created in the system, will be named similarly to A12 and placed in the folder Site ABC
  • api=hikvision-1&folder=US-EAST__Connies-Construction&[email protected]
    • uses the recommended folder + NVR name structure in combination with Hikvision-generated metadata.
    • the incoming camera id will be similar to us_east__connies_construction__nvr_12__a03 for the case when channel 3 triggered the alarm
    • the camera, when created in the system, will be named similarly to A03 and placed in the folder tree US EAST / Connies Construction
    • uses alternates since Hikvision devices can be picky with regards to = and &
    • uses shorthands to get under a total length of 64, which is required by some Hikvision devices.
    • Used a shorter folder name, again to get under the 64 character limit (inner-most folder name will be C Construction instead of Connies Construction)
  • api=hikvision-1&nvr=NVR-14
    • Not recommended
    • Will generate the incoming ID using only the NVR name and Hikvision-generated metadata, meaning that when another NVR-14 is added to the system, the results will be unpredictable.