> 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/get-rule-by-id.md).

# Get rule by id

Retrieve a single rule by its entity ID. Optionally pass a `version` query parameter (e.g. a published version).

{% hint style="info" %}
Note: If the version is blank, then you'll retrieve the `Draft` version of the rule.
{% endhint %}

The API returns the standard wrapper: `code`, `message`, and `data`.

* **`data`** is the **full rule object.**

To inspect a specific published version, call this endpoint with the appropriate `version` query value; the `data` shape still follows the same rule-type rules above.

Use the API reference below to try the endpoint.

## Get rule by id

> Retrieve a single rule by its entity ID. Optionally request a specific version (e.g. published). \`data\` matches the create payload for that type plus \`id\` and \`checksum\`.

```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":{"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}":{"get":{"operationId":"getRuleById","tags":["Rule"],"summary":"Get rule by id","description":"Retrieve a single rule by its entity ID. Optionally request a specific version (e.g. published). `data` matches the create payload for that type plus `id` and `checksum`.","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"},{"name":"version","in":"query","schema":{"type":"string"},"description":"Specific version to fetch (e.g. published version)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}}}}}}}
```

### Example response – `type = simpleRule`

{% file src="/files/dfuD8UosHldicqBioj9d" %}

### Example response – `type = decisionTable`

{% file src="/files/VxRtqTmg7CgTGd3sypIz" %}

### Example response – `type = ruleSet`

{% file src="/files/cO6UwAYy3OxYqfNdviuN" %}
