Skip to content

Fix batch pricing API: flatten queryParams to top-level properties (Amazon API contract change 2026-04-23)#929

Merged
abuzuhri merged 1 commit into
abuzuhri:mainfrom
lboyarsky:fix/batch-pricing-queryparams-flattening
Apr 25, 2026
Merged

Fix batch pricing API: flatten queryParams to top-level properties (Amazon API contract change 2026-04-23)#929
abuzuhri merged 1 commit into
abuzuhri:mainfrom
lboyarsky:fix/batch-pricing-queryparams-flattening

Conversation

@lboyarsky

Copy link
Copy Markdown
Contributor

Problem

Starting 2026-04-23, all calls to the batch pricing endpoints began failing with HTTP 400:

Requested MarketplaceId is invalid, unsupported, or does not exist.

The affected endpoints are:

  • POST /batches/products/pricing/v0/itemOffers
  • POST /batches/products/pricing/v0/listingOffers

Amazon changed their API contract to require query parameters to be serialized at the top level of each individual request object, rather than nested under a queryParams key.

Previously accepted (now broken)

{
  "uri": "/products/pricing/v0/items/B0001/offers",
  "method": "GET",
  "queryParams": {
    "MarketplaceId": "ATVPDKIKX0DER",
    "ItemCondition": "New",
    "CustomerType": "Consumer"
  }
}

Now required

{
  "uri": "/products/pricing/v0/items/B0001/offers",
  "method": "GET",
  "MarketplaceId": "ATVPDKIKX0DER",
  "ItemCondition": "New",
  "CustomerType": "Consumer"
}

Fix

Marked QueryParams as [JsonIgnore] in both ItemOffersRequest and ListingOffersRequest, and added MarketplaceId, ItemCondition, and CustomerType as direct [JsonProperty] computed properties that delegate to the existing QueryParams object.

This is a non-breaking change — the public API surface (QueryParams property, all parameter classes) is unchanged. Only the JSON wire format is affected.

Amazon changed their SP-API batch pricing endpoints contract on 2026-04-23.
The previously accepted nested queryParams format now returns HTTP 400:
  Requested MarketplaceId is invalid, unsupported, or does not exist.

The endpoints affected are:
  POST /batches/products/pricing/v0/itemOffers
  POST /batches/products/pricing/v0/listingOffers

Previously accepted (now broken):
  { uri: ..., method: GET, queryParams: { MarketplaceId: ATVPDKIKX0DER, ... } }

Now required (flat top-level):
  { uri: ..., method: GET, MarketplaceId: ATVPDKIKX0DER, ... }

Fix: mark QueryParams as [JsonIgnore] in both ItemOffersRequest and
ListingOffersRequest, and expose MarketplaceId, ItemCondition, CustomerType
as direct [JsonProperty] computed properties delegating to QueryParams.
This preserves the existing public API surface while correcting the wire format.
@lboyarsky lboyarsky marked this pull request as ready for review April 24, 2026 02:57
@sonarqubecloud

Copy link
Copy Markdown

@FelidaePanthera

Copy link
Copy Markdown

Thanks for fixing this.

We're using the NuGet package, so can you update it there, too, please?

Thanks

@abuzuhri abuzuhri merged commit b8715d5 into abuzuhri:main Apr 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants