Before you start
- A Live, Test, Read-only or Storefront API key. A Connector key cannot read channels. See Authentication.
- A Storefront key limited to a list of channels reads only those channels.
- Test keys read the same published prices as Live keys.
List the channels
GET /v1/channels lists the channels the key can read, ordered by name. Each price list has a channel of kind price_list. A connected storefront has a channel of kind storefront.
id, name, kind, the currencies it has live prices in, and liveVersions: the currency, version and validFrom of each live price list version. Page with limit (1 to 100, default 50) and after. See Pagination.
Load a snapshot
GET /v1/channels/{channelId}/prices returns the live prices of a channel, one page at a time.
Page with
limit (1 to 1,000, default 500) and the nextCursor of the previous page as after. Add currency to read one currency. Later pages stay on the versions the first page read, so a version that goes live while you are paging does not mix into the snapshot.
Every page carries a snapshotCursor. Keep the one from the first page: it marks the point in the change feed where the snapshot was taken.
While a new version is being published, the first page answers 409 with channel_publishing and a Retry-After header. Wait for the number of seconds in the header and send the request again.
Follow the changes
GET /v1/channels/{channelId}/price-changes lists every price that was set or removed when a version of the channel went live, in order.
1
Start from the snapshot
Send the
snapshotCursor of your snapshot as after.2
Apply each change
A change with
change set to set carries the new price and priceId. A change set to removed means the item is no longer priced on the channel; its price and priceId are null.3
Keep the cursor
Store the
nextCursor of every page, including an empty page, and send it as after on the next call.sku, unit, quantityTier, currency, version, validFrom, validUntil and occurredAt. Page with limit (1 to 1,000, default 500). Add currency to read one currency.
Changes are kept for 30 days. A cursor older than that is refused with 400 and invalid_cursor; load a new snapshot and continue from its snapshotCursor.
Know when to read
Thechannel.published webhook event is sent when a version has gone live on a channel and its changes are ready to read. Treat the event as a signal and read the change feed for the content. The event is delivered in live mode. See Webhooks.
When a request is refused
Price requests
Price a customer’s lines at the moment of the request.
Webhooks
Receive
channel.published and every other event.