---
title: /usage-aggregation/custom-aggregation-spec
slug: amberflo-api/usage-aggregationcustom-aggregation-spec
docTags: 
createdAt: 2024-11-07T15:10:16.979Z
---

{
  "id": "xGGzMfVS2Bi3XQ63lwiOC",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/usage-aggregation/custom-aggregation-spec",
    "servers": [
      {
        "url": "https://app.amberflo.io/usage-aggregation/custom-aggregation-spec"
      }
    ],
    "name": "",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "usage.aggregations.predefined.CustomAggregationSpec.in",
          "schema": [
            {
              "name": "id",
              "kind": "optional",
              "type": "string",
              "example": ""
            },
            {
              "name": "meterApiName",
              "kind": "optional",
              "type": "string",
              "example": ""
            },
            {
              "name": "groupBy",
              "kind": "optional",
              "type": "array",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "aggregationInterval",
              "kind": "optional",
              "type": "string",
              "description": "",
              "modelRef": "#/components/schemas/com.amberflo.service.common.aggregation.AggregationInterval.in",
              "customType": "com.amberflo.service.common.aggregation.AggregationInterval.in",
              "schema": []
            },
            {
              "name": "outputInterval",
              "kind": "optional",
              "type": "string",
              "description": "",
              "modelRef": "#/components/schemas/com.amberflo.service.common.aggregation.AggregationInterval.in",
              "customType": "com.amberflo.service.common.aggregation.AggregationInterval.in",
              "schema": []
            },
            {
              "name": "aggregationType",
              "kind": "optional",
              "type": "string",
              "description": "",
              "modelRef": "#/components/schemas/com.amberflo.service.common.aggregation.AggregationType.in",
              "customType": "com.amberflo.service.common.aggregation.AggregationType.in",
              "schema": []
            },
            {
              "name": "reason",
              "kind": "optional",
              "type": "string",
              "description": "",
              "modelRef": "#/components/schemas/usage.aggregations.aggregation.CustomAggregationReason.in",
              "customType": "usage.aggregations.aggregation.CustomAggregationReason.in",
              "schema": []
            }
          ],
          "modelRef": "#/components/schemas/usage.aggregations.predefined.CustomAggregationSpec.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": "usage.aggregations.predefined.CustomAggregationSpec.out",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "meterApiName",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "groupBy",
                "kind": "optional",
                "type": "array",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "aggregationInterval",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/com.amberflo.service.common.aggregation.AggregationInterval.out",
                "customType": "com.amberflo.service.common.aggregation.AggregationInterval.out",
                "schema": []
              },
              {
                "name": "outputInterval",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/com.amberflo.service.common.aggregation.AggregationInterval.out",
                "customType": "com.amberflo.service.common.aggregation.AggregationInterval.out",
                "schema": []
              },
              {
                "name": "aggregationType",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/com.amberflo.service.common.aggregation.AggregationType.out",
                "customType": "com.amberflo.service.common.aggregation.AggregationType.out",
                "schema": []
              },
              {
                "name": "reason",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/usage.aggregations.aggregation.CustomAggregationReason.out",
                "customType": "usage.aggregations.aggregation.CustomAggregationReason.out",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/usage.aggregations.predefined.CustomAggregationSpec.out",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "Lvlyq3Lntrr8Y5YIZ5Nrr",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://app.amberflo.io/usage-aggregation/custom-aggregation-spec \\\n     --header 'accept: application/json'"
        },
        {
          "id": "YG_0fmOB9Fvpl6DUJ-3LN",
          "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: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/usage-aggregation/custom-aggregation-spec\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "0EOYrqdNONvbUD_d9gzLE",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/usage-aggregation/custom-aggregation-spec\")\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\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "iuHsOPiq5RYStcMlgdRpm",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/usage-aggregation/custom-aggregation-spec\"\n\npayload = {}\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": "Lvlyq3Lntrr8Y5YIZ5Nrr"
    },
    "results": {
      "languages": [
        {
          "id": "_pLZmHQAq3kgpP7rjRk1B",
          "language": "200",
          "code": "// Successful request\n{\n  \"id\": \"\",\n  \"meterApiName\": \"\",\n  \"groupBy\": [\n    \"\"\n  ],\n  \"aggregationInterval\": \"\",\n  \"outputInterval\": \"\",\n  \"aggregationType\": \"\",\n  \"reason\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "_pLZmHQAq3kgpP7rjRk1B"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}