Some search terms cost you money and never sell. This guide gets you a spreadsheet of those terms from the last 30 days, with the total you spent on them. When you are ready, the same script can add the clearest cases as negative keywords. A negative keyword tells Amazon to stop showing your ad for that search.
The first run changes nothing. Changes only happen when you add a flag.
What you need
- A Build account at build.sellermate.ai with the Amazon account connected.
- An API key from the Build console. A read-only key is enough for the audit. Adding negatives needs a key that can write, so create a second one and limit it to the single account you are cleaning up.
- Claude, ChatGPT or Cursor.
- Python 3 on your computer.
Steps
- Create the key in the console. Keys look like
sm_live_.... Save it asBUILD_API_KEY. - Paste the prompt below into your assistant.
- Read the code before you run it. It should be short, around fifty lines.
- Run the audit and open the spreadsheet.
- Adjust, run again, and only then think about applying.
The prompt
Read the API docs at https://www.sellermate.ai/api-docs first.
Write a single-file Python 3 script that finds wasted Amazon ad spend.
- Base URL is https://api.sellermate.ai/public/v1. Every tool is
POST /tools/{name} with a JSON body and an X-API-Key header.
- Read the key from BUILD_API_KEY. Never hard-code or print it.
- Call get_user_context first. Take an --account argument, and if it is
missing, list the accounts and stop.
- Call get_search_term_performance for the last 30 days. Use page_size
and keep going while pagination.hasMore is true.
- A term is wasted if it has at least 10 clicks and zero orders, or if
its ACoS is above 80 percent.
- Write wasted-terms.csv with campaign, ad group, search term, clicks,
spend, orders and ACoS. Print the total wasted spend.
- Add an --apply flag. Only with --apply, send the zero-order terms to
add_negative_keywords as exact-match negatives, in batches of 50.
Never negate terms that have orders.
- On a 429, wait for Retry-After and retry. On a 422, print the reason
and carry on.
- Show me the code before anything is run with --apply.
Check it
Run python wasted_spend.py --account <id>. Open the CSV and read the top twenty rows by spend. Ask yourself whether each term is one you would never want to pay for.
If the list is too short, lower the click threshold from 10 to 5. If it holds terms you care about, raise it. Run it as many times as you like. Nothing changes without --apply.
Apply the negatives
When you trust the list, run the same command with --apply. The script sends the zero-order terms in batches of 50.
Build checks every write before it reaches the marketplace. Budget caps and preview-before-apply rules still hold, and every change goes into an audit log. If a rule blocks a change, Build answers with a 422 error and the reason. Nothing is sent to Amazon. Your script should print the reason and move on.
Run it every week
Once the list looks right, schedule the audit part only. Post the CSV to a shared Slack channel and let a person decide what to apply. The Monday report guide shows how to post to Slack.
Watch out for
- High ACoS is not zero orders. A term with a few orders and a poor ACoS may be a keyword you defend on purpose. Review those by hand.
- The prompt asks for exact-match negatives. For broad-match campaigns, ask the assistant to use phrase match instead, chosen by each campaign's match type.
- In a scheduled job, always pass
--account. Never let the script pick the first account it finds. - Recent clicks may still receive sales for a few days. Leave out the last two or three days if you are unsure.
- Spend you can recover varies a lot by account. Look at your own total, not at anyone else's.