---
title: Create a new monitor
slug: monitor/create-a-new-monitor
docTags: 
createdAt: 2025-02-05T10:34:48.524Z
---

:::ApiMethodV2
```json
{
  "name": "Create a new monitor",
  "method": "POST",
  "url": "https://api-sandbox.klavi.ai/monitor/v1/monitors",
  "description": "Create a new monitor base information",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "RoENC6mUxt3o5qbWB0SId",
        "language": "curl",
        "code": "curl --location 'https://api-sandbox.klavi.ai/monitor/v1/monitors' \\\n--header 'Authorization: string' \\\n--data '{\"name\":\"String\",\"onlineStatus\":\"Number\",\"monitorWeekDay\":\"Array\",\"monitorTimes\":\"Number\",\"notificationEmails\":\"Array\",\"rules\":\"Object\",\"resultDeliveries\":\"Object\"}'",
        "customLabel": ""
      },
      {
        "id": "YlhUtOMCbyMAxbVtlxd8Y",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n   'method': 'POST',\n   'url': 'https://api-sandbox.klavi.ai/monitor/v1/monitors',\n   'headers': {\n      'Authorization': 'string'\n   },\n   body: '{\"name\":\"String\",\"onlineStatus\":\"Number\",\"monitorWeekDay\":\"Array\",\"monitorTimes\":\"Number\",\"notificationEmails\":\"Array\",\"rules\":\"Object\",\"resultDeliveries\":\"Object\"}'\n\n};\nrequest(options, function (error, response) {\n   if (error) throw new Error(error);\n   console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "m1JQQp5gR_cqf_DUZvZy4",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Authorization\", \"string\");\n\nvar raw = \"{\\\"name\\\":\\\"String\\\",\\\"onlineStatus\\\":\\\"Number\\\",\\\"monitorWeekDay\\\":\\\"Array\\\",\\\"monitorTimes\\\":\\\"Number\\\",\\\"notificationEmails\\\":\\\"Array\\\",\\\"rules\\\":\\\"Object\\\",\\\"resultDeliveries\\\":\\\"Object\\\"}\";\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api-sandbox.klavi.ai/monitor/v1/monitors\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));",
        "customLabel": ""
      },
      {
        "id": "F7Q7i1RQngjHqPgYaeKFg",
        "language": "python",
        "code": "import requests\n\nurl = \"https://api-sandbox.klavi.ai/monitor/v1/monitors\"\n\npayload = \"{\\\"name\\\":\\\"String\\\",\\\"onlineStatus\\\":\\\"Number\\\",\\\"monitorWeekDay\\\":\\\"Array\\\",\\\"monitorTimes\\\":\\\"Number\\\",\\\"notificationEmails\\\":\\\"Array\\\",\\\"rules\\\":\\\"Object\\\",\\\"resultDeliveries\\\":\\\"Object\\\"}\"\nheaders = {\n   'Authorization': 'string'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "customLabel": ""
      },
      {
        "id": "aDAcJLpBzD0AfDjS0utvf",
        "language": "ruby",
        "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://api-sandbox.klavi.ai/monitor/v1/monitors\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Authorization\"] = \"string\"\nrequest.body = \"{\\\"name\\\":\\\"String\\\",\\\"onlineStatus\\\":\\\"Number\\\",\\\"monitorWeekDay\\\":\\\"Array\\\",\\\"monitorTimes\\\":\\\"Number\\\",\\\"notificationEmails\\\":\\\"Array\\\",\\\"rules\\\":\\\"Object\\\",\\\"resultDeliveries\\\":\\\"Object\\\"}\"\n\nresponse = https.request(request)\nputs response.read_body\n",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "RoENC6mUxt3o5qbWB0SId"
  },
  "results": {
    "languages": [
      {
        "id": "ncVn27LV9TLSqZA48dPFA",
        "language": "200",
        "customLabel": "",
        "code": "{\n  \"id\": \"64a8c71f-71db-4972-82b1-1aadc5434dd8\"\n}"
      }
    ],
    "selectedLanguageId": "ncVn27LV9TLSqZA48dPFA"
  },
  "request": {
    "pathParameters": [],
    "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": [
      {
        "name": "name",
        "kind": "required",
        "type": "string",
        "description": "Name of the monitor",
        "": "Name of the monitor"
      },
      {
        "name": "onlineStatus",
        "kind": "required",
        "type": "boolean",
        "description": "Monitor status: true/false",
        "": "Monitor status: true/false"
      },
      {
        "name": "monitorWeekDays",
        "kind": "required",
        "type": "array",
        "description": "Monitoring dates within a week:  [\"MON\",\"TUE\",\"WED\",\"THU\",\"FRI\",\"SAT\",\"SUN\"]",
        "": "Monitoring dates within a week:  [\"MON\",\"TUE\",\"WED\",\"THU\",\"FRI\",\"SAT\",\"SUN\"]"
      },
      {
        "name": "monitorFrequency",
        "kind": "required",
        "type": "number",
        "description": "Daily monitoring frequency: [1, 2]\n",
        "": "Daily monitoring frequency: [1, 2]\n"
      },
      {
        "name": "notificationEmails",
        "kind": "optional",
        "type": "array",
        "description": "Mailing list for sending notifications, the mail must be created in advance in the Klavi Console",
        "": "Mailing list for sending notifications, the mail must be created in advance in the Klavi Console"
      },
      {
        "name": "rule",
        "kind": "required",
        "type": "object",
        "description": "Monitor rule",
        "": "Monitor rule",
        "children": [
          {
            "name": "relation",
            "kind": "optional",
            "type": "string",
            "description": "The elements in the list currently only support and"
          },
          {
            "name": "children",
            "kind": "optional",
            "type": "array",
            "description": "Field List"
          }
        ],
        "schema": [
          {
            "name": "relation",
            "kind": "optional",
            "type": "string",
            "description": "The elements in the list currently only support and"
          },
          {
            "name": "children",
            "kind": "optional",
            "type": "array",
            "description": "Field List"
          }
        ]
      },
      {
        "name": "resultDeliveries",
        "kind": "optional",
        "type": "object",
        "description": "Configure the method for receiving data.",
        "": "Configure the method for receiving data.",
        "children": [
          {
            "name": "event",
            "kind": "optional",
            "type": "object",
            "description": "Requires partner to provide webhook for event reception.",
            "children": [
              {
                "name": "webhook",
                "kind": "required",
                "type": "string",
                "description": "http address."
              },
              {
                "name": "headers",
                "kind": "optional",
                "type": "array",
                "description": "http request header."
              }
            ]
          },
          {
            "name": "sftp",
            "kind": "optional",
            "type": "string",
            "description": "Require partner to provide the FTP address for receiving data, format: sftp://username:password@hostname:port",
            "children": [
              {
                "name": "hostname",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "port",
                "kind": "required",
                "type": "number",
                "description": ""
              },
              {
                "name": "username",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "password",
                "kind": "required",
                "type": "string",
                "description": ""
              }
            ]
          }
        ],
        "schema": [
          {
            "name": "event",
            "kind": "optional",
            "type": "object",
            "description": "Requires partner to provide webhook for event reception.",
            "children": [
              {
                "name": "webhook",
                "kind": "required",
                "type": "string",
                "description": "http address."
              },
              {
                "name": "headers",
                "kind": "optional",
                "type": "array",
                "description": "http request header."
              }
            ]
          },
          {
            "name": "sftp",
            "kind": "optional",
            "type": "string",
            "description": "Require partner to provide the FTP address for receiving data, format: sftp://username:password@hostname:port",
            "children": [
              {
                "name": "hostname",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "port",
                "kind": "required",
                "type": "number",
                "description": ""
              },
              {
                "name": "username",
                "kind": "required",
                "type": "string",
                "description": ""
              },
              {
                "name": "password",
                "kind": "required",
                "type": "string",
                "description": ""
              }
            ]
          }
        ]
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Header Parameter",
    "value": "headerParameters"
  },
  "hasTryItOut": false,
  "response": [
    {
      "name": "id",
      "kind": "optional",
      "type": "string",
      "description": "ID of the monitor"
    },
    {
      "name": "presignedUrl",
      "kind": "optional",
      "type": "string",
      "description": "Used for uploading user list files",
      "children": []
    }
  ]
}
```
:::

