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

{
  "id": "fasStGe58u4QDqsjw1JAK",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/payments/pricing/amberflo/account-pricing/cost-item-price/template/cost_item_tiered_seat_based",
    "servers": [
      {
        "url": "https://app.amberflo.io/payments/pricing/amberflo/account-pricing/cost-item-price/template/cost_item_tiered_seat_based"
      }
    ],
    "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.TieredSeatBasedCostItemPriceGenerator.in",
          "schema": [
            {
              "name": "distinctDimensions",
              "kind": "required",
              "type": "array",
              "description": "Dimensions to evaluate uniqueness.",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "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": "usageGranularity",
              "kind": "required",
              "type": "string",
              "description": "Time-span to evaluate.",
              "modelRef": "#/components/schemas/payment.pricing.price.UsageGranularity.in",
              "customType": "payment.pricing.price.UsageGranularity.in",
              "schema": []
            },
            {
              "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_tiered_seat_based"
            }
          ],
          "modelRef": "#/components/schemas/payment.pricing.cost.TieredSeatBasedCostItemPriceGenerator.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.TieredSeatBasedCostItemPriceGenerator.out",
            "schema": [
              {
                "name": "distinctDimensions",
                "kind": "required",
                "type": "array",
                "description": "Dimensions to evaluate uniqueness.",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "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": "usageGranularity",
                "kind": "required",
                "type": "string",
                "description": "Time-span to evaluate.",
                "modelRef": "#/components/schemas/payment.pricing.price.UsageGranularity.out",
                "customType": "payment.pricing.price.UsageGranularity.out",
                "schema": []
              },
              {
                "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_tiered_seat_based"
              }
            ],
            "modelRef": "#/components/schemas/payment.pricing.cost.TieredSeatBasedCostItemPriceGenerator.out",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "ycZTvw1XJIW9jAEnRzRmH",
          "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_tiered_seat_based \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"distinctDimensions\": [],\n     \"id\": \"\",\n     \"leafNodeType\": \"\",\n     \"priceTiers\": [\n     {}\n     ],\n     \"meterApiName\": \"\",\n     \"usageGranularity\": \"\",\n     \"startDateInSeconds\": 0,\n     \"type\": \"cost_item_tiered_seat_based\"\n     }'"
        },
        {
          "id": "F-ePI6DAum-rYlPy4YCBz",
          "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   \"distinctDimensions\": [],\n   \"id\": \"\",\n   \"leafNodeType\": \"\",\n   \"priceTiers\": [\n      {}\n   ],\n   \"meterApiName\": \"\",\n   \"usageGranularity\": \"\",\n   \"startDateInSeconds\": 0,\n   \"type\": \"cost_item_tiered_seat_based\"\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_tiered_seat_based\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "JCIK8yB4zQt1Vj4nZB5p5",
          "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_tiered_seat_based\")\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   \"distinctDimensions\": [],\n   \"id\": \"\",\n   \"leafNodeType\": \"\",\n   \"priceTiers\": [\n      {}\n   ],\n   \"meterApiName\": \"\",\n   \"usageGranularity\": \"\",\n   \"startDateInSeconds\": 0,\n   \"type\": \"cost_item_tiered_seat_based\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "ayqJU2edPWNhgaNgIiUar",
          "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_tiered_seat_based\"\n\npayload = json.dumps({\n   \"distinctDimensions\": [],\n   \"id\": \"\",\n   \"leafNodeType\": \"\",\n   \"priceTiers\": [\n      {}\n   ],\n   \"meterApiName\": \"\",\n   \"usageGranularity\": \"\",\n   \"startDateInSeconds\": 0,\n   \"type\": \"cost_item_tiered_seat_based\"\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": "ycZTvw1XJIW9jAEnRzRmH"
    },
    "results": {
      "languages": [
        {
          "id": "TbU29-yj7F8aHibOjP_aK",
          "language": "200",
          "code": "// Successful request\n{\n  \"distinctDimensions\": [\n    \"\"\n  ],\n  \"id\": \"\",\n  \"leafNodeType\": \"\",\n  \"priceTiers\": [\n    {\n      \"startAfterUnit\": \"\",\n      \"batchSize\": \"\",\n      \"pricePerBatch\": 0\n    }\n  ],\n  \"meterApiName\": \"\",\n  \"usageGranularity\": \"\",\n  \"groupDimensions\": [\n    \"\"\n  ],\n  \"costItemPriceName\": \"\",\n  \"scalar\": 0,\n  \"startDateInSeconds\": \"\",\n  \"expirationDateInSeconds\": \"\",\n  \"type\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "TbU29-yj7F8aHibOjP_aK"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}