Get alerts

GET/alerts

Base URL: https://api.tinkermode.com

Get a list of alerts that match the specified criteria.

Authentication

Send an Authorization header of the form ModeCloud <AUTH_CODE>.

The request must be made using the API key of a user with permission to read project alerts, or a project API key.

Query parameters

NameTypeRequiredConstraintsDescription
alertRuleIdstringNoReturn alerts of the specified alert rule.
beginInvocationTimestringNoReturn alerts bound by this invocation timestamp. Format must conform to RFC3339.
beginRecoveryTimestringNoReturn alerts bound by this recovery timestamp. Format must conform to RFC3339.
endInvocationTimestringNoReturn alerts bound by this invocation timestamp. Format must conform to RFC3339.
endRecoveryTimestringNoReturn alerts bound by this recovery timestamp. Format must conform to RFC3339.
entityIdstringNoReturn alerts of the specified entity. Accepts a comma-separated list of entity IDs.
includeDescendantsbooleanNoOnly meaningful together with the entityId filter. If true, an entity also matches alerts invoked by its descendants. Defaults to false.
limitintegerNodefault: 25; min: 1Maximum number of alerts to return.
projectIdintegerYesReturn alerts of the specified project.
severityintegerNoReturn alerts with the specified severity.
skipintegerNodefault: 0; min: 0Number of alerts to skip over.
stateintegerNoReturn alerts with the specified state.

Responses

200 Successful retrieval of alerts.

Content type: application/json

Represents an alert

An array of objects with the following shape:

PropertyTypeRequiredConstraintsDescription
alertRuleIdintegerNoThe unique identifier for the alert rule
conditionone of 4NoThe snapshot of condition that triggered the alert. The shape is discriminated by conditionType.

One of the following 4 shapes:

Variant 1

Evaluates an aggregated metric value against one or more severity-based thresholds.

PropertyTypeRequiredConstraintsDescription
aggregationstringYesone of: avg, min, max, sum, countThe aggregation function applied to the metric over duration.
conditionTypestringYesone of: metricsThresholdThe discriminator for the condition type. Must be metricsThreshold.
delaystringNoOptional. How long the evaluation is delayed after the job is dispatched (e.g. 1min). Capped at 10 days. Note (Alerting V2): this field is not used by evaluation scheduling; the server silently replaces invalid values with 0sec.
durationstringYesRequired. The time range over which data points are aggregated for evaluation (e.g. 1min, 10min, 1hour). Must be a positive, non-zero multiple of the job invocation interval. Capped at 10 days (V2: 1 day). Note (Alerting V2): the multiple-of-interval constraint does not apply; any positive, non-zero duration up to 1 day is accepted.
frequencystringNoOptional. How often the condition is evaluated (e.g. 1min, 10min, 1hour). Capped at 1 hour. Note (Alerting V2): this field is not used by evaluation scheduling; the server silently replaces invalid values with 1min and the actual cadence is controlled by the platform.
metricsConditionobjectYesThe metric on which the condition is evaluated.
Properties of metricsCondition
PropertyTypeRequiredConstraintsDescription
entityClassstringYesThe entity class that owns the metric.
entityTargetConditionobjectNoOptional. Constraint on which entities the condition applies to. When omitted, the condition applies to the entity that owns the alert rule.
Properties of entityTargetCondition
PropertyTypeRequiredConstraintsDescription
entityIdsarray<string>YesThe entity IDs to target (or exclude).
excludebooleanNoIf true, the listed entities are excluded instead of included.
targetBystringYesone of: parents, entitiesHow to target entities.
metricNamestringYesThe name of the metric inside the metrics definition.
metricsDefinitionIdstringYesThe identifier of the metrics definition.
thresholdsarray<one of 3>Yesmin items: 1Severity-based thresholds. The first matching threshold determines the severity. Duplicate severities are not allowed.
Properties of thresholds
PropertyTypeRequiredConstraintsDescription
operandsarray<number>YesOperand values for the operator. Single value for greaterThan/lessThan/etc., two values for between/outside (with operands[0] < operands[1]), list for in/notIn.
operatorstringYesone of: greaterThan, greaterThanOrEqualTo, lessThanOrEqualTo, lessThan, between, outside, in, notInThe comparison operator applied to the aggregated value and operands.
severityintegerYesone of: 1, 2, 3Alert severity. 1 - High, 2 - Moderate, 3 - Low.

One of the following 3 shapes:

Variant 1

