Using the (Unofficial) StockX API

Zach Lyons
5 min readFeb 11, 2019

--

StockX, the “Stock Market of Things” as the owners call it, was founded in 2015 as a platform for purchasing hard-to-find streetwear. The developers of the site have made a semi-public API for accessing the data behind their marketplace, as this data can provide a useful glimpse into the popularity and sales numbers of certain sneakers, handbags, and streetwear. However, you must request access to this API.

I requested access to the API last week, but unfortunately never heard back. A request from a single Information Science student must fall pretty low in their list of priorities. For that reason, I decided to turn my attention to the unofficial StockX API, called stockx-py-sdk. This third-party API is albeit limited in its capabilities, but it was useful for finding some interesting trends in the sneaker marketplace.

Methods

To access data from StockX through this API, you need to log in with a standard StockX account. This can be done using the .authenticate() function within the StockX package. The proper imports and usage of the function are shown in the image below:

If successful, it should return a “True” statement, and you should then have access to use the API from there on.

Retrieving data from this unofficial API has its limits, unfortunately. The API only allows you to search by style code or standard search queries such as “Air Jordan 11” or similar. However, when you use this .search() functionality, it limits you to a JSON object with only the top 20 search results. Combining data is a feasible alternative, but there is no option to get the “next 20” results from a specific search query.

Additionally, this data is not very usable in the plain-text JSON format shown above. Using the specific key-value pairs is viable for pulling out small snippets of data, but isn’t useful for getting a sense for the dataset as a whole. To this, I found it was best to create a new pandas dataframe containing this data.

Admittedly, this format probably isn’t the best way to work with the data either, as there are still some JSON objects contained within individual cells in the dataframe. However, to alleviate this issue, we can simply repeat the same process again on columns that still contain these JSON objects.

This gives us a smaller, much more functional dataframe that includes some key information. For example, we can use the above dataframe to see how the retail prices of the Air Jordan 11 model have changed over time.

Findings

Now that this data is in a more usable format, we can import visualization packages such as Altair to make some graphical sense of our data. From the dataset that I imported, I wanted to know what the most popular colorways of the Air Jordan 11 are on StockX, how much people are willing to pay for these on the secondary market, and how the retail price of the shoes has changed over time in the primary (retail) market.

To use Altair for data visualization, simply import the package and select two columns within the dataframe that you’d like to compare graphically, as shown above.

The image above shows the most popular colorways of the Air Jordan 11 all time on StockX, by colorway. The Jordan 11 in the “Concord” colorway is the most sold colorway of the shoe all-time on StockX, which is not surprising given the fact that they are one of the most beloved shoes of all time to Sneakerheads.

This chart gives us a glimpse of the most popular colorways of the shoe on StockX in the last 72 hours, and not surprisingly the “Concord” colorway is the leader again. The 2018 release of the “Concord” model came out just three months ago, so again this isn’t much of a surprise.

When using StockX, buyers submit bids that are essentially the highest price they are willing to pay for a shoe. Sellers that have the unworn shoe submit “asks”, which is the lowest price they are willing to sell for. When a bid and an ask match, a transaction is completed. The chart above shows the highest bid listed for each shoe as of Sunday night, which gives us an idea of how valuable a certain pair is to buyers. In this instance, the “Concord” 11s are actually not the leader like they were in the other charts. There is a much larger supply of “Concords” on the market compared to others on this list such as the “Triple Black” colorway. This would explain the lower monetary value of the “Concords” compared to other models.

Conclusions

This unofficial StockX API isn’t perfect, and it has a lot of very glaring gaps in functionality that limit its viability for data science. However, the search function can still give us an idea of what the market is for specific shoes on their marketplace. It can even give some broader takeaways on their entire shoe marketplace, provided you’re willing to go through the tedious process of building a dataset 20 rows at a time. I hope to get access to the official API soon, and potentially do a comparison article between the two.

--

--