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

# Test Rule

Run a rule in test mode without publishing. Use this to validate configuration and inputs. The request body can include test parameters and an optional version (e.g. draft).

Use the API reference below to try the endpoint.

## Test rule

> Run a rule in test mode without publishing.

```json
{"openapi":"3.0.3","info":{"title":"Nected Rule API (Dev V1)","version":"1.0"},"tags":[{"name":"Rule","description":"List, create, read, update, test, schedule, and publish rules."}],"servers":[{"url":"https://api.nected.ai","description":"Production"}],"security":[{"DevAuth":[]}],"components":{"securitySchemes":{"DevAuth":{"type":"apiKey","in":"header","name":"Nected-API-Key","description":"Dev API key (`Nected-API-Key` header)"}},"schemas":{"TestEntityRequest":{"type":"object","description":"Request body for test endpoint","properties":{"checksum":{"type":"string"},"params":{"type":"object","additionalProperties":true,"description":"Input parameters for the test run"},"version":{"type":"string","description":"Version to test (e.g. draft)"}}},"Response":{"type":"object","description":"Standard API response wrapper","properties":{"code":{"type":"string"},"data":{"description":"Response payload: rule object, array of rules (list), version rows, or execution result — shape varies by endpoint"},"message":{"type":"string"},"pageNo":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"},"totalPages":{"type":"integer"},"paginationInfo":{"$ref":"#/components/schemas/PaginationInfo"}}},"PaginationInfo":{"type":"object","description":"Pagination metadata returned by GET /dev/v1/rule (list rules)","properties":{"perPage":{"type":"integer","description":"Page size (items per page)"},"totalPage":{"type":"integer","description":"Total number of pages"},"currentPage":{"type":"integer","description":"Current page index"},"totalRecord":{"type":"integer","description":"Total records across all pages"}}}}},"paths":{"/dev/v1/rule/{entity-id}/test":{"post":{"operationId":"testRule","tags":["Rule"],"summary":"Test rule","description":"Run a rule in test mode without publishing.","parameters":[{"name":"Nected-Branch","in":"header","required":false,"description":"Branch name (optional)","schema":{"type":"string"}},{"name":"entity-id","in":"path","required":true,"schema":{"type":"string"},"description":"The rule's entity ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEntityRequest"}}}},"responses":{"200":{"description":"OK (illustrative execution result; exact `data` shape may vary by rule type)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}}}}}}}
```

{% hint style="info" %}
Replace the example `checksum` values with the **current** value from **Get rule by id** for your entity.
{% endhint %}

### Where to get the Checksum?

The test endpoint requires the current **`checksum`** of the rule. If the checksum you send does not match the rule’s latest checksum on the server, the API returns a **checksum mismatch** error and the test **does not** run.

**Recommended flow**

1. Call **Get rule by id** (`GET /dev/v1/rule/{entity-id}`) for the rule you want to test.
2. From the response, copy **`data.checksum`** (the exact string returned by the API).
3. Paste that value into your **test** request body as **`checksum`**, together with **`params`** (and optional **`version`**, e.g. `"draft"`).

You can also use a checksum from a **recent** **Create rule** (`201`) or **Update rule** (`200`) response—**only if** no other change has been applied since (any save/update changes the checksum). When in doubt, **Get rule by id** again before testing.


---

# 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://docs.nected.ai/nected-docs/management-api/rules/test-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.