# Parameter

## children

### field

Currently only supports monitoring balance related indicators, including: BALANCE\_AMOUNT and BALANCE\_INCREASE.&#x20;

### operator

Comparison operator, currently only supports >=,  !=.

### value

Amount, numeric type.



## rule

| field             | operator | value                                                                                                                       |
| ----------------- | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| BALANCE\_AMOUNT   | >=,  !=  | If operator is equal to >=, then value can only be a number. <br />If operator is equal to !=, then value can only be null. |
| BALANCE\_INCREASE | >=       | Only numbers.                                                                                                               |

:::ExpandableHeading{isOpen="true"}
# Body example



```json
{
    "onlineStatus": false,
    "name": "monitor-test",
    "monitorFrequency": 1,
    "monitorWeekDays":
    [
        "MON",
        "TUE",
        "WED",
        "THU",
        "FRI",
        "SAT",
        "SUN"
    ],
    "rule":
    {
        "relation": "and",
        "children":
        [
            {
                "field": "BALANCE_INCREASE",
                "value": 12.23,
                "operator": ">="
            },
            {
                "field": "BALANCE_AMOUNT",
                "value": 10,
                "operator": ">="
            }
        ]
    },
    "resultDeliveries":
    {
        "event":
        {
            "webhook": "https://client.webhook.com",
            "headers":
            [
                {
                    "key": "key",
                    "value": "value"
                }
            ]
        }
    }
}
```
:::

