---
title: "Retrieve a rule"
method: GET
path: "/api/rules/{id}"
tags: ["Rules"]
---

# Retrieve a rule

`GET /api/rules/{id}`

## Path parameters

- `id` integer, required

## Response `200`

The requested rule.

- Rule — Rules allow you to automatically perform actions on tickets when specific events occur. Rules are executed in the order of their `priority` field, with the rules having the higher priority being executed first. For example, you can use rules to automatically tag your tickets, assign agents, apply macros, send messages and more.
  - `id` integer — ID of the rule.
  - `code` string — The logic of the rule (as JavaScript code).
  - `code_ast` object — The logic of the rule (as an ESTree [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) representation). Generated from the code if not specified.
  - `created_datetime` string, date-time — When the rule was created.
  - `deactivated_datetime` string, date-time, nullable — When the rule was deactivated.
  - `description` string, nullable — The description of the rule.
  - `event_types` 'ticket-created' | 'ticket-updated' | 'ticket-message-created' | 'ticket-assigned' | 'ticket-self-unsnoozed' | 'satisfaction-survey-responded' — A list of comma separated events that this rule will be executed on.
  - `name` string — The name of the rule.
  - `priority` integer — Order of execution of the rule. Rules with higher priorities are executed first.
  - `updated_datetime` string, date-time — When the rule was last updated.
  - `uri` string — URI of the rule

---

[API](https://skmtc.net/gorgias/apis/gorgias-rest-api.md) · [All operations](https://skmtc.net/gorgias/apis/gorgias-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gorgias/gorgias-rest-api/versions/36f2e31f4e81/schema)
