> For the complete documentation index, see [llms.txt](https://navixy.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://navixy.com/docs/navixy-api/user-api/resources/tracking/tracker/rules/rule.md).

# Rule

Conditions that make the Navixy platform log an event and notify someone when a tracker meets them.

A rule is a condition attached to trackers. When a tracker meets it, the platform logs an event and can notify a user about it, which is how speeding, geofence entry, low fuel, or an offline device turn into something a person sees.

A rule exists once and is bound to as many trackers as needed, so `rule/create` defines the condition and `rule/bind` decides which trackers it applies to. For a walkthrough, see [how to create and use rules](/docs/navixy-api/user-api/guides/rules-notifications/use-rules.md).

## Rule object

## The Rule object

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"components":{"schemas":{"Rule":{"type":"object","description":"A rule: the conditions under which the platform logs an event and notifies someone.\n\n**Note the asymmetry on geofences.** Requests take `zone_ids`, an array; responses return `zone_id`, a single integer that is `0` when the rule is not bound to a geofence.","properties":{"id":{"type":"integer","description":"Rule ID."},"name":{"type":"string","description":"Rule name."},"type":{"type":"string","description":"One of the predefined rule types. The rule types page lists them and the extra parameters each takes."},"description":{"type":"string","description":"Free-text description."},"zone_id":{"type":"integer","description":"Geofence the rule is bound to, or `0` when it is bound to none. **Responses only**; send `zone_ids` when writing.","readOnly":true},"zone_ids":{"type":"array","description":"Geofences to bind the rule to. **Requests only**; responses return `zone_id` instead. Leave empty for a rule that works everywhere. Not allowed for the `offline` type, and required for `route` and `inoutzone`.","items":{"type":"integer"},"writeOnly":true},"trackers":{"type":"array","description":"Trackers the rule applies to.","items":{"type":"integer"}},"primary_text":{"type":"string","description":"Primary notification text."},"secondary_text":{"type":"string","description":"Secondary notification text."},"param":{"type":"integer","description":"A general-purpose integer parameter whose meaning follows `type`."},"alerts":{"type":"object","description":"Where notifications go.","properties":{"sms_phones":{"type":"array","description":"Phone numbers for SMS notifications.","items":{"type":"string"}},"phones":{"type":"array","description":"Phone numbers for voice calls.","items":{"type":"string"}},"emails":{"type":"array","description":"Email addresses for notifications.","items":{"type":"string"}},"push_enabled":{"type":"boolean","description":"Whether push notifications are sent."},"emergency":{"type":"boolean","description":"Whether notifications are marked as emergency, with distinct colour and sound."}}},"suspended":{"type":"boolean","description":"`true` while the rule is paused."},"auto_created":{"type":"boolean","description":"`true` when the platform created the rule itself. Present only on such rules."},"schedule":{"type":"array","description":"Windows during which the rule is active. Omit for a rule that is always active.","items":{"$ref":"#/components/schemas/RuleScheduleInterval"}},"extended_params":{"type":"object","description":"Parameters specific to this rule `type`. The rule types page documents them per type.","additionalProperties":true}}},"RuleScheduleInterval":{"type":"object","description":"One window during which a rule is active. A `weekly` interval repeats every week and uses weekday and time; a `fixed` interval runs once between two timestamps.","properties":{"type":{"type":"string","description":"Which kind of interval this is.","enum":["weekly","fixed"]},"from":{"description":"Start of the window. For `weekly`, an object with `weekday` (1 to 7) and `time`; for `fixed`, a timestamp string."},"to":{"description":"End of the window, in the same shape as `from`."},"interval_id":{"type":"integer","description":"Interval ID, assigned by the server."}}}}}}
```

## The RuleScheduleInterval object

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"components":{"schemas":{"RuleScheduleInterval":{"type":"object","description":"One window during which a rule is active. A `weekly` interval repeats every week and uses weekday and time; a `fixed` interval runs once between two timestamps.","properties":{"type":{"type":"string","description":"Which kind of interval this is.","enum":["weekly","fixed"]},"from":{"description":"Start of the window. For `weekly`, an object with `weekday` (1 to 7) and `time`; for `fixed`, a timestamp string."},"to":{"description":"End of the window, in the same shape as `from`."},"interval_id":{"type":"integer","description":"Interval ID, assigned by the server."}}}}}}
```

