---
title: Create or update a usage transformer
slug: amberflo-api/create-or-update-a-usage-transformer
docTags: 
createdAt: 2024-11-07T15:10:16.977Z
---

{
  "id": "ufOgduMo0esCRUB1iFzDN",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/payments/pricing/amberflo/account-pricing/usage-transformer",
    "servers": [
      {
        "url": "https://app.amberflo.io/payments/pricing/amberflo/account-pricing/usage-transformer"
      }
    ],
    "name": "Create or update a usage transformer",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "payment.pricing.UsageTransformer.in",
          "schema": [
            {
              "name": "id",
              "kind": "optional",
              "type": "string",
              "description": "Unique identifier for a particular usage transformer.",
              "example": ""
            },
            {
              "name": "name",
              "kind": "optional",
              "type": "string",
              "description": "Name given to the usage transformer.",
              "example": ""
            },
            {
              "name": "transformUsageDimensionName",
              "kind": "optional",
              "type": "string",
              "description": "Name of the dimension used to transform / scale usage.",
              "example": ""
            },
            {
              "name": "productItemId",
              "kind": "optional",
              "type": "string",
              "description": "Product item id associated with the usage transformer.",
              "example": ""
            },
            {
              "name": "dimensionsInterpolations",
              "kind": "optional",
              "type": "object",
              "description": "List of dimension interpolations, used to derive new dimensions and their values.",
              "modelRef": "#/components/schemas/com.amberflo.service.common.dimensions_interpolation.DimensionsInterpolation.in",
              "customType": "com.amberflo.service.common.dimensions_interpolation.DimensionsInterpolation.in[]",
              "schema": [],
              "complexType": "oneOf",
              "complexItems": [
                {
                  "name": "com.amberflo.service.common.dimensions_interpolation.ListNumericInterpolation.in",
                  "description": "",
                  "modelRef": "#/components/schemas/com.amberflo.service.common.dimensions_interpolation.ListNumericInterpolation.in",
                  "schema": [
                    {
                      "name": "type",
                      "kind": "optional",
                      "type": "string",
                      "example": "",
                      "default": "list_numeric_interpolation"
                    },
                    {
                      "name": "dimensions",
                      "kind": "optional",
                      "type": "array",
                      "example": "",
                      "itemType": "string",
                      "customType": "string[]",
                      "itemExample": "",
                      "itemDefault": ""
                    },
                    {
                      "name": "newDimensionName",
                      "kind": "optional",
                      "type": "string",
                      "example": ""
                    },
                    {
                      "name": "operation",
                      "kind": "optional",
                      "type": "string",
                      "example": ""
                    }
                  ]
                },
                {
                  "name": "com.amberflo.service.common.dimensions_interpolation.TableInterpolation.in",
                  "description": "",
                  "modelRef": "#/components/schemas/com.amberflo.service.common.dimensions_interpolation.TableInterpolation.in",
                  "schema": [
                    {
                      "name": "type",
                      "kind": "optional",
                      "type": "string",
                      "example": "",
                      "default": "table_interpolation"
                    },
                    {
                      "name": "newDimensionName",
                      "kind": "optional",
                      "type": "string",
                      "example": ""
                    },
                    {
                      "name": "dimensionKeys",
                      "kind": "optional",
                      "type": "array",
                      "example": "",
                      "itemType": "string",
                      "customType": "string[]",
                      "itemExample": "",
                      "itemDefault": ""
                    },
                    {
                      "name": "dimensionTableRows",
                      "kind": "optional",
                      "type": "array",
                      "description": "",
                      "modelRef": "#/components/schemas/com.amberflo.service.common.dimensions_interpolation.TableInterpolationRow.in",
                      "customType": "com.amberflo.service.common.dimensions_interpolation.TableInterpolationRow.in[]",
                      "schema": [
                        {
                          "name": "dimensionValues",
                          "kind": "optional",
                          "type": "array",
                          "example": "",
                          "itemType": "string",
                          "customType": "string[]",
                          "itemExample": "",
                          "itemDefault": ""
                        },
                        {
                          "name": "newValue",
                          "kind": "optional",
                          "type": "number",
                          "example": ""
                        }
                      ]
                    }
                  ]
                },
                {
                  "name": "com.amberflo.service.common.dimensions_interpolation.TiersInterpolation.in",
                  "description": "",
                  "modelRef": "#/components/schemas/com.amberflo.service.common.dimensions_interpolation.TiersInterpolation.in",
                  "schema": [
                    {
                      "name": "type",
                      "kind": "optional",
                      "type": "string",
                      "example": "",
                      "default": "tiers_interpolation"
                    },
                    {
                      "name": "newDimensionName",
                      "kind": "optional",
                      "type": "string",
                      "example": ""
                    },
                    {
                      "name": "dimensionName",
                      "kind": "optional",
                      "type": "string",
                      "example": ""
                    },
                    {
                      "name": "newDimensionTierMap",
                      "kind": "optional",
                      "type": "map",
                      "example": "",
                      "customType": "map<string, number>",
                      "schema": []
                    }
                  ]
                }
              ]
            },
            {
              "name": "requiredDimensions",
              "kind": "optional",
              "type": "array",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "lockingStatus",
              "kind": "optional",
              "type": "string",
              "description": "",
              "modelRef": "#/components/schemas/com.amberflo.service.common.LockingStatus.in",
              "customType": "com.amberflo.service.common.LockingStatus.in",
              "schema": []
            },
            {
              "name": "lastUpdateTimeInMillis",
              "kind": "optional",
              "type": "integer<int64>",
              "example": 0
            }
          ],
          "modelRef": "#/components/schemas/payment.pricing.UsageTransformer.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.UsageTransformer.out",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "string",
                "description": "Unique identifier for a particular usage transformer.",
                "example": ""
              },
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "Name given to the usage transformer.",
                "example": ""
              },
              {
                "name": "transformUsageDimensionName",
                "kind": "optional",
                "type": "string",
                "description": "Name of the dimension used to transform / scale usage.",
                "example": ""
              },
              {
                "name": "productItemId",
                "kind": "optional",
                "type": "string",
                "description": "Product item id associated with the usage transformer.",
                "example": ""
              },
              {
                "name": "dimensionsInterpolations",
                "kind": "optional",
                "type": "object",
                "description": "List of dimension interpolations, used to derive new dimensions and their values.",
                "modelRef": "#/components/schemas/com.amberflo.service.common.dimensions_interpolation.DimensionsInterpolation.out",
                "customType": "com.amberflo.service.common.dimensions_interpolation.DimensionsInterpolation.out[]",
                "schema": [],
                "complexType": "oneOf",
                "complexItems": [
                  {
                    "name": "com.amberflo.service.common.dimensions_interpolation.ListNumericInterpolation.out",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.service.common.dimensions_interpolation.ListNumericInterpolation.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string",
                        "example": "",
                        "default": "list_numeric_interpolation"
                      },
                      {
                        "name": "dimensions",
                        "kind": "optional",
                        "type": "array",
                        "example": "",
                        "itemType": "string",
                        "customType": "string[]",
                        "itemExample": "",
                        "itemDefault": ""
                      },
                      {
                        "name": "newDimensionName",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "operation",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      }
                    ]
                  },
                  {
                    "name": "com.amberflo.service.common.dimensions_interpolation.TableInterpolation.out",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.service.common.dimensions_interpolation.TableInterpolation.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string",
                        "example": "",
                        "default": "table_interpolation"
                      },
                      {
                        "name": "newDimensionName",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "dimensionKeys",
                        "kind": "optional",
                        "type": "array",
                        "example": "",
                        "itemType": "string",
                        "customType": "string[]",
                        "itemExample": "",
                        "itemDefault": ""
                      },
                      {
                        "name": "dimensionTableRows",
                        "kind": "optional",
                        "type": "array",
                        "description": "",
                        "modelRef": "#/components/schemas/com.amberflo.service.common.dimensions_interpolation.TableInterpolationRow.out",
                        "customType": "com.amberflo.service.common.dimensions_interpolation.TableInterpolationRow.out[]",
                        "schema": [
                          {
                            "name": "dimensionValues",
                            "kind": "optional",
                            "type": "array",
                            "example": "",
                            "itemType": "string",
                            "customType": "string[]",
                            "itemExample": "",
                            "itemDefault": ""
                          },
                          {
                            "name": "newValue",
                            "kind": "optional",
                            "type": "number",
                            "example": ""
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "name": "com.amberflo.service.common.dimensions_interpolation.TiersInterpolation.out",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.service.common.dimensions_interpolation.TiersInterpolation.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string",
                        "example": "",
                        "default": "tiers_interpolation"
                      },
                      {
                        "name": "newDimensionName",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "dimensionName",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "newDimensionTierMap",
                        "kind": "optional",
                        "type": "map",
                        "example": "",
                        "customType": "map<string, number>",
                        "schema": []
                      }
                    ]
                  }
                ]
              },
              {
                "name": "requiredDimensions",
                "kind": "optional",
                "type": "array",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "lockingStatus",
                "kind": "optional",
                "type": "string",
                "description": "",
                "modelRef": "#/components/schemas/com.amberflo.service.common.LockingStatus.out",
                "customType": "com.amberflo.service.common.LockingStatus.out",
                "schema": []
              },
              {
                "name": "lastUpdateTimeInMillis",
                "kind": "optional",
                "type": "integer<int64>",
                "example": 0
              }
            ],
            "modelRef": "#/components/schemas/payment.pricing.UsageTransformer.out",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "KzCYZG_ElHDL5QtXytIuR",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://app.amberflo.io/payments/pricing/amberflo/account-pricing/usage-transformer \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"dimensionsInterpolations\": {\n     \"type\": \"list_numeric_interpolation\"\n     }\n     }'"
        },
        {
          "id": "XX6DsIyzSgz_KAmDkn_MQ",
          "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   \"dimensionsInterpolations\": {\n      \"type\": \"list_numeric_interpolation\"\n   }\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/usage-transformer\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "P-rOQytF9FHigRasLi2LW",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/payments/pricing/amberflo/account-pricing/usage-transformer\")\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   \"dimensionsInterpolations\": {\n      \"type\": \"list_numeric_interpolation\"\n   }\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "BWPyjPhzjtvxEXa1AhUQp",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/payments/pricing/amberflo/account-pricing/usage-transformer\"\n\npayload = json.dumps({\n   \"dimensionsInterpolations\": {\n      \"type\": \"list_numeric_interpolation\"\n   }\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": "KzCYZG_ElHDL5QtXytIuR"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successful request\n{\n  \"id\": \"\",\n  \"name\": \"\",\n  \"transformUsageDimensionName\": \"\",\n  \"productItemId\": \"\",\n  \"dimensionsInterpolations\": {},\n  \"requiredDimensions\": [\n    \"\"\n  ],\n  \"lockingStatus\": \"\",\n  \"lastUpdateTimeInMillis\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}