---
title: Create or update a cost item price using a cost item price template
slug: amberflo-api/create-or-update-a-cost-item-price-using-a-cost-item-price-template
docTags: 
createdAt: 2024-11-07T15:10:16.974Z
---

{
  "id": "GPycneTww3lNYNc2nZXFs",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/payments/pricing/amberflo/account-pricing/cost-item-price/template/cost_item_usage_based_no_dimension",
    "servers": [
      {
        "url": "https://app.amberflo.io/payments/pricing/amberflo/account-pricing/cost-item-price/template/cost_item_usage_based_no_dimension"
      }
    ],
    "name": "Create or update a cost item price using a cost item price template",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "payment.pricing.cost.UsageBasedNoDimensionCostItemPriceGenerator.in",
          "schema": [
            {
              "name": "id",
              "kind": "required",
              "type": "string",
              "description": "Id associated with the price.",
              "example": ""
            },
            {
              "name": "leafNodeType",
              "kind": "required",
              "type": "string",
              "description": "Leaf node the price is using.",
              "example": ""
            },
            {
              "name": "priceTiers",
              "kind": "required",
              "type": "array",
              "description": "Price for each tier.",
              "modelRef": "#/components/schemas/payment.pricing.price.PriceTier.in",
              "customType": "payment.pricing.price.PriceTier.in[]",
              "schema": [
                {
                  "name": "startAfterUnit",
                  "kind": "optional",
                  "type": "integer<int64>",
                  "example": 0
                },
                {
                  "name": "batchSize",
                  "kind": "optional",
                  "type": "integer<int64>",
                  "example": 0
                },
                {
                  "name": "pricePerBatch",
                  "kind": "optional",
                  "type": "number",
                  "example": ""
                }
              ]
            },
            {
              "name": "meterApiName",
              "kind": "required",
              "type": "string",
              "description": "Meter API name associated with the price.",
              "example": ""
            },
            {
              "name": "groupDimensions",
              "kind": "optional",
              "type": "array",
              "description": "Dimensions to group the invoice by.",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "costItemPriceName",
              "kind": "optional",
              "type": "string",
              "description": "Name of the price machine. Useful for displaying to users.",
              "example": ""
            },
            {
              "name": "scalar",
              "kind": "optional",
              "type": "number",
              "description": "Optional scalar for scaling usage",
              "example": ""
            },
            {
              "name": "startDateInSeconds",
              "kind": "required",
              "type": "integer<int64>",
              "description": "The date when the cost item takes effective.",
              "example": 0
            },
            {
              "name": "expirationDateInSeconds",
              "kind": "optional",
              "type": "integer<int64>",
              "description": "The date when the cost item expires.",
              "example": 0
            },
            {
              "name": "type",
              "kind": "optional",
              "type": "string",
              "description": "Type of template, automatically populated.",
              "example": "",
              "default": "cost_item_usage_based_no_dimension"
            },
            {
              "name": "useAverageReducer",
              "kind": "optional",
              "type": "string",
              "description": "Usage granularity if using average.",
              "modelRef": "#/components/schemas/payment.pricing.price.UsageGranularity.in",
              "customType": "payment.pricing.price.UsageGranularity.in",
              "schema": []
            }
          ],
          "modelRef": "#/components/schemas/payment.pricing.cost.UsageBasedNoDimensionCostItemPriceGenerator.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": "payment.pricing.cost.UsageBasedNoDimensionCostItemPriceGenerator.out",
            "schema": [
              {
                "name": "id",
                "kind": "required",
                "type": "string",
                "description": "Id associated with the price.",
                "example": ""
              },
              {
                "name": "leafNodeType",
                "kind": "required",
                "type": "string",
                "description": "Leaf node the price is using.",
                "example": ""
              },
              {
                "name": "priceTiers",
                "kind": "required",
                "type": "array",
                "description": "Price for each tier.",
                "modelRef": "#/components/schemas/payment.pricing.price.PriceTier.out",
                "customType": "payment.pricing.price.PriceTier.out[]",
                "schema": [
                  {
                    "name": "startAfterUnit",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "example": 0
                  },
                  {
                    "name": "batchSize",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "example": 0
                  },
                  {
                    "name": "pricePerBatch",
                    "kind": "optional",
                    "type": "number",
                    "example": ""
                  }
                ]
              },
              {
                "name": "meterApiName",
                "kind": "required",
                "type": "string",
                "description": "Meter API name associated with the price.",
                "example": ""
              },
              {
                "name": "groupDimensions",
                "kind": "optional",
                "type": "array",
                "description": "Dimensions to group the invoice by.",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "costItemPriceName",
                "kind": "optional",
                "type": "string",
                "description": "Name of the price machine. Useful for displaying to users.",
                "example": ""
              },
              {
                "name": "scalar",
                "kind": "optional",
                "type": "number",
                "description": "Optional scalar for scaling usage",
                "example": ""
              },
              {
                "name": "startDateInSeconds",
                "kind": "required",
                "type": "integer<int64>",
                "description": "The date when the cost item takes effective.",
                "example": 0
              },
              {
                "name": "expirationDateInSeconds",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "The date when the cost item expires.",
                "example": 0
              },
              {
                "name": "type",
                "kind": "optional",
                "type": "string",
                "description": "Type of template, automatically populated.",
                "example": "",
                "default": "cost_item_usage_based_no_dimension"
              },
              {
                "name": "useAverageReducer",
                "kind": "optional",
                "type": "string",
                "description": "Usage granularity if using average.",
                "modelRef": "#/components/schemas/payment.pricing.price.UsageGranularity.out",
                "customType": "payment.pricing.price.UsageGranularity.out",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/payment.pricing.cost.UsageBasedNoDimensionCostItemPriceGenerator.out",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "SJSnvia8VxK_Uu5h-EHGo",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://app.amberflo.io/payments/pricing/amberflo/account-pricing/cost-item-price/template/cost_item_usage_based_no_dimension \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"id\": \"\",\n     \"leafNodeType\": \"\",\n     \"priceTiers\": [\n     {}\n     ],\n     \"meterApiName\": \"\",\n     \"startDateInSeconds\": 0,\n     \"type\": \"cost_item_usage_based_no_dimension\"\n     }'"
        },
        {
          "id": "xxD1SWLaRtJCc0KJm9aog",
          "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   \"id\": \"\",\n   \"leafNodeType\": \"\",\n   \"priceTiers\": [\n      {}\n   ],\n   \"meterApiName\": \"\",\n   \"startDateInSeconds\": 0,\n   \"type\": \"cost_item_usage_based_no_dimension\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/payments/pricing/amberflo/account-pricing/cost-item-price/template/cost_item_usage_based_no_dimension\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "2xo6twTgBCz-1rtDpCce-",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/payments/pricing/amberflo/account-pricing/cost-item-price/template/cost_item_usage_based_no_dimension\")\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   \"id\": \"\",\n   \"leafNodeType\": \"\",\n   \"priceTiers\": [\n      {}\n   ],\n   \"meterApiName\": \"\",\n   \"startDateInSeconds\": 0,\n   \"type\": \"cost_item_usage_based_no_dimension\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "lOMwpzemS3Fe9qrZj77Hy",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/payments/pricing/amberflo/account-pricing/cost-item-price/template/cost_item_usage_based_no_dimension\"\n\npayload = json.dumps({\n   \"id\": \"\",\n   \"leafNodeType\": \"\",\n   \"priceTiers\": [\n      {}\n   ],\n   \"meterApiName\": \"\",\n   \"startDateInSeconds\": 0,\n   \"type\": \"cost_item_usage_based_no_dimension\"\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": "SJSnvia8VxK_Uu5h-EHGo"
    },
    "results": {
      "languages": [
        {
          "id": "f9kkawkuRHXZmcbwFSw8j",
          "language": "200",
          "code": "// Successful request\n{\n  \"id\": \"\",\n  \"leafNodeType\": \"\",\n  \"priceTiers\": [\n    {\n      \"startAfterUnit\": \"\",\n      \"batchSize\": \"\",\n      \"pricePerBatch\": 0\n    }\n  ],\n  \"meterApiName\": \"\",\n  \"groupDimensions\": [\n    \"\"\n  ],\n  \"costItemPriceName\": \"\",\n  \"scalar\": 0,\n  \"startDateInSeconds\": \"\",\n  \"expirationDateInSeconds\": \"\",\n  \"type\": \"\",\n  \"useAverageReducer\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "f9kkawkuRHXZmcbwFSw8j"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}