---
title: Query customers at risk (batch)
slug: amberflo-api/query-customers-at-risk-batch
docTags: 
createdAt: 2024-11-07T15:10:16.980Z
---

{
  "id": "FdfxABqFmexDTSivqSQFC",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/notification/stats/customers-at-risk/batch",
    "servers": [
      {
        "url": "https://app.amberflo.io/notification/stats/customers-at-risk/batch"
      }
    ],
    "name": "Query customers at risk (batch)",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "array",
          "description": "",
          "customType": "com.amberflo.alert.statistics.CustomersAtRiskQuery.in[]",
          "schema": [
            {
              "name": "measurementType",
              "kind": "optional",
              "type": "string",
              "description": "",
              "modelRef": "#/components/schemas/com.amberflo.alert.definition.MeasurementType.in",
              "customType": "com.amberflo.alert.definition.MeasurementType.in",
              "schema": []
            },
            {
              "name": "thresholdSide",
              "kind": "optional",
              "type": "string",
              "description": "",
              "modelRef": "#/components/schemas/com.amberflo.alert.statistics.ThresholdSide.in",
              "customType": "com.amberflo.alert.statistics.ThresholdSide.in",
              "schema": []
            },
            {
              "name": "thresholdValue",
              "kind": "optional",
              "type": "number",
              "example": ""
            },
            {
              "name": "customerIds",
              "kind": "optional",
              "type": "array",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "meterApiName",
              "kind": "optional",
              "type": "string",
              "example": ""
            },
            {
              "name": "productPlanId",
              "kind": "optional",
              "type": "string",
              "example": ""
            }
          ],
          "modelRef": "#/components/schemas/com.amberflo.alert.statistics.CustomersAtRiskQuery.in",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "X-API-KEY",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successful request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "array",
            "description": "",
            "customType": "com.amberflo.alert.statistics.CustomersAtRiskResult.out[]",
            "schema": [
              {
                "name": "metadata",
                "kind": "optional",
                "type": "object",
                "description": "",
                "modelRef": "#/components/schemas/com.amberflo.alert.statistics.CustomersAtRiskQuery.out",
                "customType": "com.amberflo.alert.statistics.CustomersAtRiskQuery.out",
                "schema": [
                  {
                    "name": "measurementType",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.alert.definition.MeasurementType.out",
                    "customType": "com.amberflo.alert.definition.MeasurementType.out",
                    "schema": []
                  },
                  {
                    "name": "thresholdSide",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.alert.statistics.ThresholdSide.out",
                    "customType": "com.amberflo.alert.statistics.ThresholdSide.out",
                    "schema": []
                  },
                  {
                    "name": "thresholdValue",
                    "kind": "optional",
                    "type": "number",
                    "example": ""
                  },
                  {
                    "name": "customerIds",
                    "kind": "optional",
                    "type": "array",
                    "example": "",
                    "itemType": "string",
                    "customType": "string[]",
                    "itemExample": "",
                    "itemDefault": ""
                  },
                  {
                    "name": "meterApiName",
                    "kind": "optional",
                    "type": "string",
                    "example": ""
                  },
                  {
                    "name": "productPlanId",
                    "kind": "optional",
                    "type": "string",
                    "example": ""
                  }
                ]
              },
              {
                "name": "customerIds",
                "kind": "optional",
                "type": "array",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              }
            ],
            "modelRef": "#/components/schemas/com.amberflo.alert.statistics.CustomersAtRiskResult.out",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "5cTXtkC5O9UESsZoOodgI",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://app.amberflo.io/notification/stats/customers-at-risk/batch \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '[\n     {}\n     ]'"
        },
        {
          "id": "65j9x1eScMhsZxzLmi7ZH",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify([\n   {}\n]);\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/notification/stats/customers-at-risk/batch\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "RpiIQrUFIe05-Wp8kwqdN",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/notification/stats/customers-at-risk/batch\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump([\n   {}\n])\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "u9J5Ayz5SiwYkgv-pWXVw",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/notification/stats/customers-at-risk/batch\"\n\npayload = json.dumps([\n   {}\n])\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "5cTXtkC5O9UESsZoOodgI"
    },
    "results": {
      "languages": [
        {
          "id": "5KvUzvzOwMoOgSSWVo52V",
          "language": "200",
          "code": "// Successful request\n[\n  {\n    \"metadata\": {\n      \"measurementType\": \"\",\n      \"thresholdSide\": \"\",\n      \"thresholdValue\": 0,\n      \"customerIds\": [\n        \"\"\n      ],\n      \"meterApiName\": \"\",\n      \"productPlanId\": \"\"\n    },\n    \"customerIds\": [\n      \"\"\n    ]\n  }\n]"
        }
      ],
      "selectedLanguageId": "5KvUzvzOwMoOgSSWVo52V"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}