Manage automated pricing rules with SP-API

Learn how to manage automated pricing rules programmatically.

This tutorial explains how to manage the Automate Pricing tool using the Product Type Definitions API and the Listings Items API. Selling partners can use automated pricing rules to dynamically adjust the product prices based on various market conditions and strategies. This workflow helps you implement automated pricing capabilities for your selling partners.

By using the API to manage automated pricing, you eliminate the need for manual SKU-to-rule association in Seller Central. After you associate the SKU to a rule by using the Listings API, Amazon executes the selected pricing strategy 24 hours a day (featured offers, lowest prices, external prices, sales-based rules, or custom rules).

📘

Note

The Amazon automate pricing feature available through SP-API does not support B2B rules.

Prerequisites

To complete this tutorial, you must have:

Workflow

The following diagram provides an overview of the pricing rules workflow steps.

Automate pricing rules workflow.

Step 1. Retrieve available pricing rules

📘

Note

To create custom pricing rules in Seller Central, refer to Create a Pricing Rule.

To retrieve the available pricing rules for the seller, call the getDefinitionsProductType operation from the Product Type Definitions API.

GET https://sellingpartnerapi-na.amazon.com/definitions/2020-09-01/productTypes/:productType?sellerId={{SellerID}}&productTypeVersion=LATEST&requirements=LISTING&requirementsEnforced=ENFORCED&marketplaceIds={{marketplaceId}}

The response includes the schema parameter, which contains a link to the JSON schema for the product type definition where the automated_pricing_merchandising_rule_plan attribute displays the available pricing rules.

{
    "metaSchema":{
      "link":{
        "resource":"https://selling-partner-definitions-prod-iad.s3.amazonaws.com/schema/amazon-product-type-definition-meta-schema-v1.json/....... ",
        "verb":"GET"
      },
      "checksum":"rZ/2Yep0np022S38ZdEiNQ=="
    },
    "schema":{
      "link":{
        "resource":"https://selling-partner-definitions-prod-iad.s3.amazonaws.com/schema/PRODUCT.json/........",
        "verb":"GET"
      },
      "checksum":"Hi42HJFOEDKOSFYO9SSje+Ibq5Xg=="
    }
}

You can retrieve the full schema containing attributes for the requested product type from the schema resource URL. Review the automated_pricing_merchandising_rule_plan array properties to fetch the enum and enumNames values available in the Seller Central dashboard.

The automated_pricing_merchandising_rule_plan attribute contains the following values:

  • enum: The pricing rule keys.
  • enumNames: The Seller Central pricing rule values.
IndexenumenumNames
0328182282407-COMPETITIVE_BUYBOXCompetitive price rule by Amazon
1328230445807-CROSSBORDER_PRICINGGlobal selling price rule by Amazon
27287d6de-4230-4106-bfd4-fe315b2af89aCustom test rule
"automated_pricing_merchandising_rule_plan": 
{
    "type": "array",
    "minItems": 1,
    "items": {
        "type": "object",
        "required": [],
        "properties": {
        "merchandising_rule": {
            "type": "object",
            "required": [
            "rule_id"
            ],
            "properties": {
            "rule_id": {
                "title": "Pricing Rule",
                "description": "The pricing rule that will automate price on this offer",
                "editable": true,
                "hidden": false,
                "examples": [
                "Competitive Price Rule by Amazon"
                ],
                "type": "string",
                "enum": [
                "328182282407-COMPETITIVE_BUYBOX",
                "328230445807-CROSSBORDER_PRICING",
                "7287d6de-4230-4106-bfd4-fe315b2af89a"
                ],
                "enumNames": [
                "Competitive Price Rule by Amazon",
                "Global Selling Price Rule by Amazon",
                "Custom test rule"
                ]
            }
            },
            "additionalProperties": false
        }
        },
        "additionalProperties": false
    }
}.....

Step 2. Assign pricing rule and set minimum/maximum price guardrails

To safely associate a SKU with a pricing rule, you must set price guardrails by using the PATCH operation. You can set thresholds for the pricing rule on that SKU with the minimum_seller_allowed_price and maximum_seller_allowed_price attributes. You can only associate each SKU with one pricing rule at a time. You can assign the rules retrieved from previous step using the automated_pricing_merchandising_rule_plan. You can enroll SKU into rules and set maximum and minimum prices using the same PATCH operation.