PropertyTypeRequiredConstraintsDescription
operandsunknownNomin items: 1; max items: 1
operatorunknownNoone of: greaterThan, greaterThanOrEqualTo, lessThanOrEqualTo, lessThan

Variant 2

PropertyTypeRequiredConstraintsDescription
operandsunknownNomin items: 2; max items: 2
operatorunknownNoone of: between, outside

Variant 3

PropertyTypeRequiredConstraintsDescription
operandsunknownNomin items: 1; max items: 1000
operatorunknownNoone of: in, notIn

Variant 2

Fires an alert when a metric stops reporting data points for the configured duration.

PropertyTypeRequiredConstraintsDescription
conditionTypestringYesone of: metricsHeartbeatThe discriminator for the condition type. Must be metricsHeartbeat.
delaystringNoOptional. How long the evaluation is delayed after the job is dispatched. Must be a multiple of the job invocation interval. Capped at 10 days.
durationstringYesRequired. The window in which at least one data point is expected (e.g. 1min, 10min, 1hour). Must be a positive, non-zero multiple of the job invocation interval. Capped at 90 days.
frequencystringNoOptional. How often the condition is evaluated (e.g. 1min). Must be a multiple of the job invocation interval. Capped at 1 hour.
metricsConditionobjectYesThe metric whose heartbeat is monitored.
Properties of metricsCondition
PropertyTypeRequiredConstraintsDescription
entityClassstringYesThe entity class that owns the metric.
entityTargetConditionobjectNoOptional. Constraint on which entities the condition applies to. When omitted, the condition applies to the entity that owns the alert rule.
Properties of entityTargetCondition
PropertyTypeRequiredConstraintsDescription
entityIdsarray<string>Yes
excludebooleanNo
targetBystringYesone of: parents, entities
metricNamestringYesThe name of the metric inside the metrics definition.
metricsDefinitionIdstringYesThe identifier of the metrics definition.
severityintegerYesone of: 1, 2, 3The severity emitted when the heartbeat is missed. 1 - High, 2 - Moderate, 3 - Low.

Variant 3

Fires an alert when an entity stops reporting location data points for the configured duration.

PropertyTypeRequiredConstraintsDescription
conditionTypestringYesone of: locationHeartbeatThe discriminator for the condition type. Must be locationHeartbeat.
delaystringNoOptional. How long the evaluation is delayed after the job is dispatched. Must be a multiple of the job invocation interval. Capped at 10 minutes.
durationstringYesRequired. The window in which at least one location data point is expected (e.g. 1min, 10min, 1hour). Must be a positive, non-zero multiple of the job invocation interval. Capped at 10 minutes.
frequencystringNoOptional. How often the condition is evaluated (e.g. 1min). Must be a multiple of the job invocation interval. Capped at 10 minutes.
locationConditionobjectYesThe location data source on which the heartbeat is monitored.
Properties of locationCondition
PropertyTypeRequiredConstraintsDescription
entityClassstringYesThe entity class whose location is monitored.
entityTargetConditionobjectNoOptional. Constraint on which entities the condition applies to. When omitted, the condition applies to the entity that owns the alert rule.
Properties of entityTargetCondition
PropertyTypeRequiredConstraintsDescription
entityIdsarray<string>Yesmin items: 1; max items: 100
excludebooleanNo
targetBystringYesone of: parents, entities
severityintegerYesone of: 1, 2, 3The severity emitted when the heartbeat is missed. 1 - High, 2 - Moderate, 3 - Low.

Variant 4

Evaluates geofence-based metric conditions on tracked entities.

