---
title: "Updates a single rule"
method: PUT
path: "/rules/v4/{ruleId}"
tags: ["Rules"]
---

# Updates a single rule

`PUT /rules/v4/{ruleId}`

Updates the name, description and threshold of the rule `ruleId`. 
The rule type cannot be updated.
If some of the these properties are not provided in the request body, their values
will be set to null.

If the rule has been updated successfully, the response will contain the updated rule details.

## Request body

- union
  - object
    - `description` string — Rule description
    - `name` string — Rule name
    - `threshold` object, required — Utilization event is triggered when the asset starts moving indicating that the asset is utilized, and also when the asset stops moving and has been stationary for longer than the threshold duration indicating that the asset is unutilized.
      - `durationS` integer, required — Duration in seconds
    - `type` 'utilization', required — The rule type
  - object
    - `description` string — Rule description
    - `name` string — Rule name
    - `threshold` object, required — Detention event is triggered when the asset has been continuously stationary for longer than the threshold duration.
      - `durationS` integer, required — Duration in seconds
    - `type` 'detention', required — The rule type
  - object
    - `description` string — Rule description
    - `name` string — Rule name
    - `threshold` object, required — Dwelling event is triggered when the asset has been continuously inside a geofence for longer than the threshold duration.
      - `durationS` integer, required — Duration in seconds
    - `type` 'dwelling', required — The rule type
  - object
    - `description` string — Rule description
    - `geofenceId` string, uuid, required — Geofence ID
    - `name` string — Rule name
    - `threshold` object, required
      - `maxVolume` integer — A maximum volume of stock
      - `minVolume` integer — A minimum volume of stock
    - `type` 'stock', required — The rule type
  - object
    - `description` string — Rule description
    - `name` string — Rule name
    - `type` 'online', required — The rule type
  - object
    - `description` string — Rule description
    - `name` string — Rule name
    - `threshold` object, required
      - `after` integer — Allowed time deviation in seconds from the planned ETD/ETA in case the shipment is behind the schedule
      - `before` integer — Allowed time deviation in seconds from the planned ETD/ETA in case the shipment is ahead of schedule
    - `type` 'shipmentSchedule', required — The rule type

## Response `200`

Successful

The rule was updated.

- object
  - `rule` union, required
    - object
      - `description` string — Rule description
      - `name` string — Rule name
      - `threshold` object, required — Utilization event is triggered when the asset starts moving indicating that the asset is utilized, and also when the asset stops moving and has been stationary for longer than the threshold duration indicating that the asset is unutilized.
        - `durationS` integer, required — Duration in seconds
      - `type` 'utilization', required — The rule type
    - object
      - `description` string — Rule description
      - `name` string — Rule name
      - `threshold` object, required — Detention event is triggered when the asset has been continuously stationary for longer than the threshold duration.
        - `durationS` integer, required — Duration in seconds
      - `type` 'detention', required — The rule type
    - object
      - `description` string — Rule description
      - `name` string — Rule name
      - `threshold` object, required — Dwelling event is triggered when the asset has been continuously inside a geofence for longer than the threshold duration.
        - `durationS` integer, required — Duration in seconds
      - `type` 'dwelling', required — The rule type
    - object
      - `description` string — Rule description
      - `geofenceId` string, uuid, required — Geofence ID
      - `name` string — Rule name
      - `threshold` object, required
        - `maxVolume` integer — A maximum volume of stock
        - `minVolume` integer — A minimum volume of stock
      - `type` 'stock', required — The rule type
    - object
      - `description` string — Rule description
      - `name` string — Rule name
      - `type` 'online', required — The rule type
    - object
      - `description` string — Rule description
      - `name` string — Rule name
      - `threshold` object, required
        - `after` integer — Allowed time deviation in seconds from the planned ETD/ETA in case the shipment is behind the schedule
        - `before` integer — Allowed time deviation in seconds from the planned ETD/ETA in case the shipment is ahead of schedule
      - `type` 'shipmentSchedule', required — The rule type
  - `ruleId` string, uuid, required — Must be a valid UUIDv4.

## Other responses

- `400` — Bad request The request object is in an incorrect format or has values that are invalid or out of range. If available, further error details are provided in the response body.
- `401` — Unauthorized The request did not provide correct authentication details
- `403` — Forbidden The account does not have the correct privileges
- `404` — No rules with the provided ruleId were found

---

[API](https://skmtc.net/here/apis/tracking.md) · [All operations](https://skmtc.net/here/apis/tracking/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/here/tracking/revisions/efa162f7023c/schema)
