INVENTORY_CHANGED

📘

Buy with Prime API is now available for early access

Sign up for early access to the Buy with Prime API using the 'Sign Up' button below. The API may change as Amazon receives feedback and iterates on it.

The INVENTORY_CHANGED event is sent when the available quantity for a Buy with Prime-eligible product changes. You can use inventory levels for your own reporting, such as for alarming when inventory reaches a low threshold.

The available number of products is a point in time calculation, with potential delays. To determine whether a shopper can order an item through Buy with Prime, we recommend that you determine inventory based on whether a call to the Delivery Preview interface succeeds instead. If you encounter an ItemAmountUnavailable error, the requested quantity isn't available. For example requests and responses, see Create a Delivery Preview for a Product Detail Page and Create a Delivery Preview for Checkout.

Required permission

To subscribe to this event, your API credentials must have at least Read Inventory permission. You choose permissions when you generate your API credentials. For details, see Authenticate to the Buy with Prime API.

Schema

{
  "version": "0", 
  "id": "example-event-id", 
  "detail-type": "INVENTORY_CHANGED", 
  "source": "aws.partner/buywithprime/partner-event-source-name",
  "account": "example-aws-account-id", 
  "time": "2023-10-27T12:34:56Z", 
  "region": "us-east-1", 
  "resources": [
    "businessProduct/business-product-id/item-quantities/item-id",
  ], 
  "detail": {}
}

Fields

KeyData TypeDescription
versionStringAmazon EventBridge event version.
idStringAmazon EventBridge-generated UUID for an event.
detail-typeStringType schema for the detail of the event, which in this case is PRODUCT_INVENTORY_CHANGED.
sourceStringName of the partner event source in Amazon EventBridge.
accountStringAWS account ID that hosts the partner event source.
timeStringISO 8601 timestamp that indicates when the event was published.
regionStringAWS region from which the event is published.
resourcesArray of stringsArray of identifiers for the resources that triggered the event, in key-value pair format. Each resource identifier is a string that starts with businessProduct/{businessProductId}/, followed by resource types (keys) and resource IDs (values) separated by slashes. For details about how to interpret resources, see How to process events.
detailObjectJSON object that contains details about the event. For this event, this object is empty; you must call the Buy with Prime API to find further information about the resource(s) specified in the resources array.

Handling the event

When you receive this event, parse the resources array of the event for the inventory item ID of the associated item. You can then use the inventoryItem query to find the available inventory and the SKU of the item.

In some cases, when you use the inventoryItem query you might receive the following error.

{
  "errors": [
    {
      "message": "Input request is not valid, the following issues were encountered: This item is not associated with a valid mSKU",
      "locations": [
        {
          "line": 2,
          "column": 23
        }
      ],
      "path": [
        "inventoryItem"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "InvalidAmazonSkuConfiguration" // or MissingAmazonSkuConfiguration
        }
      }
    }
  ]
}

This error means that Buy with Prime can't find the specified mSKU in Seller Central, so Buy with Prime can't retrieve the associated inventory quantities. A way to fix this error is to find the correct mSKU for the product on Seller Central, and then to upload a new catalog with the correct mSKU.

This error can have one of the following two error codes:

  • MissingAmazonSkuConfiguration: You didn't specify an mSKU for this product when you uploaded the catalog. To fix this issue, upload the catalog , this time specifying an mSKU for that product.
  • InvalidAmazonSkuConfiguration: The mSKU isn't valid, so Buy with Prime couldn't find the mSKU in Seller Central. In this case, check the mSKU that you used when you uploaded the catalog to Buy with Prime, and make sure that it matches the mSKU you find for that product in Seller Central.

Related topics