---
title: /payments/analysis/revenue-calculator-template
slug: amberflo-api/3sxB-paymentsanalysisrevenue-calculator-template
docTags: 
createdAt: 2024-11-07T15:10:16.977Z
---

{
  "id": "bG9iLbYmBSClOg3YF-ACZ",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://app.amberflo.io/payments/analysis/revenue-calculator-template",
    "servers": [
      {
        "url": "https://app.amberflo.io/payments/analysis/revenue-calculator-template"
      }
    ],
    "name": "",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [],
      "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": "payment.analysis.modeling.PriceAnalysisModel.out",
            "schema": [],
            "modelRef": "#/components/schemas/payment.analysis.modeling.PriceAnalysisModel.out",
            "complexItems": [
              {
                "name": "object",
                "schema": [
                  {
                    "name": "key",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.analysis.modeling.PriceAnalysisModelKey.out",
                    "customType": "payment.analysis.modeling.PriceAnalysisModelKey.out",
                    "schema": [
                      {
                        "name": "accountId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "id",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      }
                    ]
                  },
                  {
                    "name": "type",
                    "kind": "optional",
                    "type": "string",
                    "example": "",
                    "default": "by-rule"
                  },
                  {
                    "name": "name",
                    "kind": "optional",
                    "type": "string",
                    "example": ""
                  },
                  {
                    "name": "description",
                    "kind": "optional",
                    "type": "string",
                    "example": ""
                  },
                  {
                    "name": "timeRange",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.common.TimeRange.out",
                    "customType": "payment.common.TimeRange.out",
                    "schema": [
                      {
                        "name": "startTimeInSeconds",
                        "kind": "optional",
                        "type": "integer<int64>",
                        "example": 0
                      },
                      {
                        "name": "endTimeInSeconds",
                        "kind": "optional",
                        "type": "integer<int64>",
                        "example": 0
                      }
                    ]
                  },
                  {
                    "name": "analysisProductPlans",
                    "kind": "optional",
                    "type": "array",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.analysis.modeling.AnalysisProductPlan.out",
                    "customType": "payment.analysis.modeling.AnalysisProductPlan.out[]",
                    "schema": [
                      {
                        "name": "id",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "referencePlan",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "planBillingPeriod",
                        "kind": "optional",
                        "type": "object",
                        "description": "",
                        "modelRef": "#/components/schemas/payment.pricing.BillingPeriod.out",
                        "customType": "payment.pricing.BillingPeriod.out",
                        "schema": [
                          {
                            "name": "interval",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "modelRef": "#/components/schemas/payment.pricing.BillingPeriodInterval.out",
                            "customType": "payment.pricing.BillingPeriodInterval.out",
                            "schema": []
                          },
                          {
                            "name": "intervalsCount",
                            "kind": "optional",
                            "type": "integer<int32>",
                            "example": 0
                          }
                        ]
                      },
                      {
                        "name": "itemToPriceIdsOverrides",
                        "kind": "optional",
                        "type": "map",
                        "example": "",
                        "customType": "map<string, string>",
                        "schema": []
                      },
                      {
                        "name": "meterNameToPriceOverrides",
                        "kind": "optional",
                        "type": "map",
                        "example": "",
                        "customType": "map<string, payment.pricing.price.PriceStateMachineNode.out>",
                        "schema": []
                      }
                    ]
                  },
                  {
                    "name": "timeGroupingInterval",
                    "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": "updateTimeInSeconds",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "example": 0
                  },
                  {
                    "name": "customersBaseQuery",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.analysis.modeling.by_rule.CustomersSampleSpaceKey.out",
                    "customType": "payment.analysis.modeling.by_rule.CustomersSampleSpaceKey.out",
                    "schema": [
                      {
                        "name": "filters",
                        "kind": "optional",
                        "type": "map",
                        "example": "",
                        "customType": "map<string, string[]>",
                        "schema": []
                      },
                      {
                        "name": "take",
                        "kind": "optional",
                        "type": "object",
                        "description": "",
                        "modelRef": "#/components/schemas/payment.common.Take.out",
                        "customType": "payment.common.Take.out",
                        "schema": [
                          {
                            "name": "limit",
                            "kind": "optional",
                            "type": "integer<int32>",
                            "example": 0
                          },
                          {
                            "name": "isAscending",
                            "kind": "optional",
                            "type": "boolean",
                            "example": ""
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "name": "customerSource",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.analysis.modeling.by_rule.CustomersSourceType.out",
                    "customType": "payment.analysis.modeling.by_rule.CustomersSourceType.out",
                    "schema": []
                  },
                  {
                    "name": "usageSource",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.analysis.modeling.by_rule.UsageSourceType.out",
                    "customType": "payment.analysis.modeling.by_rule.UsageSourceType.out",
                    "schema": []
                  }
                ],
                "modelRef": "#/components/schemas/payment.analysis.modeling.by_rule.ByRulePriceAnalysisModel.out",
                "customType": "payment.analysis.modeling.by_rule.ByRulePriceAnalysisModel.out"
              },
              {
                "name": "object",
                "schema": [
                  {
                    "name": "key",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.analysis.modeling.PriceAnalysisModelKey.out",
                    "customType": "payment.analysis.modeling.PriceAnalysisModelKey.out",
                    "schema": [
                      {
                        "name": "accountId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "id",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      }
                    ]
                  },
                  {
                    "name": "type",
                    "kind": "optional",
                    "type": "string",
                    "example": "",
                    "default": "raw"
                  },
                  {
                    "name": "name",
                    "kind": "optional",
                    "type": "string",
                    "example": ""
                  },
                  {
                    "name": "description",
                    "kind": "optional",
                    "type": "string",
                    "example": ""
                  },
                  {
                    "name": "timeRange",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.common.TimeRange.out",
                    "customType": "payment.common.TimeRange.out",
                    "schema": [
                      {
                        "name": "startTimeInSeconds",
                        "kind": "optional",
                        "type": "integer<int64>",
                        "example": 0
                      },
                      {
                        "name": "endTimeInSeconds",
                        "kind": "optional",
                        "type": "integer<int64>",
                        "example": 0
                      }
                    ]
                  },
                  {
                    "name": "analysisProductPlans",
                    "kind": "optional",
                    "type": "array",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.analysis.modeling.AnalysisProductPlan.out",
                    "customType": "payment.analysis.modeling.AnalysisProductPlan.out[]",
                    "schema": [
                      {
                        "name": "id",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "referencePlan",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "planBillingPeriod",
                        "kind": "optional",
                        "type": "object",
                        "description": "",
                        "modelRef": "#/components/schemas/payment.pricing.BillingPeriod.out",
                        "customType": "payment.pricing.BillingPeriod.out",
                        "schema": [
                          {
                            "name": "interval",
                            "kind": "optional",
                            "type": "string",
                            "description": "",
                            "modelRef": "#/components/schemas/payment.pricing.BillingPeriodInterval.out",
                            "customType": "payment.pricing.BillingPeriodInterval.out",
                            "schema": []
                          },
                          {
                            "name": "intervalsCount",
                            "kind": "optional",
                            "type": "integer<int32>",
                            "example": 0
                          }
                        ]
                      },
                      {
                        "name": "itemToPriceIdsOverrides",
                        "kind": "optional",
                        "type": "map",
                        "example": "",
                        "customType": "map<string, string>",
                        "schema": []
                      },
                      {
                        "name": "meterNameToPriceOverrides",
                        "kind": "optional",
                        "type": "map",
                        "example": "",
                        "customType": "map<string, payment.pricing.price.PriceStateMachineNode.out>",
                        "schema": []
                      }
                    ]
                  },
                  {
                    "name": "timeGroupingInterval",
                    "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": "updateTimeInSeconds",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "example": 0
                  },
                  {
                    "name": "customerGroupsUsageStats",
                    "kind": "optional",
                    "type": "array",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.analysis.modeling.raw.RawCustomerGroupUsageStats.out",
                    "customType": "payment.analysis.modeling.raw.RawCustomerGroupUsageStats.out[]",
                    "schema": [
                      {
                        "name": "customerGroupId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "customersInGroup",
                        "kind": "optional",
                        "type": "integer<int32>",
                        "example": 0
                      },
                      {
                        "name": "meterToCustomerUsageStatsMap",
                        "kind": "optional",
                        "type": "map",
                        "example": "",
                        "customType": "map<string, payment.analysis.modeling.raw.RawMeterUsageStats.out>",
                        "schema": []
                      }
                    ]
                  }
                ],
                "modelRef": "#/components/schemas/payment.analysis.modeling.raw.RawPriceAnalysisModel.out",
                "customType": "payment.analysis.modeling.raw.RawPriceAnalysisModel.out"
              }
            ],
            "complexType": "oneOf",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "OGOFIC_ECzhVpMi-6taWd",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://app.amberflo.io/payments/analysis/revenue-calculator-template \\\n     --header 'accept: application/json'"
        },
        {
          "id": "vGxyzL1KkErSKWGYIPtGY",
          "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: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/payments/analysis/revenue-calculator-template\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "m1JP1wq7VkiIWJ3F-Dn_x",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/payments/analysis/revenue-calculator-template\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "bDjCVlEkFTB_C9KeneD8x",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/payments/analysis/revenue-calculator-template\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "OGOFIC_ECzhVpMi-6taWd"
    },
    "results": {
      "languages": [
        {
          "id": "MvmZgoh9nV2Qo05PDrKPx",
          "language": "200",
          "code": "// Successful request\n{}"
        }
      ],
      "selectedLanguageId": "MvmZgoh9nV2Qo05PDrKPx"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}