How to Get Live Amazon Price Updates: Using the Keepa API
The Keepa API is the go-to place for programmatic access to Amazon price data. Keepa also has a chrome extension which is the primary way people interact with this product––to get notifications in price changes on items being sold on Amazon.
However, with programming skill one can automatically get the results from the API directly — which enables bulk data collection and has a number of applications for Amazon sellers.
In this article, I will describe how I built a simple Google sheets application to track 3 key parameters: number of offers, current price and Buy Box price.
In the screenshot below, a visual details key pricing data on any Amazon product page:
Each Amazon seller is trying to be the lowest priced seller in order to win the “buy box.”
People go on Amazon.com and they know they can get the lowest priced item. How? Amazon has built a sophisticated marketplace of sellers for items: you have Amazon items sold by Amazon itself (also called fulfilled by Amazon or FBA), third party sellers, and many other features that increase competition and drive down price.
The Keepa API is one such place that records all of this data and makes it accessible to track prices across a variety of metrics.
Keepa UI
One can visit the following link to see the types of price history data that Keepa records: https://keepa.com/#!product/1-B087YLB36N
The screenshot above shows how the price of Star Wars toy has fluxtuated between $35 and $65––a significant variation in price over a 3 month period.
For this product, the Amazon Standard Identification Number or ASIN is B087YLB36N––this is used as a paremeter in the call to the Keepa API.
Constructing a Request:
Once a Google sheet is open and reading an ASIN value, that value can be dynamically piped into a request to the Keepa API endpoint.
var url'https://api.keepa.com/product?key=189381839j&domain=1&stats=30&offers=20&asin='
var response = UrlFetchApp.fetch(url + asin);
The key parameters in the URL request are the stats parameter and the offers parameter which will be discussed in more detail below.
Stats
Current Price
The “stats” object returns an object which has a lot of price history information about the ASIN or item in question.
One can get a list of the current price by calling the ‘current’ key in the stats object array. Here is an example:
current price [ -1, 5300, -1, 69474, -1, 5599, -1, 5300, -1, -1, 5990, 5, -1, -1, 1, 6, 48, 2756, 5990, -1, -1, -1, -1, 5599, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ]
The second item in the array is 5300 which represents the most recent price in cents. We can parse that out and divide by 100 to give us a price of $53.
A -1 price means there is no data available. We see that price fluctuates drom $53 up to $59.90. The implication is that the price of this Star Wars kit is never static––which drives competition among sellers.
Below is a redacted table of the rest of the values returned by the Stats object.
avg: [],
avg30: [],
avg90: [],
avg180: [],
avg365: [],
atIntervalStart: [],
min: [ ],
max: [ ],
minInInterval: [ ],
maxInInterval: [ ],
outOfStockPercentageInInterval: [ ],
outOfStockPercentage90: [ ],
outOfStockPercentage30: [ ],
retrievedOfferCount: 8,
totalOfferCount: 8,
tradeInPrice: -1,
lastOffersUpdate: 6419382,
isAddonItem: false,
lightningDealInfo: [ 6193860, 6196736 ],
sellerIdsLowestFBA: [ 'AIVKACMMRCAKP' ],
sellerIdsLowestFBM: [ 'A2BW4ECWNBDITU', 'A37EBP4N9CPAVB' ],
offerCountFBA: 1,
offerCountFBM: 6,
salesRankDrops30: 95,
salesRankDrops90: 253,
salesRankDrops180: 541,
salesRankDrops365: 1127,
As you can see, there is a record of the price of the object with detailed metrics meticulously kept (I scrubbed them for readability).
Offers
The offers object is the most detailed item in the whole API response. As you can see there is a 2d array with the second dimension has upto 22 items returned in the response.
Every bit of information about offers to sell this product included shipping price, number of reviews, new, and used product prices. In order to get this data, one would have to parse it out from the array and verify that it is being properly recorded (values that are not being tracked return a -1 value).
Buy Box Information
The buy box is the holy grail of the Amazon seller. The BuyBox seller has a guaranteed sale as shoppers looking to buy immediately will buy from this seller. There is competition for this spot. Amazon and Keepa by extension keeps meticulous record of the sellerId of this person as well as how the BuyBox seller can ship the item.
buyBoxPrice: 5300,
buyBoxShipping: 0,
buyBoxIsUnqualified: false,
buyBoxIsShippable: true,
buyBoxIsPreorder: false,
buyBoxIsFBA: false,
buyBoxIsAmazon: false,
buyBoxIsMAP: false,
buyBoxIsUsed: false,
buyBoxIsBackorder: false,
buyBoxIsPrimeExclusive: false,
buyBoxIsFreeShippingEligible: false,
buyBoxIsPrimePantry: false,
buyBoxIsPrimeEligible: false,
buyBoxMinOrderQuantity: 1,
buyBoxMaxOrderQuantity: 0,
buyBoxCondition: 1,
buyBoxAvailabilityMessage: 'In stock. Usually ships within 4 to 5 days.',
buyBoxShippingCountry: 'US',
buyBoxSellerId: 'A2BW4ECWNBDITU',
buyBoxIsWarehouseDeal: false,
Application Output
As the output shows, we are able to get the data back in real-time with the click of a button. Additional context that would help here would be the Product Names for the ASINs (the reader may be confused about what the ASINs represent).
It is interesting to see which products have the highest number of offers which would be a measure of their profitability or easiness to sell. Also it is worth investigating the differnce between the Current New Price and the Buy Box Price.
Significance of this API
If you have ideas of how to build interesting projects with this data, please get in touch. You can also take a look at my Upwork page where I have done this project and see my feedback: https://www.upwork.com/services/product/development-it-google-sheet-that-connects-to-the-keepa-api-1435016328773017600