Docs
Add Rule
POST /rule-sets/{ruleSetId}/rules
POST
/rule-sets/{ruleSetId}/rulesRequired Tokens
| Field | Type | Required | Description |
|---|---|---|---|
| Bearer | Authorization: Bearer <api-key> | Optional | Your API key. Pass it as the Bearer token on every request. |
| Event token | x-Event-Token | Optional | Run **Get Tokens** in the Authorization folder, or call `GET /Events/{eventId}/authorize` manually. |
Adds a rule. Resources governed by the set are re-evaluated.
Requires
EventSettings permission on the event.Event scoping: This endpoint does not include
{eventId} in the URL. The event is determined automatically from your x-Event-Token.Path Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| ruleSetId | Guid | Required | The rule set. |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Rule name. |
| description | string | Optional | Description. |
| priority | int | Required | Evaluation order. |
| conditionType | string | Required | `BlockDuration`, `TimeSinceClearance` or `TimeOfDayWindow`. |
| trackedBlockTypeId | Guid? | Optional | The block type the rule tracks. |
| isActive | bool | Optional | Defaults to `true` on create. |
| windowStart / windowEnd | time? | Optional | `HH:mm:ss`, for `TimeOfDayWindow`. When both are equal the window covers the whole day. |
| resultingStateId | Guid? | Optional | State applied inside the window. |
| daysOfWeek | string[] | Optional | `Sunday` to `Saturday`. |
| annualDates | string[] | Optional | `TimeOfDayWindow` only. Dates that repeat every year, either `MM-DD` (`07-04`) or the Nth or last weekday of a month, `MM-{ordinal}-{weekday}` (`05-Last-Monday`). Ordinal is `1`, `2`, `3`, `4` or `Last`. No duplicates. |
A TimeOfDayWindow rule is live on a day when the weekday is in daysOfWeek or the day matches an entry in annualDates. With neither set, it is live every day. With dates only, it is live on those dates alone. A date matches the actual calendar day, never a weekend observance.
Response
201 Created. No response body.
Error Codes
| HTTP Status | Description |
|---|---|
| 400 | Invalid arguments, including annualDates on a BlockDuration or TimeSinceClearance rule, a malformed date, or duplicates. |
| 404 | Rule set, block type or state not found. |