PropertyTypeRequiredConstraintsDescription
conditionTypestringYesone of: geofenceThe discriminator for the condition type. Must be geofence.
delaystringNoOptional. How long the evaluation is delayed after the job is dispatched. Must be a multiple of the job invocation interval. Capped at 10 minutes. Note (Alerting V2): this field is not used by evaluation scheduling; the server silently replaces invalid values with 0sec.
durationstringYesRequired. The time range over which the condition is evaluated (e.g. 1min). Must be a positive, non-zero multiple of the job invocation interval. Capped at 30 minutes.
geofenceAlertTypestringYesone of: inOnly, inAndOutWhether to alert only when entering the geofence, or for both enter and exit transitions.
geofenceEntityIdsarray<string>NoRequired when geofenceAlertType=inAndOut. The ordered list of geofence area entity IDs that define the zones. Validation requires at least one entry. The length of this list also determines the required dimensions of geofenceSeverityMatrix (rows and columns = len + 1, including the "outside" zone).
geofenceExcludingEntityClassesarray<string>NoOptional. Used only when geofenceAlertType=inOnly. Entity classes whose areas suppress evaluation when a tracked entity is inside them. Must not contain geofenceTargetEntities.entityClass or any entity class listed in geofenceInOnlyConditions.
geofenceExcludingEntityIdsarray<string>NoOptional. Geofence entity IDs to exclude from evaluation.
geofenceInOnlyConditionsarray<object>NoOptional in the schema, but required when geofenceAlertType=inOnly (validation will reject the rule otherwise). Per-entity-class conditions evaluated on geofence entry. entityClass must differ from geofenceTargetEntities.entityClass, severities must be unique across this array, and classes listed here must not appear in geofenceExcludingEntityClasses.
Properties of geofenceInOnlyConditions
PropertyTypeRequiredConstraintsDescription
entityClassstringYes
metricsConditionsarray<object>No
Properties of metricsConditions
PropertyTypeRequiredConstraintsDescription
metricNamestringYes
metricsDefinitionIdstringYes
thresholdone of 3Yes

Nested structure continues below this depth.

severityintegerYesone of: 1, 2, 3
geofenceSeverityMatrixarray<array>NoRequired when geofenceAlertType=inAndOut. A square severity matrix representing transitions between zones (including an implicit "outside" zone). Must have exactly (length of geofenceEntityIds) + 1 rows and the same number of columns. matrix[from][to] gives the severity (0 - None, 1 - High, 2 - Moderate, 3 - Low) for transitioning from zone from to zone to, where index 0 represents outside. Ignored when geofenceAlertType=inOnly.
geofenceTargetEntitiesobjectYesSpecifies the entities whose locations are tracked and evaluated against the geofences.
Properties of geofenceTargetEntities
PropertyTypeRequiredConstraintsDescription
entityClassstringYesThe entity class of the geofence entities.
entityIdsarray<string>NoOptional. Specific entity IDs to evaluate. Each ID must be a descendant of the alert rule's owning entity. When omitted, all entities of entityClass under parentEntityId are evaluated; if parentEntityId is also omitted, all entities of entityClass under the alert rule's owning entity are evaluated.
parentEntityIdstringNoOptional. Restricts geofence target entity resolution to descendants of this entity. Must be a descendant of the alert rule's owning entity. When omitted, target entities are resolved under the alert rule's owning entity.
metricsConditionOperatorstringNoone of: and, orOptional. Logical operator combining metricsConditions. Required when metricsConditions is non-empty. Ignored when metricsConditions is empty or absent.
metricsConditionsarray<object>NoOptional. Per-metric threshold conditions evaluated against tracked entities. When present, metricsConditionOperator must also be set.
Properties of metricsConditions
PropertyTypeRequiredConstraintsDescription
entityClassstringNoOptional. The entity class to evaluate the metric against. When omitted, defaults to geofenceTargetEntities.entityClass.
entityIdstringNoOptional. Scopes the metric evaluation to a specific entity. The entity must be a descendant of the alert rule's owning entity. When omitted, the metric is evaluated against any matching entity of entityClass.
metricNamestringYesThe name of the metric inside the metrics definition.
metricsDefinitionIdstringYesThe identifier of the metrics definition.
thresholdone of 3YesThe threshold the metric value is compared against.
Properties of threshold
PropertyTypeRequiredConstraintsDescription
operandsarray<number>YesOperand values for the operator. Single value for greaterThan/lessThan/etc., two values for between/outside (with operands[0] < operands[1]), list for in/notIn.
operatorstringYesone of: greaterThan, greaterThanOrEqualTo, lessThanOrEqualTo, lessThan, between, outside, in, notIn

One of the following 3 shapes:

Variant 1

PropertyTypeRequiredConstraintsDescription
operandsunknownNomin items: 1; max items: 1
operatorunknownNoone of: greaterThan, greaterThanOrEqualTo, lessThanOrEqualTo, lessThan

Variant 2

PropertyTypeRequiredConstraintsDescription
operandsunknownNomin items: 2; max items: 2
operatorunknownNoone of: between, outside

Variant 3

