---
title: Create or update a promotion
slug: amberflo-api/mQET-create-or-update-a-promotion
docTags: 
createdAt: 2024-11-07T15:10:16.972Z
---

{
  "id": "tmjqUtUNGTUl6Mj6LkBDa",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/payments/pricing/amberflo/account-pricing/promotions/time_limited_tiered_absolute_item_discount",
    "servers": [
      {
        "url": "https://app.amberflo.io/payments/pricing/amberflo/account-pricing/promotions/time_limited_tiered_absolute_item_discount"
      }
    ],
    "name": "Create or update a promotion",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "payment.pricing.promotions.pre_created.TimeLimitedTieredAbsoluteProductItemDiscount.in",
          "schema": [
            {
              "name": "id",
              "kind": "required",
              "type": "string",
              "description": "Unique id for the promotion.",
              "example": ""
            },
            {
              "name": "type",
              "kind": "optional",
              "type": "string",
              "description": "Promotion type.",
              "example": "",
              "default": "time_limited_tiered_absolute_item_discount"
            },
            {
              "name": "promotionName",
              "kind": "required",
              "type": "string",
              "description": "Display name for the promotion.",
              "example": ""
            },
            {
              "name": "description",
              "kind": "optional",
              "type": "string",
              "example": ""
            },
            {
              "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": "targetProductItemId",
              "kind": "optional",
              "type": "string",
              "example": ""
            },
            {
              "name": "promotionTimeLimit",
              "kind": "optional",
              "type": "object",
              "description": "",
              "modelRef": "#/components/schemas/payment.pricing.promotions.attributes.HistoryRequirements.in",
              "customType": "payment.pricing.promotions.attributes.HistoryRequirements.in",
              "schema": [
                {
                  "name": "cycles",
                  "kind": "optional",
                  "type": "integer<int32>",
                  "example": 0
                },
                {
                  "name": "months",
                  "kind": "optional",
                  "type": "integer<int32>",
                  "example": 0
                }
              ]
            },
            {
              "name": "discountMap",
              "kind": "optional",
              "type": "map",
              "example": "",
              "customType": "map<string, number>",
              "schema": []
            },
            {
              "name": "totalMaxDiscount",
              "kind": "optional",
              "type": "number",
              "example": ""
            },
            {
              "name": "measure",
              "kind": "optional",
              "type": "object",
              "description": "",
              "modelRef": "#/components/schemas/payment.pricing.promotions.attributes.measure.Measure.in",
              "customType": "payment.pricing.promotions.attributes.measure.Measure.in",
              "schema": [],
              "complexType": "oneOf",
              "complexItems": [
                {
                  "name": "payment.pricing.promotions.attributes.measure.PerUnitBatch.in",
                  "description": "",
                  "modelRef": "#/components/schemas/payment.pricing.promotions.attributes.measure.PerUnitBatch.in",
                  "schema": [
                    {
                      "name": "type",
                      "kind": "optional",
                      "type": "string",
                      "example": "",
                      "default": "per_batch"
                    },
                    {
                      "name": "batchSize",
                      "kind": "optional",
                      "type": "integer<int64>",
                      "example": 0
                    }
                  ]
                },
                {
                  "name": "payment.pricing.promotions.attributes.measure.PerUnit.in",
                  "description": "",
                  "modelRef": "#/components/schemas/payment.pricing.promotions.attributes.measure.PerUnit.in",
                  "schema": [
                    {
                      "name": "type",
                      "kind": "optional",
                      "type": "string",
                      "example": "",
                      "default": "per_unit"
                    }
                  ]
                },
                {
                  "name": "payment.pricing.promotions.attributes.measure.TotalPrice.in",
                  "description": "",
                  "modelRef": "#/components/schemas/payment.pricing.promotions.attributes.measure.TotalPrice.in",
                  "schema": [
                    {
                      "name": "type",
                      "kind": "optional",
                      "type": "string",
                      "example": "",
                      "default": "total_price"
                    }
                  ]
                }
              ]
            },
            {
              "name": "dimensionConstraintMap",
              "kind": "optional",
              "type": "map",
              "example": "",
              "customType": "map<string, string>",
              "schema": []
            },
            {
              "name": "acrossBillingPeriods",
              "kind": "optional",
              "type": "boolean",
              "example": ""
            },
            {
              "name": "isRegEx",
              "kind": "optional",
              "type": "boolean",
              "description": "Determines whether to use regular expression matching for dimension values.",
              "example": ""
            }
          ],
          "modelRef": "#/components/schemas/payment.pricing.promotions.pre_created.TimeLimitedTieredAbsoluteProductItemDiscount.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.promotions.pre_created.TimeLimitedTieredAbsoluteProductItemDiscount.out",
            "schema": [
              {
                "name": "id",
                "kind": "required",
                "type": "string",
                "description": "Unique id for the promotion.",
                "example": ""
              },
              {
                "name": "type",
                "kind": "optional",
                "type": "string",
                "description": "Promotion type.",
                "example": "",
                "default": "time_limited_tiered_absolute_item_discount"
              },
              {
                "name": "promotionName",
                "kind": "required",
                "type": "string",
                "description": "Display name for the promotion.",
                "example": ""
              },
              {
                "name": "description",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "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>",
                "description": "Last update time, in [Unix time](https://en.wikipedia.org/wiki/Unix_time) (milliseconds).",
                "example": 0
              },
              {
                "name": "targetProductItemId",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "promotionTimeLimit",
                "kind": "optional",
                "type": "object",
                "description": "",
                "modelRef": "#/components/schemas/payment.pricing.promotions.attributes.HistoryRequirements.out",
                "customType": "payment.pricing.promotions.attributes.HistoryRequirements.out",
                "schema": [
                  {
                    "name": "cycles",
                    "kind": "optional",
                    "type": "integer<int32>",
                    "example": 0
                  },
                  {
                    "name": "months",
                    "kind": "optional",
                    "type": "integer<int32>",
                    "example": 0
                  }
                ]
              },
              {
                "name": "discountMap",
                "kind": "optional",
                "type": "map",
                "example": "",
                "customType": "map<string, number>",
                "schema": []
              },
              {
                "name": "totalMaxDiscount",
                "kind": "optional",
                "type": "number",
                "example": ""
              },
              {
                "name": "measure",
                "kind": "optional",
                "type": "object",
                "description": "",
                "modelRef": "#/components/schemas/payment.pricing.promotions.attributes.measure.Measure.out",
                "customType": "payment.pricing.promotions.attributes.measure.Measure.out",
                "schema": [],
                "complexType": "oneOf",
                "complexItems": [
                  {
                    "name": "payment.pricing.promotions.attributes.measure.PerUnitBatch.out",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.pricing.promotions.attributes.measure.PerUnitBatch.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string",
                        "example": "",
                        "default": "per_batch"
                      },
                      {
                        "name": "batchSize",
                        "kind": "optional",
                        "type": "integer<int64>",
                        "example": 0
                      }
                    ]
                  },
                  {
                    "name": "payment.pricing.promotions.attributes.measure.PerUnit.out",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.pricing.promotions.attributes.measure.PerUnit.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string",
                        "example": "",
                        "default": "per_unit"
                      }
                    ]
                  },
                  {
                    "name": "payment.pricing.promotions.attributes.measure.TotalPrice.out",
                    "description": "",
                    "modelRef": "#/components/schemas/payment.pricing.promotions.attributes.measure.TotalPrice.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string",
                        "example": "",
                        "default": "total_price"
                      }
                    ]
                  }
                ]
              },
              {
                "name": "dimensionConstraintMap",
                "kind": "optional",
                "type": "map",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "acrossBillingPeriods",
                "kind": "optional",
                "type": "boolean",
                "example": ""
              },
              {
                "name": "isRegEx",
                "kind": "optional",
                "type": "boolean",
                "description": "Determines whether to use regular expression matching for dimension values.",
                "example": ""
              }
            ],
            "modelRef": "#/components/schemas/payment.pricing.promotions.pre_created.TimeLimitedTieredAbsoluteProductItemDiscount.out",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "0dp6QENM7Qp2S_DT-epIL",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://app.amberflo.io/payments/pricing/amberflo/account-pricing/promotions/time_limited_tiered_absolute_item_discount \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"id\": \"\",\n     \"type\": \"time_limited_tiered_absolute_item_discount\",\n     \"promotionName\": \"\",\n     \"measure\": {\n     \"type\": \"per_batch\"\n     }\n     }'"
        },
        {
          "id": "hKqlBdHMvoHyoyvKnf552",
          "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   \"type\": \"time_limited_tiered_absolute_item_discount\",\n   \"promotionName\": \"\",\n   \"measure\": {\n      \"type\": \"per_batch\"\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/promotions/time_limited_tiered_absolute_item_discount\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "rKpLMwQlOGIMkLUcPE3TZ",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/payments/pricing/amberflo/account-pricing/promotions/time_limited_tiered_absolute_item_discount\")\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   \"type\": \"time_limited_tiered_absolute_item_discount\",\n   \"promotionName\": \"\",\n   \"measure\": {\n      \"type\": \"per_batch\"\n   }\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "-t2ESgJ63hxLpGptlH-ZF",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/payments/pricing/amberflo/account-pricing/promotions/time_limited_tiered_absolute_item_discount\"\n\npayload = json.dumps({\n   \"id\": \"\",\n   \"type\": \"time_limited_tiered_absolute_item_discount\",\n   \"promotionName\": \"\",\n   \"measure\": {\n      \"type\": \"per_batch\"\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": "0dp6QENM7Qp2S_DT-epIL"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successful request\n{\n  \"id\": \"\",\n  \"type\": \"\",\n  \"promotionName\": \"\",\n  \"description\": \"\",\n  \"lockingStatus\": \"\",\n  \"lastUpdateTimeInMillis\": \"\",\n  \"targetProductItemId\": \"\",\n  \"promotionTimeLimit\": {\n    \"cycles\": \"\",\n    \"months\": \"\"\n  },\n  \"discountMap\": \"\",\n  \"totalMaxDiscount\": 0,\n  \"measure\": {},\n  \"dimensionConstraintMap\": \"\",\n  \"acrossBillingPeriods\": false,\n  \"isRegEx\": false\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}