Loading…
Loading…
about 45 minutes of your work, plus Amazon's review waits: developer registration for the Seller data and API access for the Ads dataNo experience assumed: the guide starts at "install Python".
Using an AI assistant? Let it do the busywork.
Claude Code, Cursor, Copilot: paste this prompt and your own AI handles the installing, checking and scheduling, on your machine. You keep the key steps.
The prompt forbids your assistant from asking for keys in chat, and from ever touching the push side: you create credentials yourself, and changes always need your typed YES.
This guide covers both Amazon toolkits in one go: the amazon folder (the Seller toolkit, for listings, orders, finances, FBA stock and daily sales) and the amazon-ads folder (the Ads toolkit, for campaigns, keywords, search terms and day-by-day ad performance). If they arrived as a zip file, unzip it first: right-click the zip and choose Extract All on Windows, or double-click it on Mac. Put both folders somewhere you can find them back, for example in your Documents. Both toolkits are read-only: they pull your data but can never change anything on your Amazon account.
Optional, for the Seller toolkit: create a plain text file named extra-asins.txt next to the pull script, one ASIN per line, and the script also pulls per-ASIN data for those products, even when they are missing from your live listings. Without that file everything still works.
Both toolkits run on Python, a free program from python.org. Version 3.9 or newer works; the latest is fine.
Check it worked
python --versionIf the computer says python is not recognized, Python is not on your PATH. Reinstall from python.org and tick Add python.exe to PATH on Windows, or type python3 instead on Mac.
All commands in this guide are typed in a terminal window that is standing in the toolkit folder you are working on. Opening one is easier than it sounds.
Install the helper package
pip install -r requirements.txtSeeing ModuleNotFoundError: requests later on means this install was skipped in that folder. Run it again there and you are set.
Amazon does not hand out simple API keys. Instead you create your own small private app inside Seller Central once, and that app's codes are your keys. Before you can create it, Seller Central asks you to register as a developer, and Amazon reviews that request. Start this today so the wait runs in the background.
You cannot create the app until this review is approved, so send the registration in early.
The Ads toolkit has its own separate approval wait at advertising.amazon.com (a later step in this guide). Feel free to jump ahead and submit that application now too, so both waits run at the same time.
Once your developer registration is approved, the app itself is a one-time click-through. It sounds bigger than it is.
The Client Secret and the refresh token are each shown only once. Store all four values in your password manager right away.
Lost a value? No drama: re-open View for the Client ID and Secret, or run Authorize again for a fresh refresh token. Good to know: if you ever change the app's roles, Amazon issues a new refresh token and the old one stops working, so update your .env after any role change.
The .env file is where the scripts read your keys from. It stays on your own computer.
Test it, in a terminal in the amazon folder
python verify_auth.pyThe file must be named exactly .env. If the test says a value is missing or still the example value, the file was not filled in, not saved, or not named exactly right. Seeing invalid_grant? Run the Authorize step again and paste the new refresh token. Seeing invalid_client? Re-copy the Client ID and Secret from Seller Central.
Start with a smoke run, a short test with a small bite of data, then do the full pull.
Short test run first
python pull_amazon_sp.py --smokeThen the full pull
python pull_amazon_sp.pyRan it twice on the same day? The script says Fresh data already exists and stops. That is intentional; add --force to pull again anyway.
The Ads toolkit needs three values of its own: a Client ID, a Client Secret and a refresh token. Getting them is a one-time job with a waiting step in the middle.
The number-one wrong-key trap: the Ads Client ID and Secret come from developer.amazon.com (Login with Amazon), not from Seller Central. And the merchant or seller token from Seller Central is not used anywhere in the Ads toolkit.
Lost or leaked the secret? Just reset it on that same Web Settings page and fill it in again. You will then also need a fresh refresh token from the next step.
After your API access is approved, a small helper script walks you through Amazon's consent screen and prints your refresh token.
Run in a terminal in the amazon-ads folder
python get_refresh_token.pyDo the consent while logged in as the Amazon account that runs the ads. Consent done with another login leads to errors or zero profiles later.
If the browser reports it cannot reach the page after you click Allow (a firewall blocking the local listener), use the script's fallback: copy the full address of the page you landed on and paste it into the script. It reads the code from that address.
Same routine as the Seller toolkit, now in the amazon-ads folder.
Test it, in a terminal in the amazon-ads folder
python verify_auth.pyThe most likely failure is a line containing invalid_grant: the refresh token is expired, revoked or pasted wrong. Run get_refresh_token.py again for a fresh one and update .env. A FAILED line that names a .env value means exactly that: open .env and fill in the named value.
Amazon keeps roughly 95 days of report history. Catch all of it once with the backfill command, then use the plain command for every pull after that.
First run: catch all available history
python pull_amazon_ads.py --backfill 95Every run after that
python pull_amazon_ads.pyThe script pulls once per day and politely refuses a second run on the same day. Want to re-pull anyway? Add --force.
Both toolkits are read-only, so they are safe to schedule. Set up one daily task per toolkit.
Give the Seller task room: a full run can take up to 90 minutes. An accidental double schedule costs nothing; the built-in freshness check makes the second run stop by itself.
Where your CSVs land. Every run writes dated CSV files into the output folder inside each toolkit folder, right next to the pull script. The Seller toolkit and the Ads toolkit each fill their own output folder. Those are the files you open in Excel or drop into Toqool Local.
Stuck on any step? Mail us at support@toqool.com and a founder answers.