PropertyTypeRequiredConstraintsDescription
operandsunknownNomin items: 1; max items: 1000
operatorunknownNoone of: in, notIn
whenLocationIsMissingstringNoone of: skipEvaluation, setFromAsOutsideOnly, setBothAsOutsideOptional. How to treat tracked entities with no recent location data. Defaults to skipEvaluation when omitted.
descriptionstringNoThe description of the alert
entityIDstringNoThe unique identifier for the entity the alert rule belongs to
entityTuplearray<string>NoFor a composite metrics-threshold alert only: the entity ID filling each condition slot, ordered by condition index, so tuples can be told apart. Absent for non-composite alerts.
entityTypestringNoThe class of the entity
homeIdintegerNoThe unique identifier for the home the alert rule belongs to
idstringNoThe unique identifier for the alert
invocationTimestringNoThe time the alert was triggered
metricNamestringNoThe name of the metric in which the alert is invoked
metricsDefinitionIDstringNoThe identifier of the group that the metric in which the alert is invoked belongs to
projectIdintegerNoThe unique identifier for the project the alert rule belongs to
recoveryTimestringNoThe time the alert was recovered
severityintegerNoThe severity of the alert. 1 - High, 2 - Moderate, 3 - Low
stateintegerNoThe state of the alert. 1 - Alerting, 2 - Recovered, 3 - Obsolete (an alert becomes obsolete when the alert rule is changed), 4 - Ineffective (an alert becomes ineffective when the alert rule is disabled)
videoFeedFilesarray<object>NoList of video feed files associated with the alert
Properties of videoFeedFiles
PropertyTypeRequiredConstraintsDescription
entityIdstringNoThe identifier of the corresponded entity
fileIdstringNoThe unique identifier of the file
videoFeedIdstringNoThe identifier the corresponded video feed

Response example

[
  {
    "alertRuleId": 5,
    "condition": {
      "aggregation": "avg",
      "conditionType": "metricsThreshold",
      "delay": "1min",
      "duration": "1min",
      "frequency": "1min",
      "targetMetrics": [
        {
          "entityClass": "robot1",
          "metricName": "speed",
          "metricsDefinitionId": "location"
        }
      ],
      "thresholds": [
        {
          "operands": [
            0.86
          ],
          "operator": "greaterThan",
          "severity": 1
        },
        {
          "operands": [
            0.85
          ],
          "operator": "greaterThan",
          "severity": 2
        },
        {
          "operands": [
            0.84
          ],
          "operator": "greaterThan",
          "severity": 3
        }
      ]
    },
    "description": "Robot exceeded a speed limit",
    "entityClass": "robot1",
    "entityId": "robot1-1",
    "homeId": 2,
    "id": "63ce9a3e9bc89f001b228c80",
    "invocationTime": "2023-01-23T14:31:26Z",
    "metricName": "speed",
    "metricsDefinitionId": "location",
    "projectId": 1,
    "severity": 1,
    "state": 1,
    "videoFeedFiles": [
      {
        "entityId": "entity_id_1",
        "fileId": "file_id_1",
        "videoFeedId": "68e5fcee233c99d23690f8c9"
      },
      {
        "entityId": "entity_id_2",
        "fileId": "file_id_2",
        "videoFeedId": "68ef3f24233c995d68fc6d89"
      }
    ]
  },
  {
    "alertRuleId": 5,
    "condition": {
      "aggregation": "avg",
      "conditionType": "metricsThreshold",
      "delay": "1min",
      "duration": "1min",
      "frequency": "1min",
      "metricsCondition": {
        "entityClass": "robot1",
        "metricName": "speed",
        "metricsDefinitionId": "location"
      },
      "targetMetrics": [
        {
          "entityClass": "robot1",
          "metricName": "speed",
          "metricsDefinitionId": "location"
        }
      ],
      "thresholds": [
        {
          "operands": [
            0.86
          ],
          "operator": "greaterThan",
          "severity": 1
        },
        {
          "operands": [
            0.85
          ],
          "operator": "greaterThan",
          "severity": 2
        },
        {
          "operands": [
            0.84
          ],
          "operator": "greaterThan",
          "severity": 3
        }
      ]
    },
    "description": "Robot exceeded a speed limit",
    "entityClass": "robot1-1",
    "entityId": "robot1",
    "homeId": 2,
    "id": "63ce9a3e9bc89f001b228c7f",
    "invocationTime": "2023-01-23T14:31:26Z",
    "metricName": "speed",
    "metricsDefinitionId": "metrics",
    "projectId": 1,
    "severity": 2,
    "state": 1
  }
]

401 Authorization is required to access this resource.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

403 Request failed because of denied permission.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

429 Request failed because of rate limit.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

500 An unexpected error has occurred.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

503 The service is temporarily unavailable.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.