> 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-graphql-api/products/rules-and-notifications/api-reference/history.md).

# Rule history

The history of each rule: one event every time a rule turns on or off for an asset, with the device, the message, and the values that met the equations. The `events` query lists the events. It belongs to the `rules` field of the `Query` type: `query { rules { events { ... } } }`.

## Queries

### events

Lists the transitions of the rules' alarms in the caller's workspace, about the assets the caller may read.

```graphql
events(
    filter: RulesRuleEventFilter
    first: Int
    after: String
    last: Int
    before: String
    orderBy: RulesRuleEventOrder = { field: EVENT_TIME, direction: DESC }
  ): RulesRuleEventConnection!
```

**Arguments**

| Name      | Type                   | Description                                                                                                     |
| --------- | ---------------------- | --------------------------------------------------------------------------------------------------------------- |
| `filter`  | `RulesRuleEventFilter` | Filtering options for the returned events.                                                                      |
| `first`   | `Int`                  | The first `n` elements from the [paginated list](https://navixy.com/docs/navixy-graphql-api/pagination.md).     |
| `after`   | `String`               | The elements that come after the specified [cursor](https://navixy.com/docs/navixy-graphql-api/pagination.md).  |
| `last`    | `Int`                  | The last `n` elements from the [paginated list](https://navixy.com/docs/navixy-graphql-api/pagination.md).      |
| `before`  | `String`               | The elements that come before the specified [cursor](https://navixy.com/docs/navixy-graphql-api/pagination.md). |
| `orderBy` | `RulesRuleEventOrder`  | The ordering options for the returned events.                                                                   |

**Input types:**

<details>

<summary>RulesRuleEventFilter</summary>

Filtering options for events. All criteria are ANDed; each list holds at most 100 ids, and an empty list matches nothing.

| Field          | Type                                                                                         | Description                    |
| -------------- | -------------------------------------------------------------------------------------------- | ------------------------------ |
| `ruleIds`      | `[ID!]`                                                                                      |                                |
| `assetIds`     | `[ID!]`                                                                                      |                                |
| `deviceIds`    | `[ID!]`                                                                                      |                                |
| `kinds`        | \[[RulesRuleEventKind](#rulesruleeventkind)!]                                                |                                |
| `occurredFrom` | [DateTime](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#datetime) | Events at or after this time.  |
| `occurredTo`   | [DateTime](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#datetime) | Events at or before this time. |

</details>

<details>

<summary>RulesRuleEventOrder</summary>

Ordering options for events.

| Field       | Type                                                                                                      | Description                     |
| ----------- | --------------------------------------------------------------------------------------------------------- | ------------------------------- |
| `field`     | [RulesRuleEventOrderField](#rulesruleeventorderfield)                                                     | The standard field to order by. |
| `direction` | [OrderDirection](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#orderdirection)! | The direction to order.         |

</details>

**Output types:**

<details>

<summary>RulesRuleEventConnection</summary>

A paginated list of RulesRuleEvent items.

**Implements:** [Connection](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#connection)

| Field      | Type                                                                                           | Description                                                |
| ---------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| `edges`    | \[[RulesRuleEventEdge](#rulesruleeventedge)!]!                                                 | A list of edges.                                           |
| `nodes`    | \[[RulesRuleEvent](#rulesruleevent)!]!                                                         | A list of nodes in the connection (without edge metadata). |
| `pageInfo` | [PageInfo](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#pageinfo)!  | Information about the current page.                        |
| `total`    | [CountInfo](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#countinfo) | The total count of items matching the filter.              |

</details>

***

## Objects

### RulesRuleEvent

One transition of a rule's alarm for an asset: the message that caused it and the values that satisfied the equations. An activation's id is the key the notification service deduplicates its notification on; the notification has an id of its own and does not carry this one.

**Implements:** [Node](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#node)

| Field               | Type                                                                                          | Description                                                                                                                                                                                                                     |
| ------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                | `ID!`                                                                                         | A globally unique identifier. This ID is opaque and should not be parsed by clients.                                                                                                                                            |
| `kind`              | [RulesRuleEventKind](#rulesruleeventkind)!                                                    |                                                                                                                                                                                                                                 |
| `ruleId`            | `ID!`                                                                                         |                                                                                                                                                                                                                                 |
| `assetId`           | `ID!`                                                                                         | The asset whose alarm changed.                                                                                                                                                                                                  |
| `deviceId`          | `ID!`                                                                                         | The device whose message caused the transition.                                                                                                                                                                                 |
| `messageId`         | [UUID](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#uuid)!         | The telemetry message's own id, as the platform's telemetry contract minted it.                                                                                                                                                 |
| `eventTime`         | [DateTime](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#datetime)! | When the message's event happened; a buffered upload delivers events hours or months old.                                                                                                                                       |
| `mayNotify`         | `Boolean!`                                                                                    | Whether the message's delivery allowed a notification: a live message does, a buffered one only within the module's notification window, a replay never. Only an activation notifies; a deactivation records the same decision. |
| `values`            | \[[RulesEvaluatedValue](#rulesevaluatedvalue)!]!                                              | The values the equations were satisfied with, one per satisfied parameter equation.                                                                                                                                             |
| `sourceEventId`     | `String`                                                                                      | The activation in the engine's own terms, carried by its notification as a reference. Absent on a deactivation.                                                                                                                 |
| `activationCounter` | [Long](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#long)          | How many times this rule's alarm has turned on for this asset, this activation included. Absent on a deactivation.                                                                                                              |

***

### RulesEvaluatedValue

A value an equation was satisfied with and where it came from: the device's own message or another device's.

| Field       | Type                                                                                                                         | Description                                                                       |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| `field`     | `String!`                                                                                                                    |                                                                                   |
| `index`     | `Int`                                                                                                                        | The channel, for a field that has one. Absent otherwise.                          |
| `value`     | [RulesValue](https://navixy.com/docs/navixy-graphql-api/products/rules-and-notifications/api-reference/rules.md#rulesvalue)! |                                                                                   |
| `unit`      | `String`                                                                                                                     | The unit as the device's decoder labelled it. Absent when the field carried none. |
| `deviceId`  | `ID!`                                                                                                                        | The device that reported the value.                                               |
| `eventTime` | [DateTime](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#datetime)!                                | When that device's message happened.                                              |

***

## Inputs

### RulesRuleEventFilter

Filtering options for events. All criteria are ANDed; each list holds at most 100 ids, and an empty list matches nothing.

| Field          | Type                                                                                         | Description                    |
| -------------- | -------------------------------------------------------------------------------------------- | ------------------------------ |
| `ruleIds`      | `[ID!]`                                                                                      |                                |
| `assetIds`     | `[ID!]`                                                                                      |                                |
| `deviceIds`    | `[ID!]`                                                                                      |                                |
| `kinds`        | \[[RulesRuleEventKind](#rulesruleeventkind)!]                                                |                                |
| `occurredFrom` | [DateTime](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#datetime) | Events at or after this time.  |
| `occurredTo`   | [DateTime](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#datetime) | Events at or before this time. |

***

### RulesRuleEventOrder

Ordering options for events.

| Field       | Type                                                                                                      | Description                     |
| ----------- | --------------------------------------------------------------------------------------------------------- | ------------------------------- |
| `field`     | [RulesRuleEventOrderField](#rulesruleeventorderfield)                                                     | The standard field to order by. |
| `direction` | [OrderDirection](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#orderdirection)! | The direction to order.         |

***

## Enums

### RulesRuleEventKind

The two transitions of an alarm.

**Values:** `ACTIVATION`, `DEACTIVATION`

***

### RulesRuleEventOrderField

Fields available for ordering events. Within one event time the id breaks the tie.

| Value        | Description                |
| ------------ | -------------------------- |
| `EVENT_TIME` | Order by the event's time. |

***

## Pagination types

### RulesRuleEventConnection

A paginated list of RulesRuleEvent items.

**Implements:** [Connection](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#connection)

| Field      | Type                                                                                           | Description                                                |
| ---------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| `edges`    | \[[RulesRuleEventEdge](#rulesruleeventedge)!]!                                                 | A list of edges.                                           |
| `nodes`    | \[[RulesRuleEvent](#rulesruleevent)!]!                                                         | A list of nodes in the connection (without edge metadata). |
| `pageInfo` | [PageInfo](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#pageinfo)!  | Information about the current page.                        |
| `total`    | [CountInfo](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#countinfo) | The total count of items matching the filter.              |

***

### RulesRuleEventEdge

An edge in the RulesRuleEvent connection.

**Implements:** [Edge](https://navixy.com/docs/navixy-graphql-api/core-api-reference/common.md#edge)

| Field    | Type                               | Description                       |
| -------- | ---------------------------------- | --------------------------------- |
| `cursor` | `String!`                          | An opaque cursor for this edge.   |
| `node`   | [RulesRuleEvent](#rulesruleevent)! | The event at the end of the edge. |

***

## See also

* [Pagination](https://navixy.com/docs/navixy-graphql-api/pagination.md)
* [Filtering and sorting](https://navixy.com/docs/navixy-graphql-api/filtering-and-sorting.md)
* [Error handling](https://navixy.com/docs/navixy-graphql-api/error-handling.md)
* [Optimistic locking](https://navixy.com/docs/navixy-graphql-api/optimistic-locking.md)
* [Limits](https://navixy.com/docs/navixy-graphql-api/limits.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://navixy.com/docs/navixy-graphql-api/products/rules-and-notifications/api-reference/history.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
