---
title: /meters/{id}/statistics
slug: amberflo-api/metersidstatistics
docTags: 
createdAt: 2024-11-07T15:10:16.979Z
---

{
  "id": "-pcUSt9FOlegZGlzbgABo",
  "type": "api-oas-v2",
  "data": {
    "method": "PUT",
    "url": "https://app.amberflo.io/meters/{id}/statistics",
    "servers": [
      {
        "url": "https://app.amberflo.io/meters/{id}/statistics"
      }
    ],
    "name": "",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "id",
          "type": "string",
          "description": ""
        }
      ],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "metadata.meter_definition.MeterStatistics.in",
          "schema": [
            {
              "name": "highFrequency",
              "kind": "optional",
              "type": "boolean",
              "example": ""
            },
            {
              "name": "highCardinalityInfo",
              "kind": "optional",
              "type": "map",
              "example": "",
              "customType": "map<string, metadata.meter_definition.MeterStatisticsInfo.in>",
              "schema": []
            },
            {
              "name": "frequency",
              "kind": "optional",
              "type": "object",
              "description": "",
              "modelRef": "#/components/schemas/metadata.meter_definition.MeterStatisticsInfo.in",
              "customType": "metadata.meter_definition.MeterStatisticsInfo.in",
              "schema": [
                {
                  "name": "valuesPerHour",
                  "kind": "optional",
                  "type": "number",
                  "example": ""
                },
                {
                  "name": "standardDeviation",
                  "kind": "optional",
                  "type": "number",
                  "example": ""
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/metadata.meter_definition.MeterStatistics.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": "object",
            "description": "",
            "customType": "metadata.meter_definition.MeterDefinition.out",
            "schema": [
              {
                "name": "accountId",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "replicatedFromAccountId",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "id",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "meterApiName",
                "kind": "required",
                "type": "string",
                "description": "Value used to identify the meter when ingesting events and querying usage.\n\nIt must be at most 50 chars long. Only `_`, `-`, `.` and alphanumeric chars are allowed.",
                "example": ""
              },
              {
                "name": "label",
                "kind": "required",
                "type": "string",
                "description": "Display name on the UI dashboard. This must be unique.\n\nNote that the following characters are not allowed: `/`, `\"`, `=`, `<`, `>`.",
                "example": ""
              },
              {
                "name": "description",
                "kind": "optional",
                "type": "string",
                "description": "Description of the meter to be displayed on the UI.\n\nNote that the following characters are not allowed: `=`, `<`, `>`.",
                "example": ""
              },
              {
                "name": "lockingStatus",
                "kind": "optional",
                "type": "string",
                "description": "Indicates if the meter can be modified or not.\n\n- `open` allows all modifications;\n- `close_to_deletion` forbids deleting the meter and changing its meterApiName;\n- `close_to_changes` and `deprecated` forbid any modification.\n\nDefault: `open`\n",
                "modelRef": "#/components/schemas/com.amberflo.service.common.LockingStatus.out",
                "customType": "com.amberflo.service.common.LockingStatus.out",
                "schema": []
              },
              {
                "name": "meterType",
                "kind": "required",
                "type": "string",
                "description": "The type of the meter.\n\nNote that the following meter types have been deprecated:\n- `avg_of_all_usage`\n- `resource_leasing`\n- `max_usage`\n- `running_total`\n- `unique_count`\n- `last_resource_status`\n- `duration_snapshot`\n",
                "modelRef": "#/components/schemas/metadata.meter_definition.MeterType.out",
                "customType": "metadata.meter_definition.MeterType.out",
                "schema": []
              },
              {
                "name": "aggregation",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/metadata.meter_definition.AggregationType.out",
                "customType": "metadata.meter_definition.AggregationType.out",
                "schema": []
              },
              {
                "name": "eventType",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/com.amberflo.service.common.meter_definition.EventType.out",
                "customType": "com.amberflo.service.common.meter_definition.EventType.out",
                "schema": []
              },
              {
                "name": "dimensions",
                "kind": "optional",
                "type": "array",
                "description": "Keywords used for filtering and grouping usage data.\n\nDimension names must be at most 30 chars long. Only `-`, `.` and alphanumeric chars are allowed.",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "aggregationDimensions",
                "kind": "optional",
                "type": "array",
                "description": "A subset of the dimensions that should be used for aggregations. Usually these are the dimensions that identify a unique resource or event.",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "useInBilling",
                "kind": "optional",
                "type": "boolean",
                "description": "Whether the meter should be kept in sync with a product item.\n\nWhen set to `true`, a product item will be created for this meter, if needed, and its name and description will be set to the meter's label and description.\n\nNote that you cannot delete a meter if the associated product item cannot be deleted too.",
                "example": ""
              },
              {
                "name": "unitOfUsage",
                "kind": "optional",
                "type": "boolean",
                "example": ""
              },
              {
                "name": "ultraFrequencyUniqueMeter",
                "kind": "optional",
                "type": "boolean",
                "example": ""
              },
              {
                "name": "seatBased",
                "kind": "optional",
                "type": "boolean",
                "deprecated": true,
                "description": "Use this flag to indicate that a `sum_of_all_usage` meter will be used for `seat based over invoice` billing scenario.",
                "example": ""
              },
              {
                "name": "squashSumMeter",
                "kind": "optional",
                "type": "boolean",
                "description": "When ingesting meters with high number of events, squash the events by grouping by meter dimensions and then summing them during the current hour.\n\nThis way all meter events with same dimensions will be reduced to one cummulative record in that hour.\n\nNote that only `sum_of_all_usage` meters can have this flag set to `true`.",
                "example": ""
              },
              {
                "name": "sharedWithPartners",
                "kind": "optional",
                "type": "boolean",
                "example": ""
              },
              {
                "name": "enabled",
                "kind": "optional",
                "type": "boolean",
                "example": ""
              },
              {
                "name": "timeoutInMinutes",
                "kind": "optional",
                "type": "integer<int32>",
                "description": "For how long to consider an event or resource active, if no new meter event is ingested for it.\n\nNote this is not applicable for `sum_of_all_usage`, `avg_of_all_usage` and `active_users` meters. For all others, the default is 1 year.",
                "example": 0
              },
              {
                "name": "viewGroupingFunction",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/metadata.meter_definition.ViewGroupingFunction.out",
                "customType": "metadata.meter_definition.ViewGroupingFunction.out",
                "schema": []
              },
              {
                "name": "viewGroupingInterval",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/metadata.meter_definition.ViewGroupingInterval.out",
                "customType": "metadata.meter_definition.ViewGroupingInterval.out",
                "schema": []
              },
              {
                "name": "viewRescaleFunction",
                "kind": "optional",
                "type": "object",
                "description": "Default function to be used by the Usage API to change the scale of the usage numbers.",
                "modelRef": "#/components/schemas/metadata.meter_definition.RescaleFunction.out",
                "customType": "metadata.meter_definition.RescaleFunction.out",
                "schema": [
                  {
                    "name": "function",
                    "kind": "optional",
                    "type": "string",
                    "description": "Function to be used to scale the usage numbers.\n\n`MULTIPLY` means that reported usage = coefficient * actual usage",
                    "modelRef": "#/components/schemas/metadata.meter_definition.RescaleFunctionType.out",
                    "customType": "metadata.meter_definition.RescaleFunctionType.out",
                    "schema": []
                  },
                  {
                    "name": "coefficient",
                    "kind": "optional",
                    "type": "number",
                    "description": "Coefficient to be used by the function.",
                    "example": ""
                  }
                ]
              },
              {
                "name": "statistics",
                "kind": "optional",
                "type": "object",
                "description": "",
                "modelRef": "#/components/schemas/metadata.meter_definition.MeterStatistics.out",
                "customType": "metadata.meter_definition.MeterStatistics.out",
                "schema": [
                  {
                    "name": "highFrequency",
                    "kind": "optional",
                    "type": "boolean",
                    "example": ""
                  },
                  {
                    "name": "highCardinalityInfo",
                    "kind": "optional",
                    "type": "map",
                    "example": "",
                    "customType": "map<string, metadata.meter_definition.MeterStatisticsInfo.out>",
                    "schema": []
                  },
                  {
                    "name": "frequency",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "modelRef": "#/components/schemas/metadata.meter_definition.MeterStatisticsInfo.out",
                    "customType": "metadata.meter_definition.MeterStatisticsInfo.out",
                    "schema": [
                      {
                        "name": "valuesPerHour",
                        "kind": "optional",
                        "type": "number",
                        "example": ""
                      },
                      {
                        "name": "standardDeviation",
                        "kind": "optional",
                        "type": "number",
                        "example": ""
                      }
                    ]
                  }
                ]
              },
              {
                "name": "deduplicationConfig",
                "kind": "optional",
                "type": "object",
                "description": "Configuration for performing custom deduplication of meter events.",
                "modelRef": "#/components/schemas/metadata.meter_definition.MeterDeduplicationConfig.out",
                "customType": "metadata.meter_definition.MeterDeduplicationConfig.out",
                "schema": [
                  {
                    "name": "lookBackTimeInDays",
                    "kind": "optional",
                    "type": "integer<int32>",
                    "description": "Size of the time window for considering an event a duplicate. If two events containing the same values for the deduplication dimensions are sent within this amount of days, the second one will be considered a duplicate.",
                    "example": 0
                  },
                  {
                    "name": "dimensions",
                    "kind": "optional",
                    "type": "array",
                    "description": "A subset of the dimensions that should be considered for deduplicating the meter.",
                    "example": "",
                    "itemType": "string",
                    "customType": "string[]",
                    "itemExample": "",
                    "itemDefault": ""
                  }
                ]
              },
              {
                "name": "dimensionMetadata",
                "kind": "optional",
                "type": "map",
                "description": "Additional metadata for each dimension",
                "example": "",
                "customType": "map<string, metadata.meter_definition.DimensionMetadata.out>",
                "schema": []
              },
              {
                "name": "dimensionValuePatterns",
                "kind": "optional",
                "type": "map",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "createTime",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Creation time in [Unix time](https://en.wikipedia.org/wiki/Unix_time) (milliseconds)",
                "example": 0
              },
              {
                "name": "updateTime",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Update time in [Unix time](https://en.wikipedia.org/wiki/Unix_time) (milliseconds)",
                "example": 0
              }
            ],
            "modelRef": "#/components/schemas/metadata.meter_definition.MeterDefinition.out",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "W28Nci9c0pVbJE2WHBlrR",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PUT \\\n     --url https://app.amberflo.io/meters/{id}/statistics \\\n     --header 'accept: application/json'"
        },
        {
          "id": "N0nLTK9Bi3RByotxj6KW7",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'PUT',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/meters/{id}/statistics\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "cF4mlxA2Qv8n2KSwhotCz",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/meters/{id}/statistics\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Put.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "tmlz5befGMQ49D3wL2Ezv",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/meters/{id}/statistics\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"PUT\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "W28Nci9c0pVbJE2WHBlrR"
    },
    "results": {
      "languages": [
        {
          "id": "i80kNbBQ8IyF0bE-2J1-x",
          "language": "200",
          "code": "// Successful request\n{\n  \"accountId\": \"\",\n  \"replicatedFromAccountId\": \"\",\n  \"id\": \"\",\n  \"meterApiName\": \"\",\n  \"label\": \"\",\n  \"description\": \"\",\n  \"lockingStatus\": \"\",\n  \"meterType\": \"\",\n  \"aggregation\": \"\",\n  \"eventType\": \"\",\n  \"dimensions\": [\n    \"\"\n  ],\n  \"aggregationDimensions\": [\n    \"\"\n  ],\n  \"useInBilling\": false,\n  \"unitOfUsage\": false,\n  \"ultraFrequencyUniqueMeter\": false,\n  \"seatBased\": false,\n  \"squashSumMeter\": false,\n  \"sharedWithPartners\": false,\n  \"enabled\": false,\n  \"timeoutInMinutes\": \"\",\n  \"viewGroupingFunction\": \"\",\n  \"viewGroupingInterval\": \"\",\n  \"viewRescaleFunction\": {\n    \"function\": \"\",\n    \"coefficient\": 0\n  },\n  \"statistics\": {\n    \"highFrequency\": false,\n    \"highCardinalityInfo\": \"\",\n    \"frequency\": {\n      \"valuesPerHour\": 0,\n      \"standardDeviation\": 0\n    }\n  },\n  \"deduplicationConfig\": {\n    \"lookBackTimeInDays\": \"\",\n    \"dimensions\": [\n      \"\"\n    ]\n  },\n  \"dimensionMetadata\": \"\",\n  \"dimensionValuePatterns\": \"\",\n  \"createTime\": \"\",\n  \"updateTime\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "i80kNbBQ8IyF0bE-2J1-x"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}