Get alert rules

GET/projects/{projectId}/entities/{entityId}/alertRules

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

Get a list of alert rules of the entity.

Authentication

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

Must contain the key of a user or service account with permissions to read alert rules of the entity or a project API key.

Path parameters

NameTypeRequiredConstraintsDescription
projectIdintegerYesThe unique ID for a specified project.
entityIdstringYesEntity ID (unique within project)

Query parameters

NameTypeRequiredConstraintsDescription
conditionTypestringNoReturn alert rules of the specified condition type.
includeDescendantsbooleanNoIf true, the result also includes alert rules attached to the entity's descendants. Alert rules of descendants that the requesting user has no permission to view are excluded. Defaults to false.
limitintegerNodefault: 25; min: 1Maximum number of alert rules to return.
scheduleIdstringNoReturn alert rules with the specified schedule.
skipintegerNodefault: 0; min: 0Number of alert rules to skip over.

Responses

200 Successfully retrieved the alert rules.

Content type: application/json

Represents an alert rule

An array of objects with the following shape:

PropertyTypeRequiredConstraintsDescription
actionsarray<object>NoThe actions to take when the alert rule is triggered
Properties of actions
PropertyTypeRequiredConstraintsDescription
recipientsarray<one of 5>NoOptional. Recipients that will be notified when this action runs. Each recipient is discriminated by its recipientType. Maximum 10 recipients. Assistant recipients (slack, direct, msTeams) must belong to the same project and entity as the alert rule.

One of the following 5 shapes:

Variant 1

Sends the alert notification to an email address.

PropertyTypeRequiredConstraintsDescription
emailstringYesThe destination email address.
recipientTypestringYesone of: email

Variant 2

Emits an event of eventType into the project event stream.

PropertyTypeRequiredConstraintsDescription
eventTypestringYesThe event type to emit.
recipientTypestringYesone of: event

Variant 3

Sends the alert notification to a Slack channel via an assistant.

PropertyTypeRequiredConstraintsDescription
assistantIdintegerYesIdentifier of the Slack assistant.
channelIdstringYesSlack channel identifier.
recipientTypestringYesone of: slack
workspaceIdstringYesSlack workspace identifier.

Variant 4

Sends the alert notification to a Direct chat room via an assistant.

PropertyTypeRequiredConstraintsDescription
assistantIdintegerYesIdentifier of the Direct assistant.
domainIdstringYesDirect domain identifier.
recipientTypestringYesone of: direct
roomIdstringYesDirect room identifier.

Variant 5

Sends the alert notification to a Microsoft Teams channel via an assistant.

PropertyTypeRequiredConstraintsDescription
assistantIdintegerYesIdentifier of the Microsoft Teams assistant.
channelIdstringYesMicrosoft Teams channel identifier.
recipientTypestringYesone of: msTeams
teamIdstringYesMicrosoft Teams team identifier.
tenantIdstringYesMicrosoft Teams tenant identifier.
videoFeedsarray<object>NoOptional. Video feed snapshots to capture and attach to the alert notification when the rule fires. When omitted, no snapshots are captured. Whether/how a given recipient renders the attachment depends on that recipient's channel.
Properties of videoFeeds
PropertyTypeRequiredConstraintsDescription
entityIdstringYesEntity owning the video feed. Supports the {{triggeredEntityId}} template placeholder to refer to the entity that triggered the alert.
videoFeedIdstringNoOptional. Specific video feed identifier. When omitted, all video feeds of the entity are used.
conditionone of 5NoThe condition that triggers the alert rule. The shape is discriminated by conditionType.

One of the following 5 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

Evaluates several metric conditions together and alerts only when all of them breach at the same severity. Each condition watches its own entity and metric; which entity fills which condition is given explicitly by entityTuples, one tuple per monitored installation. Alerting V2 only, and event-driven only: there is no scheduled evaluation for this condition type, so it has no frequency or delay.

