---
title: Get rules
slug: monitor/get-rules
docTags: 
createdAt: 2025-04-09T06:35:47.456Z
---

:::ApiMethodV2
```json
{
  "name": "Get the rules",
  "method": "GET",
  "url": "https://api-sandbox.klavi.ai/monitor/v1/monitors/{id}/rules",
  "description": "Get the rules set of a monitor",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "w7KCjxcNughjPCi1MGc2D",
        "language": "curl",
        "code": "curl --location --globoff 'https://api-sandbox.klavi.ai/monitor/v1/monitors/{id}/rules' \\\n--header 'Authorization: string'",
        "customLabel": ""
      },
      {
        "id": "3JyX2sf_mvisjLfy3lAlE",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n   'method': 'GET',\n   'url': 'https://api-sandbox.klavi.ai/monitor/v1/monitors/{id}/rules',\n   'headers': {\n      'Authorization': 'string'\n   }\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "6CGiuH1vZ8c1RWAyVfoc-",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Authorization\", \"string\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api-sandbox.klavi.ai/monitor/v1/monitors/{id}/rules\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "customLabel": ""
      },
      {
        "id": "dwBZeoyKuEdggy32AZoHW",
        "language": "python",
        "code": "import requests\n\nurl = \"https://api-sandbox.klavi.ai/monitor/v1/monitors/{id}/rules\"\n\npayload = {}\nheaders = {\n   'Authorization': 'string'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "customLabel": ""
      },
      {
        "id": "Obj7uWL6XVhdT59lvub71",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://api-sandbox.klavi.ai/monitor/v1/monitors/{id}/rules\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"Authorization\"] = \"string\"\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "w7KCjxcNughjPCi1MGc2D"
  },
  "results": {
    "languages": [
      {
        "id": "cLrvWV6uq6xduZ9cOd_ru",
        "language": "200",
        "customLabel": "",
        "code": "{\n    \"rule\":\n    {\n        \"relation\": \"and\",\n        \"children\":\n        [\n            {\n                \"field\": \"BALANCE_INCREASE\",\n                \"value\": 12,\n                \"operator\": \">=\"\n            },\n            {\n                \"field\": \"BALANCE_AMOUNT\",\n                \"value\": 12,\n                \"operator\": \">=\"\n            }\n        ]\n    },\n    \"createAt\": \"2025-03-20T19:03:59Z\",\n    \"updateAt\": \"2025-03-20T19:03:59Z\"\n\n}"
      }
    ],
    "selectedLanguageId": "cLrvWV6uq6xduZ9cOd_ru"
  },
  "request": {
    "pathParameters": [
      {
        "name": "id",
        "kind": "required",
        "type": "string",
        "description": "ID of the monitor",
        "": "ID of the monitor"
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "name": "Authorization",
        "kind": "required",
        "type": "string",
        "description": "Bearer access token, it returned by the /auth",
        "": "Bearer access token, it returned by the /auth"
      }
    ],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  },
  "hasTryItOut": false
}
```
:::

