> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nx1cloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Simulate or evaluate a rule

> Simulate a rule to see how it reaches a result, or evaluate it to get a decision.

You simulate a rule to test it with sample input and see a trace of how it reached its result. Use a simulation before or
after you publish a rule to understand why it gave a result.

You evaluate a rule to run its published version on real values and get a decision. You can evaluate one set of values,
or many sets at once. You can evaluate a rule only through the API.

NexusOne records each simulation and evaluation in the [Business rules audit stream](https://docs.nx1cloud.com/documentation/govern/overview/audit.md#business-rules).

## Prerequisites

Before starting this task, ensure you have the following:

* Required roles:
  * [`simulator` in a workspace](https://docs.nx1cloud.com/documentation/data/overview/business-rules#roles-and-permissions)
    to simulate a stored version or to evaluate a rule
  * [`author` in a workspace](https://docs.nx1cloud.com/documentation/data/overview/business-rules#roles-and-permissions) to simulate unsaved content
* An existing [rule with a version](https://docs.nx1cloud.com/documentation/data/tasks/business-rules/versions/create-or-edit-a-draft-version.md)
* A [published version](https://docs.nx1cloud.com/documentation/data/tasks/business-rules/versions/publish-a-version.md) of the rule,
  if you want to evaluate it

## Steps

> [tab] Web portal
>
> Perform these steps to simulate a rule:
>
> 1. Log in to NexusOne.
> 2. On the top navigation bar, hover your mouse over **Data** and then select **Business Rules**.
> 3. Select a workspace.
> 4. Select a rule.
> 5. Click the **Simulate** tab.
> 6. Enter the input. Fill in the form fields, or click **Edit as JSON** to enter a JSON object.
> 7. Click **Simulate x**, where x is the latest version's number.
> 8. Review the result, the trace, and the badges for the run time and version.
>
> The **Simulate** tab runs the latest version.
>
> Perform these steps to simulate changes you haven't saved:
>
> 1. Click **Edit rules**.
> 2. Change the logic in the editor.
> 3. Click the **Simulate** tab.
> 4. Enter the input.
> 5. Click **Simulate unsaved rules**.

> [tab] REST API
>
> Use the following API endpoints to simulate or evaluate a rule:
>
> * [Evaluate a decision](https://docs.nx1cloud.com/api-reference/endpoints/decisions/evaluate-a-decision.md)
> * [Evaluate a decision against many contexts](https://docs.nx1cloud.com/api-reference/endpoints/decisions/evaluate-a-decision-against-many-contexts.md)
> * [Simulate a decision with a trace](https://docs.nx1cloud.com/api-reference/endpoints/decisions/simulate-a-decision-with-a-trace.md)
>
> To simulate a stored version, pass `version`. To simulate unsaved content, pass `content`.
> To evaluate a version other than the published version, pass `version`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.