PropertyTypeRequiredConstraintsDescription
conditionTypestringYesone of: metricsThresholdCompositeThe discriminator for the condition type. Must be metricsThresholdComposite.
conditionsarray<object>Yesmin items: 2; max items: 10The AND-ed conditions. Order is significant: a condition's position is its identity, referenced by entityTuples[].entities and by the conditionN message template aliases, so reordering conditions changes the meaning of both. Every condition must define the same set of threshold severities, because the composite severity is the highest severity at which all conditions breach. Two conditions may share, or fully duplicate, the same entityClass + metricsDefinitionId + metricName; the entity binding comes from the tuple, not the condition.
Properties of conditions
PropertyTypeRequiredConstraintsDescription
aggregationstringYesone of: avg, min, max, sum, countThe aggregation function applied to this condition's metric over its duration.
durationstringYesRequired. The time range over which this condition's data points are aggregated (e.g. 1min, 10min). Must be positive and non-zero, capped at 1 day. Each condition has its own duration.
entityClassstringYesThe entity class that owns the metric. Every entity bound to this condition's slot must be of this class.
metricNamestringYesThe name of the metric inside the metrics definition.
metricsDefinitionIdstringYesThe identifier of the metrics definition.
thresholdsarray<one of 3>Yesmin items: 1Severity-based thresholds for this condition. Duplicate severities are not allowed, and the set of severities must be identical across every condition of the rule.
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
entityTuplesarray<object>Yesmin items: 1; max items: 100The explicit entity mappings, one per monitored installation. Each tuple says which real entity fills each condition slot. Tuples are never inferred from entity hierarchy or scope, because that mapping is business knowledge the platform cannot guess. Two tuples of one rule alert independently. Duplicate mappings are rejected.
Properties of entityTuples
PropertyTypeRequiredConstraintsDescription
entitiesarray<string>Yesmin items: 2; max items: 10The entity IDs filling each condition slot, positionally aligned with conditions: entities[i] is evaluated against conditions[i]. The length must equal the number of conditions, and each entity must be of its condition's entityClass and must be the alert rule's entity or one of its descendants. The same entity may appear in more than one slot.

Variant 3

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 4

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 5

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.
creationTimestringNoThe time the alert rule was created
descriptionstringNoThe description of the alert rule
disableAutoRecoverybooleanNoWhether alert based on this rule recover automatically
disableRecoveryAlertbooleanNoWhether a notification will be sent when an alert recovers
enabledbooleanNoWhether the alert rule is enabled
idintegerNoThe unique identifier for the alert rule
messageTemplateobjectNoTemplates used to render the notification title and message for the different alert state transitions. Template variables are referenced with {{name}} syntax. Supported variables: projectId, alertId, alertRuleId, alertRuleName, entityId, entityName, severity, invocationTime, invocationValue, currentValue.
Properties of messageTemplate
PropertyTypeRequiredConstraintsDescription
decreasedSeverityMessagestringNoOptional. Message body used when an alert's severity decreases. Max 2000 runes. When omitted, defaults to [{{alertRuleName}}] {{entityName}} severity decreased to {{severity}}.
decreasedSeverityTitlestringNoOptional. Title used when an alert's severity decreases. Max 200 runes. When omitted, defaults to [{{alertRuleName}}] {{entityName}} severity decreased.
increasedSeverityMessagestringNoOptional. Message body used when an alert's severity increases. Max 2000 runes. When omitted, defaults to [{{alertRuleName}}] {{entityName}} severity increased to {{severity}}.
increasedSeverityTitlestringNoOptional. Title used when an alert's severity increases. Max 200 runes. When omitted, defaults to [{{alertRuleName}}] {{entityName}} severity increased.
messagestringNoOptional. Message body used when an alert is initially fired. Max 2000 runes. When omitted, defaults to a link back to the alert detail page in the BizStack console.
recoveryMessagestringNoOptional. Message body used when an alert recovers. Max 2000 runes. When omitted, defaults to a link back to the alert detail page in the BizStack console.
recoveryTitlestringNoOptional. Title used when an alert recovers. Max 200 runes. When omitted, defaults to [{{alertRuleName}}] {{entityName}} is back to normal.
severityMessageOverridesarray<object>Nomax items: 3Optional. Per-severity overrides for title, message, recoveryTitle, and recoveryMessage. When an override entry exists for the current severity and the field is non-empty, it takes precedence over the corresponding top-level field. increasedSeverityTitle, increasedSeverityMessage, decreasedSeverityTitle, and decreasedSeverityMessage are NOT overridable per severity. Each severity value must appear at most once.
Properties of severityMessageOverrides
PropertyTypeRequiredConstraintsDescription
messagestringNoOptional. Message body override used when an alert fires at this severity. Max 2000 runes.
recoveryMessagestringNoOptional. Message body override used when an alert recovers from this severity. Max 2000 runes.
recoveryTitlestringNoOptional. Title override used when an alert recovers from this severity. Max 200 runes.
severityintegerYesone of: 1, 2, 3The alert severity level this override applies to. 1 = high, 2 = moderate, 3 = low. Must not be 0 (none).
titlestringNoOptional. Title override used when an alert fires at this severity. Max 200 runes.
titlestringYesTitle used when an alert is initially fired. Max 200 runes. Required.
namestringNoThe name of the alert rule
projectIdintegerNoThe unique identifier for the project the alert rule belongs to
reasonForDisablingunknownNoread-only (server-generated); one of: unknown, api, invalid_entity, invalid_metricThe reason why this alert rule was disabled. Will not be set when the alert rule is enabled
scheduleIdstringNoThe schedule ID for the alert rule
updateTimestringNoThe time the alert rule was last updated

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.