`type`, `param`, and `extended_params` all depend on which rule is being created. [Rule types](/docs/navixy-api/user-api/resources/tracking/tracker/rules/rule_types.md) documents them per type, along with the meaning of `primary_text` and `secondary_text`. Date, time, and `local_time` values follow the [data types](/docs/navixy-api/general/api-conventions.md#data-types).

{% hint style="warning" %}
`create` and `update` take the rule **wrapped in a `rule` object**, not as top-level fields. An earlier version of this page listed the fields flat, which the API rejects with error 7.
{% endhint %}

## API actions

API base path: `/tracker/rule`.

Operations that list no errors of their own return only the [general error codes](/docs/navixy-api/general/errors.md#error-codes).

***

*Required sub-user rights:* `tracker_rule_update`.

## Bind a rule to trackers

> Apply an existing rule to more trackers.\
> \
> Trackers that do not exist, belong to someone else, or are deleted are \*\*skipped silently\*\* rather than failing the call, so a success does not mean every ID in the list was bound.\
> \
> Requires the \`tracker\_rule\_update\` right.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Trackers","description":"Trackers, the devices the platform tracks, together with the geo links that share their live location with people outside the account. Resources under the /tracker/ path."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"responses":{"OK":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true}}}}}},"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/tracker/rule/bind":{"post":{"tags":["Trackers"],"summary":"Bind a rule to trackers","description":"Apply an existing rule to more trackers.\n\nTrackers that do not exist, belong to someone else, or are deleted are **skipped silently** rather than failing the call, so a success does not mean every ID in the list was bound.\n\nRequires the `tracker_rule_update` right.","operationId":"trackerRuleBind","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rule_id":{"type":"integer","description":"ID of the rule."},"trackers":{"type":"array","description":"Trackers to bind. Unknown or inaccessible IDs are ignored without error.","items":{"type":"integer"}}},"required":["rule_id","trackers"]}}}},"responses":{"200":{"description":"The rule was bound","$ref":"#/components/responses/OK"},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"403":{"description":"Error 201: no rule with this ID, or it belongs to another user.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

These errors come in addition to the [general error codes](/docs/navixy-api/general/errors.md#error-codes):

* 201 - No rule with this ID, or it belongs to another user.

***

*Required sub-user rights:* `tracker_rule_update`.

## Create a rule

> Create a rule and its schedule intervals.\
> \
> \*\*The rule goes in a \`rule\` object\*\*, not as top-level fields. Sending them flat is rejected with error 7.\
> \
> Geofence binding differs by type: \`zone\_ids\` is not allowed for the \`offline\` type, and cannot be empty for \`route\` or \`inoutzone\`. The rule types page documents \`param\`, \`extended\_params\`, and the meaning of \`primary\_text\` and \`secondary\_text\` for each type.\
> \
> Requires the \`tracker\_rule\_update\` right.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Trackers","description":"Trackers, the devices the platform tracks, together with the geo links that share their live location with people outside the account. Resources under the /tracker/ path."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"schemas":{"Rule":{"type":"object","description":"A rule: the conditions under which the platform logs an event and notifies someone.\n\n**Note the asymmetry on geofences.** Requests take `zone_ids`, an array; responses return `zone_id`, a single integer that is `0` when the rule is not bound to a geofence.","properties":{"id":{"type":"integer","description":"Rule ID."},"name":{"type":"string","description":"Rule name."},"type":{"type":"string","description":"One of the predefined rule types. The rule types page lists them and the extra parameters each takes."},"description":{"type":"string","description":"Free-text description."},"zone_id":{"type":"integer","description":"Geofence the rule is bound to, or `0` when it is bound to none. **Responses only**; send `zone_ids` when writing.","readOnly":true},"zone_ids":{"type":"array","description":"Geofences to bind the rule to. **Requests only**; responses return `zone_id` instead. Leave empty for a rule that works everywhere. Not allowed for the `offline` type, and required for `route` and `inoutzone`.","items":{"type":"integer"},"writeOnly":true},"trackers":{"type":"array","description":"Trackers the rule applies to.","items":{"type":"integer"}},"primary_text":{"type":"string","description":"Primary notification text."},"secondary_text":{"type":"string","description":"Secondary notification text."},"param":{"type":"integer","description":"A general-purpose integer parameter whose meaning follows `type`."},"alerts":{"type":"object","description":"Where notifications go.","properties":{"sms_phones":{"type":"array","description":"Phone numbers for SMS notifications.","items":{"type":"string"}},"phones":{"type":"array","description":"Phone numbers for voice calls.","items":{"type":"string"}},"emails":{"type":"array","description":"Email addresses for notifications.","items":{"type":"string"}},"push_enabled":{"type":"boolean","description":"Whether push notifications are sent."},"emergency":{"type":"boolean","description":"Whether notifications are marked as emergency, with distinct colour and sound."}}},"suspended":{"type":"boolean","description":"`true` while the rule is paused."},"auto_created":{"type":"boolean","description":"`true` when the platform created the rule itself. Present only on such rules."},"schedule":{"type":"array","description":"Windows during which the rule is active. Omit for a rule that is always active.","items":{"$ref":"#/components/schemas/RuleScheduleInterval"}},"extended_params":{"type":"object","description":"Parameters specific to this rule `type`. The rule types page documents them per type.","additionalProperties":true}}},"RuleScheduleInterval":{"type":"object","description":"One window during which a rule is active. A `weekly` interval repeats every week and uses weekday and time; a `fixed` interval runs once between two timestamps.","properties":{"type":{"type":"string","description":"Which kind of interval this is.","enum":["weekly","fixed"]},"from":{"description":"Start of the window. For `weekly`, an object with `weekday` (1 to 7) and `time`; for `fixed`, a timestamp string."},"to":{"description":"End of the window, in the same shape as `from`."},"interval_id":{"type":"integer","description":"Interval ID, assigned by the server."}}}},"responses":{"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/tracker/rule/create":{"post":{"tags":["Trackers"],"summary":"Create a rule","description":"Create a rule and its schedule intervals.\n\n**The rule goes in a `rule` object**, not as top-level fields. Sending them flat is rejected with error 7.\n\nGeofence binding differs by type: `zone_ids` is not allowed for the `offline` type, and cannot be empty for `route` or `inoutzone`. The rule types page documents `param`, `extended_params`, and the meaning of `primary_text` and `secondary_text` for each type.\n\nRequires the `tracker_rule_update` right.","operationId":"trackerRuleCreate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rule":{"allOf":[{"$ref":"#/components/schemas/Rule"}],"description":"The rule to create, without `id`. Send geofences as `zone_ids`, an array."}},"required":["rule"]}}}},"responses":{"200":{"description":"The created rule","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true},"id":{"type":"integer","description":"ID of the new rule."}}}}}},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"403":{"description":"Error 204: an associated geofence does not exist.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

These errors come in addition to the [general error codes](/docs/navixy-api/general/errors.md#error-codes):

* 204 - An associated geofence does not exist.

***

*Required sub-user rights:* `tracker_rule_update`.

## Delete a rule

> Delete a rule and everything related to it, including its schedule intervals.\
> \
> Requires the \`tracker\_rule\_update\` right.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Trackers","description":"Trackers, the devices the platform tracks, together with the geo links that share their live location with people outside the account. Resources under the /tracker/ path."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"responses":{"OK":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true}}}}}},"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/tracker/rule/delete":{"post":{"tags":["Trackers"],"summary":"Delete a rule","description":"Delete a rule and everything related to it, including its schedule intervals.\n\nRequires the `tracker_rule_update` right.","operationId":"trackerRuleDelete","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rule_id":{"type":"integer","description":"ID of the rule."}},"required":["rule_id"]}}}},"responses":{"200":{"description":"The rule was deleted","$ref":"#/components/responses/OK"},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"403":{"description":"Error 201: no rule with this ID, or it belongs to another user.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

These errors come in addition to the [general error codes](/docs/navixy-api/general/errors.md#error-codes):

* 201 - No rule with this ID, or it belongs to another user.

***

## List rules

> Get the rules bound to one tracker, or every rule on the account when \`tracker\_id\` is omitted. Available to demo accounts.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Trackers","description":"Trackers, the devices the platform tracks, together with the geo links that share their live location with people outside the account. Resources under the /tracker/ path."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"schemas":{"Rule":{"type":"object","description":"A rule: the conditions under which the platform logs an event and notifies someone.\n\n**Note the asymmetry on geofences.** Requests take `zone_ids`, an array; responses return `zone_id`, a single integer that is `0` when the rule is not bound to a geofence.","properties":{"id":{"type":"integer","description":"Rule ID."},"name":{"type":"string","description":"Rule name."},"type":{"type":"string","description":"One of the predefined rule types. The rule types page lists them and the extra parameters each takes."},"description":{"type":"string","description":"Free-text description."},"zone_id":{"type":"integer","description":"Geofence the rule is bound to, or `0` when it is bound to none. **Responses only**; send `zone_ids` when writing.","readOnly":true},"zone_ids":{"type":"array","description":"Geofences to bind the rule to. **Requests only**; responses return `zone_id` instead. Leave empty for a rule that works everywhere. Not allowed for the `offline` type, and required for `route` and `inoutzone`.","items":{"type":"integer"},"writeOnly":true},"trackers":{"type":"array","description":"Trackers the rule applies to.","items":{"type":"integer"}},"primary_text":{"type":"string","description":"Primary notification text."},"secondary_text":{"type":"string","description":"Secondary notification text."},"param":{"type":"integer","description":"A general-purpose integer parameter whose meaning follows `type`."},"alerts":{"type":"object","description":"Where notifications go.","properties":{"sms_phones":{"type":"array","description":"Phone numbers for SMS notifications.","items":{"type":"string"}},"phones":{"type":"array","description":"Phone numbers for voice calls.","items":{"type":"string"}},"emails":{"type":"array","description":"Email addresses for notifications.","items":{"type":"string"}},"push_enabled":{"type":"boolean","description":"Whether push notifications are sent."},"emergency":{"type":"boolean","description":"Whether notifications are marked as emergency, with distinct colour and sound."}}},"suspended":{"type":"boolean","description":"`true` while the rule is paused."},"auto_created":{"type":"boolean","description":"`true` when the platform created the rule itself. Present only on such rules."},"schedule":{"type":"array","description":"Windows during which the rule is active. Omit for a rule that is always active.","items":{"$ref":"#/components/schemas/RuleScheduleInterval"}},"extended_params":{"type":"object","description":"Parameters specific to this rule `type`. The rule types page documents them per type.","additionalProperties":true}}},"RuleScheduleInterval":{"type":"object","description":"One window during which a rule is active. A `weekly` interval repeats every week and uses weekday and time; a `fixed` interval runs once between two timestamps.","properties":{"type":{"type":"string","description":"Which kind of interval this is.","enum":["weekly","fixed"]},"from":{"description":"Start of the window. For `weekly`, an object with `weekday` (1 to 7) and `time`; for `fixed`, a timestamp string."},"to":{"description":"End of the window, in the same shape as `from`."},"interval_id":{"type":"integer","description":"Interval ID, assigned by the server."}}}},"responses":{"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/tracker/rule/list":{"post":{"tags":["Trackers"],"summary":"List rules","description":"Get the rules bound to one tracker, or every rule on the account when `tracker_id` is omitted. Available to demo accounts.","operationId":"trackerRuleList","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tracker_id":{"type":"integer","description":"Optional. Return only rules bound to this tracker. Omit for every rule on the account."}}}}}},"responses":{"200":{"description":"The rules","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true},"list":{"type":"array","items":{"$ref":"#/components/schemas/Rule"}}}}}}},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

***

*Required sub-user rights:* `tracker_rule_update`.

## Unbind a rule from trackers

> Stop applying a rule to the given trackers. As with binding, unknown or inaccessible IDs are ignored without error.\
> \
> Requires the \`tracker\_rule\_update\` right.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Trackers","description":"Trackers, the devices the platform tracks, together with the geo links that share their live location with people outside the account. Resources under the /tracker/ path."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"responses":{"OK":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true}}}}}},"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/tracker/rule/unbind":{"post":{"tags":["Trackers"],"summary":"Unbind a rule from trackers","description":"Stop applying a rule to the given trackers. As with binding, unknown or inaccessible IDs are ignored without error.\n\nRequires the `tracker_rule_update` right.","operationId":"trackerRuleUnbind","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rule_id":{"type":"integer","description":"ID of the rule."},"trackers":{"type":"array","description":"Trackers to unbind. Unknown or inaccessible IDs are ignored without error.","items":{"type":"integer"}}},"required":["rule_id","trackers"]}}}},"responses":{"200":{"description":"The rule was unbound","$ref":"#/components/responses/OK"},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"403":{"description":"Error 201: no rule with this ID, or it belongs to another user.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

These errors come in addition to the [general error codes](/docs/navixy-api/general/errors.md#error-codes):

* 201 - No rule with this ID, or it belongs to another user.

***

*Required sub-user rights:* `tracker_rule_update`.

## Update a rule

> Replace a rule and its schedule intervals.\
> \
> \*\*The rule goes in a \`rule\` object\*\* and must carry its \`id\`. As with creation, sending the fields flat is rejected.\
> \
> Requires the \`tracker\_rule\_update\` right.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Platform API","version":"1.0.0"},"tags":[{"name":"Trackers","description":"Trackers, the devices the platform tracks, together with the geo links that share their live location with people outside the account. Resources under the /tracker/ path."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Either a user session hash or an API key, with the \"NVX \" prefix, for example \"NVX 22eac1c27af4be7b9d04da2ce1af111b\". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.","name":"Authorization","in":"header"}},"schemas":{"Rule":{"type":"object","description":"A rule: the conditions under which the platform logs an event and notifies someone.\n\n**Note the asymmetry on geofences.** Requests take `zone_ids`, an array; responses return `zone_id`, a single integer that is `0` when the rule is not bound to a geofence.","properties":{"id":{"type":"integer","description":"Rule ID."},"name":{"type":"string","description":"Rule name."},"type":{"type":"string","description":"One of the predefined rule types. The rule types page lists them and the extra parameters each takes."},"description":{"type":"string","description":"Free-text description."},"zone_id":{"type":"integer","description":"Geofence the rule is bound to, or `0` when it is bound to none. **Responses only**; send `zone_ids` when writing.","readOnly":true},"zone_ids":{"type":"array","description":"Geofences to bind the rule to. **Requests only**; responses return `zone_id` instead. Leave empty for a rule that works everywhere. Not allowed for the `offline` type, and required for `route` and `inoutzone`.","items":{"type":"integer"},"writeOnly":true},"trackers":{"type":"array","description":"Trackers the rule applies to.","items":{"type":"integer"}},"primary_text":{"type":"string","description":"Primary notification text."},"secondary_text":{"type":"string","description":"Secondary notification text."},"param":{"type":"integer","description":"A general-purpose integer parameter whose meaning follows `type`."},"alerts":{"type":"object","description":"Where notifications go.","properties":{"sms_phones":{"type":"array","description":"Phone numbers for SMS notifications.","items":{"type":"string"}},"phones":{"type":"array","description":"Phone numbers for voice calls.","items":{"type":"string"}},"emails":{"type":"array","description":"Email addresses for notifications.","items":{"type":"string"}},"push_enabled":{"type":"boolean","description":"Whether push notifications are sent."},"emergency":{"type":"boolean","description":"Whether notifications are marked as emergency, with distinct colour and sound."}}},"suspended":{"type":"boolean","description":"`true` while the rule is paused."},"auto_created":{"type":"boolean","description":"`true` when the platform created the rule itself. Present only on such rules."},"schedule":{"type":"array","description":"Windows during which the rule is active. Omit for a rule that is always active.","items":{"$ref":"#/components/schemas/RuleScheduleInterval"}},"extended_params":{"type":"object","description":"Parameters specific to this rule `type`. The rule types page documents them per type.","additionalProperties":true}}},"RuleScheduleInterval":{"type":"object","description":"One window during which a rule is active. A `weekly` interval repeats every week and uses weekday and time; a `fixed` interval runs once between two timestamps.","properties":{"type":{"type":"string","description":"Which kind of interval this is.","enum":["weekly","fixed"]},"from":{"description":"Start of the window. For `weekly`, an object with `weekday` (1 to 7) and `time`; for `fixed`, a timestamp string."},"to":{"description":"End of the window, in the same shape as `from`."},"interval_id":{"type":"integer","description":"Interval ID, assigned by the server."}}}},"responses":{"OK":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true}}}}}},"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API, not an HTTP code."},"description":{"type":"string","description":"An error description."}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7. A parameter name here may be an internal field name rather than the documented parameter name.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/tracker/rule/update":{"post":{"tags":["Trackers"],"summary":"Update a rule","description":"Replace a rule and its schedule intervals.\n\n**The rule goes in a `rule` object** and must carry its `id`. As with creation, sending the fields flat is rejected.\n\nRequires the `tracker_rule_update` right.","operationId":"trackerRuleUpdate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rule":{"allOf":[{"$ref":"#/components/schemas/Rule"}],"description":"The full rule, including `id`. Send geofences as `zone_ids`, an array."}},"required":["rule"]}}}},"responses":{"200":{"description":"The rule was updated","$ref":"#/components/responses/OK"},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array naming each offending parameter.","$ref":"#/components/responses/ResponseError"},"403":{"description":"Error 201: no rule with this ID, or it belongs to another user. Error 204: a newly associated geofence does not exist.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

These errors come in addition to the [general error codes](/docs/navixy-api/general/errors.md#error-codes):

* 201 - No rule with this ID, or it belongs to another user.
* 204 - A newly associated geofence does not exist.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://navixy.com/docs/navixy-api/user-api/resources/tracking/tracker/rules/rule.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
