Scraping the Kroger API
If you’re interested in data scraping Kroger stores for product details, pricing, inventory, images & more, then the Official Kroger API makes it very easy to legally scrape this data from Kroger without an unreliable and illegal screen or web scraper.
We’ll outline how to access the Kroger API and scrape product data from them using our no-code platform as a safer alternative to web scraping.
1. Kroger API Key
You’ll need to create a free Kroger Developer account to get an API key. You can check out their Getting Started Guide for more information on how to create your application.
After creating your account, you can manage and create your Kroger apps in the Developer App Manager. See below for the suggested settings you’ll want to use when registering your app to access public data from Kroger:
Once your application is live, you’ll then need to generate an Access Token using the Client ID & Client Secret that Kroger provides. Be sure to save the secret in a safe place, as they only show it to you once.
The Getting Started Guide contains instructions for how to get your API Access Token, but you can just follow the sample CURL command below:
curl -X POST 'https://api.kroger.com/v1/connect/oauth2/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Basic a2Krex.....hEaGw=' \
-d 'grant_type=client_credentials&scope=product.compact'
In the above CURL command, you will replace a2Krex.....hEaGw=
(right after Basic
and before the '
) with the output from a Base64 Encoder (where you enter your CLIENT_ID:CLIENT_SECRET
) and execute that on your local computer’s command line. The output will look like this:
{"expires_in":1800,"access_token":"fuMqr...jtrEF","token_type":"bearer"}
You’ll want to copy the value under the access_token
, e.g. fuMqr...jtrEF
in the above example. This will be your “Accesss Token” you can use with our API endpoints on this page or to query the Kroger API directly.
2. Query the Kroger API
If you have an account with our service, this page will show links in the “Endpoints” section you can use to query the Kroger API with your Access Token and quickly download the results as CSV files. Below is a sample query we can make to scrape products matching a search term that are available in-store at a specific location:
You can of course tweak or omit some of the parameters if you don’t care about a specific store for example. Feel free to get creative and try things out!
3. Download Product Data
The response page will automatically parse out the JSON response from the Kroger API and allow you to download the data to CSV & Excel files in just one click:
You’ll get back interesting fields such as:
- Kroger Product ID
- UPC
- Brand
- Country Origin
- Description
- Item Dimensions
- Category
- Size
- Price
- Fulfillment Options
If you need to bulk scrape this data (e.g. download all the pages of results) or run a large search for combinations of products & stores, please check out our Kroger Price & Inventory - Multiple Stores & SKUs Workflow, which will automatically query the Kroger API on your behalf and combine the results into a single downloadable file.