PATCH https://sellingpartnerapi-na.amazon.com/listings/2021-08-01/items/:sellerId/:sku?marketplaceIds={{marketplace}}
{
    "productType": "PRODUCT",
    "patches": [
        {
            "op": "replace",
            "path": "/attributes/purchasable_offer",
            "value": [
                {
                    "currency": "USD",
                    "audience": "ALL",
                    "marketplace_id": "ATVPDKIKX0DER",
                    "minimum_seller_allowed_price": [
                        {
                            "schedule": [
                                {
                                    "value_with_tax": 70
                                }
                            ]
                        }
                    ],
                    "maximum_seller_allowed_price": [
                        {
                            "schedule": [
                                {
                                    "value_with_tax": 130
                                }
                            ]
                        }
                    ],
                    "automated_pricing_merchandising_rule_plan": [
                        {
                            "merchandising_rule": {
                                "rule_id": "328182282407-COMPETITIVE_BUYBOX"
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

A successful response looks like:

{
    "sku": "{sku}",
    "status": "ACCEPTED",
    "submissionId": "{submissionId}",
    "issues": []
}

Step 3. Verify rule changes

After any rule changes (enrollment, removal, or switching), verify the current state using the getListingsItem operation. Rule changes are asynchronous after a successful API response.

GET https://sellingpartnerapi-na.amazon.com/listings/2021-08-01/items/:sellerId/:sku?marketplaceIds={{marketplace}}&includedData=attributes,offers

The following example response shows active rule association:

{
    "sku": "{sku}",
    "attributes": {
      "purchasable_offer": [
        {
          "currency": "USD",
          "audience": "ALL",
          "our_price": [
            {
              "schedule": [
                {
                  "value_with_tax": 100
                }
              ]
            }
          ],
          "maximum_seller_allowed_price": [
            {
              "schedule": [
                {
                  "value_with_tax": 80
                }
              ]
            }
          ],
          "automated_pricing_merchandising_rule_plan": [
            {
              "merchandising_rule": {
                "rule_id": "328182282407-COMPETITIVE_BUYBOX"
              }
            }
          ],
          "marketplace_id": "ATVPDKIKX0DER"
        }
      ]
    }
  }

Step 4. Switch between pricing rules

📘

Note

When switching rules, there is no need to remove the previous rule first.

To switch a SKU from one pricing rule to another, update the rule_id value:

PATCH https://sellingpartnerapi-na.amazon.com/listings/2021-08-01/items/:sellerId/:sku?marketplaceIds={{marketplace}}
{
    "productType": "PRODUCT",
    "patches": [
      {
        "op": "replace",
        "path": "/attributes/purchasable_offer",
        "value": [
          {
            "audience": "ALL",
            "marketplace_id": "ATVPDKIKX0DER",
            "currency": "USD",
            "automated_pricing_merchandising_rule_plan": [
              {
                "merchandising_rule": {
                  "rule_id": "328230445807-CROSSBORDER_PRICING"
                }
              }
            ]
          }
        ]
      }
    ] }

Step 5. Remove a pricing rule

To remove a SKU from automated pricing, send an empty array for the automated_pricing_merchandising_rule_plan:

PATCH https://sellingpartnerapi-na.amazon.com/listings/2021-08-01/items/:sellerId/:sku?marketplaceIds={{marketplace}}
{
    "productType": "PRODUCT",
    "patches": [
        {
            "op": "replace",
            "path": "/attributes/purchasable_offer",
            "value": [
                {
                    "audience": "ALL",
                    "marketplace_id": "ATVPDKIKX0DER",
                    "currency": "USD",
                    "automated_pricing_merchandising_rule_plan": []
                }
            ]
        }
    ]
}

📘

Note

You cannot verify the SKU enrollments when you use the getListingsItem operation in Seller Central.

JSON_LISTINGS_FEED SKU enrollment

{
    "header": {
        "issueLocale": "en_US",
        "sellerId": "AMY6FKRUBY7XV",
        "version": "2.0"
    },
    "messages": [
        {
            "messageId": 1,
            "operationType": "PATCH",
            "patches": [
                {
                    "op": "replace",
                    "path": "/attributes/purchasable_offer",
                    "value": [
                        {
                            "audience": "ALL",
                            "automated_pricing_merchandising_rule_plan": [
                                {
                                    "merchandising_rule": {
                                        "rule_id": "328182282407-COMPETITIVE_BUYBOX"
                                    }
                                }
                            ],
                            "currency": "USD",
                            "marketplace_id": "ATVPDKIKX0DER",
                            "maximum_seller_allowed_price": [
                                {
                                    "schedule": [
                                        {
                                            "value_with_tax": 200
                                        }
                                    ]
                                }
                            ],
                            "minimum_seller_allowed_price": [
                                {
                                    "schedule": [
                                        {
                                            "value_with_tax": 40
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ],
            "productType": "PRODUCT",
            "sku": "Test"
        } ] }

OSZAR »