Skip to main content
RapidDev - Software Development Agency

How to Automate Amazon Ads Using the API

Use the Amazon Ads API to automate Sponsored Products management. Pull daily performance reports via the async /v2/sp/reports endpoint, calculate ACOS per keyword, adjust bids via PUT /v2/sp/keywords, and pause campaigns below your ROAS threshold. The Ads API is separate from SP-API and requires its own LWA app registration.

Need help automating? Talk to an expert
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Advanced6 min read60–90 minutesAmazonLast updated May 2026RapidDev Engineering Team
TL;DR

Use the Amazon Ads API to automate Sponsored Products management. Pull daily performance reports via the async /v2/sp/reports endpoint, calculate ACOS per keyword, adjust bids via PUT /v2/sp/keywords, and pause campaigns below your ROAS threshold. The Ads API is separate from SP-API and requires its own LWA app registration.

Quick facts about this guide
FactValue
PlatformAmazon
Auth methodLWA OAuth 2.0 — separate app registration from SP-API
Rate limitsVaries by endpoint and advertiser; report generation is async, not rate-limited
DifficultyAdvanced
Time required60–90 minutes
Last updatedMay 2026

API Quick Reference

Auth

LWA OAuth 2.0 — separate app registration from SP-API

Rate limit

Varies by endpoint and advertiser; report generation is async, not rate-limited

Format

JSON

SDK

REST only

API overview

Base URLhttps://advertising.amazon.com/API/

Authentication

The Amazon Ads API requires a separate LWA app registration from your SP-API app. You need a dedicated client_id and client_secret from the Amazon Ads console (advertising.amazon.com). Every request requires two headers: Authorization: Bearer {access_token} AND Amazon-Advertising-API-ClientId: {client_id}. Access tokens are the same LWA tokens (1-hour TTL) but scoped to advertising permissions.

Key endpoints

GET/v2/sp/campaigns

Returns all Sponsored Products campaigns with their state, budget, and targeting type. Use stateFilter=enabled to get only active campaigns.

ParameterTypeRequiredDescription
optional
optional
optional
PUT/v2/sp/campaigns

Updates campaign state or daily budget. Pass an array of campaign objects with just the fields to update. Returns a list with success/error per campaign.

ParameterTypeRequiredDescription
optional
PUT/v2/sp/keywords

Updates keyword bids or state in bulk. Pass an array of keyword objects. Keyword bid changes take effect within 15–30 minutes.

ParameterTypeRequiredDescription
optional
POST/v2/sp/keywords/report

Requests an async keyword performance report. Returns a reportId to poll for completion. Report includes impressions, clicks, spend, sales, ACOS per keyword.

ParameterTypeRequiredDescription
optional
optional
optional

Step-by-step automation

1

Set Up Ads API Auth and Get Profile ID

The Ads API requires its own app credentials separate from SP-API. After authentication, call /v2/profiles to get the profile_id (advertising account ID) required on every subsequent request.

request.sh
1# Get LWA access token for Ads API (same endpoint, different credentials)
2curl -X POST https://api.amazon.com/auth/o2/token \
3 -H "Content-Type: application/x-www-form-urlencoded" \
4 -d "grant_type=refresh_token&client_id=$ADS_CLIENT_ID&client_secret=$ADS_CLIENT_SECRET&refresh_token=$ADS_REFRESH_TOKEN"
5
6# Get your advertising profile ID
7curl -X GET https://advertising.amazon.com/API/v2/profiles \
8 -H "Authorization: Bearer $ADS_ACCESS_TOKEN" \
9 -H "Amazon-Advertising-API-ClientId: $ADS_CLIENT_ID"
2

Request and Download a Keyword Performance Report

Report generation is asynchronous. Request the report, poll the reportId until status=SUCCESS, then download the gzipped JSON file. Reports for the current day are available after ~3 hours UTC.

request.sh
1# Request keyword report for yesterday
2curl -X POST "https://advertising.amazon.com/API/v2/sp/keywords/report" \
3 -H "Authorization: Bearer $ADS_ACCESS_TOKEN" \
4 -H "Amazon-Advertising-API-ClientId: $ADS_CLIENT_ID" \
5 -H "Amazon-Advertising-API-Scope: $ADS_PROFILE_ID" \
6 -H "Content-Type: application/json" \
7 -d '{"reportDate": "20260521", "metrics": "impressions,clicks,spend,sales7d,acos7d,roas7d,orders7d"}'
8
9# Poll for completion
10curl -X GET "https://advertising.amazon.com/API/v2/reports/$REPORT_ID" \
11 -H "Authorization: Bearer $ADS_ACCESS_TOKEN" \
12 -H "Amazon-Advertising-API-ClientId: $ADS_CLIENT_ID" \
13 -H "Amazon-Advertising-API-Scope: $ADS_PROFILE_ID"
3

Calculate ACOS and Identify Under/Overperforming Keywords

Parse the report to calculate per-keyword ACOS (Advertising Cost of Sale = spend/sales). Keywords above your target ACOS threshold should have bids reduced. Keywords with zero sales and significant spend should be paused.

request.sh
1# No direct curl equivalent this is data analysis logic
4

Apply Bid Changes and Pause Underperformers

Use PUT /v2/sp/keywords to apply bid changes in bulk. Amazon accepts up to 1,000 keyword updates per request. For pausing campaigns, use PUT /v2/sp/campaigns to set state=paused.

request.sh
1# Update keyword bids in bulk
2curl -X PUT "https://advertising.amazon.com/API/v2/sp/keywords" \
3 -H "Authorization: Bearer $ADS_ACCESS_TOKEN" \
4 -H "Amazon-Advertising-API-ClientId: $ADS_CLIENT_ID" \
5 -H "Amazon-Advertising-API-Scope: $ADS_PROFILE_ID" \
6 -H "Content-Type: application/json" \
7 -d '[{"keywordId": 789, "bid": 0.45}, {"keywordId": 790, "state": "paused"}]'

Complete working code

Daily Amazon Ads optimization: pull yesterday's keyword report, calculate ACOS per keyword, and automatically adjust bids and pause underperformers.

Error handling

Cause

Missing the Amazon-Advertising-API-ClientId header, or using the SP-API client_id instead of the Ads API client_id.

Fix

The Ads API requires three auth headers: Authorization: Bearer {token}, Amazon-Advertising-API-ClientId: {ads_client_id}, and Amazon-Advertising-API-Scope: {profile_id}. The client_id must be from your Ads API application, not your SP-API application — these are separate.

Cause

Invalid reportDate (future date, or date before account creation), unsupported metric name, or requesting a report for a date with no data.

Fix

Use YYYYMMDD format with a date from 2-60 days ago. Current day reports are available ~3 hours after UTC midnight. Check statusDetails in the response for the specific failure reason.

Cause

The profile_id in Amazon-Advertising-API-Scope doesn't match a profile authorized under your LWA credentials.

Fix

Call GET /v2/profiles to list available profiles and their IDs. Use the exact profile_id returned by this endpoint. Profile IDs are different from seller IDs or marketplace IDs.

Cause

Bid value is outside Amazon's accepted range for the marketplace, or the keyword is archived (not just paused).

Fix

Minimum bid is typically $0.02 (varies by marketplace). Maximum is $1,000. Archived keywords cannot be updated — check keyword state before attempting bid changes. Only enabled and paused keywords accept bid updates.

Cause

The Ads API has per-advertiser rate limits that vary by endpoint and account tier. Report requests are more restricted than campaign/keyword CRUD.

Fix

Add 500ms delays between campaign and keyword update requests. For report polling, use 60-second intervals — polling more frequently does not speed up report generation. Implement exponential backoff starting at 2s for 429 responses.

Rate limits & throttling

Security checklist

  • Store ADS_CLIENT_ID, ADS_CLIENT_SECRET, and refresh tokens in environment variables
  • Keep Ads API and SP-API credentials separate — they are different applications with different credentials
  • Never expose access tokens or profile IDs in client-side code
  • Implement maximum bid guardrails in your automation (e.g., never bid above $5) to prevent runaway spend
  • Log all bid changes with keywordId, old_bid, new_bid, acos, and timestamp for audit trail
  • Test bid optimization logic with dry-run mode (log changes without applying) before running live

Automation use cases

Daily ACOS-Based Bid Optimization

Run every morning to analyze yesterday's keyword performance, bid up keywords with ACOS below target, bid down keywords above target, and pause keywords with spend but zero sales.

Budget Auto-Scaling During Peak Events

Increase campaign daily budgets automatically before and during Prime Day, Black Friday, or category-specific peak periods based on historical performance data.

Underperformer Pausing

Automatically pause keywords that have spent more than your minimum threshold (e.g., $10) with zero sales over the past 7 days, preventing wasted ad spend.

Weekly Performance Summary

Generate a weekly campaign performance summary showing ACOS, ROAS, spend, and sales trends. Send to Slack or email automatically every Monday morning.

No-code alternatives

Don't want to write code? These platforms can automate the same workflows visually.

Zapier

No native Amazon Ads API integration. Custom HTTP actions could work but are very complex for the async report flow.

Pros
    Cons

      Make (Integromat)

      HTTP modules can handle the Ads API. The async report pattern (request → poll → download) requires multiple sequential modules with polling loops.

      Pros
        Cons

          n8n

          Most practical no-code option for Amazon Ads automation. Loop Until node handles report polling, Code nodes handle ACOS calculation, HTTP Request nodes call the Ads API.

          Pros
            Cons

              Best practices

              • Register a separate LWA application for the Ads API — do not reuse your SP-API credentials
              • Always call GET /v2/profiles first to get the profile_id before making any campaign API calls
              • Run bid optimization at most once per day — Amazon's attribution window is 7 days, so daily changes are sufficient
              • Set hard bid limits in code (e.g., max $5, min $0.10) to prevent automation errors from setting extreme bids
              • Use dry-run mode (log intended changes without applying) for the first few runs to validate your logic
              • Implement a minimum data threshold — don't adjust bids based on fewer than 10 clicks or 3 days of data
              • Store all bid changes in a database for trend analysis and to revert bad changes if needed
              • Test with a single campaign before enabling automation across your full account

              Ask AI to help

              Copy one of these prompts to get a personalized, working implementation.

              ChatGPT / Claude Prompt

              Help me build a Node.js script to automate Amazon Ads bid optimization. The Amazon Ads API is separate from SP-API and requires its own LWA app with three headers: Authorization: Bearer {token}, Amazon-Advertising-API-ClientId: {ads_client_id}, and Amazon-Advertising-API-Scope: {profile_id}. The script should: (1) authenticate via LWA OAuth 2.0, (2) request a keyword performance report via POST /v2/sp/keywords/report for yesterday, (3) poll the report every 60 seconds until status=SUCCESS, (4) download and gunzip the report, (5) for each keyword calculate ACOS (spend/sales7d), (6) bid down by 20% if ACOS > 30% target, bid up by 20% if ACOS < 17.5%, pause if spend > $10 and no sales, (7) apply updates via PUT /v2/sp/keywords in batches of 1000.

              Lovable / V0 Prompt

              Build me an Amazon Ads management dashboard that: (1) connects to the Amazon Ads API with LWA auth (separate from SP-API, needs Amazon-Advertising-API-ClientId and Amazon-Advertising-API-Scope headers), (2) shows a table of all Sponsored Products campaigns with current state, daily budget, and yesterday's ACOS, (3) has controls to pause/enable campaigns and adjust daily budgets in bulk, (4) shows a keyword performance table sorted by spend with ACOS calculated as spend/sales7d. Store the Ads API credentials in Supabase Secrets. Note: report data is async — request the report, poll for completion, then display results.

              Frequently asked questions

              Is the Amazon Ads API the same as SP-API?

              No. They are completely separate APIs with separate app registrations, separate LWA client credentials, and separate base URLs. SP-API handles orders, catalog, and inventory at sellingpartnerapi-na.amazon.com. The Ads API handles campaigns at advertising.amazon.com. If you use both, you need two separate LWA applications and maintain two sets of credentials.

              How long does it take for Amazon Ads reports to generate?

              Reports typically take 15–60 minutes to generate. Current-day reports are not available until ~3 hours after UTC midnight. There's no way to speed up generation — poll every 60 seconds and handle the wait. The report for a given day becomes available the following day.

              What is ACOS and how is it calculated?

              ACOS (Advertising Cost of Sale) = (Ad Spend / Attributed Sales) × 100%. A 25% ACOS means you spent $0.25 in ads for every $1 in attributed sales. Lower is generally better. The report metric 'acos7d' is Amazon's pre-calculated 7-day ACOS. You can also calculate it manually from the 'spend' and 'sales7d' metrics.

              What happens if I set a bid too low and my ads stop showing?

              Keywords with bids below Amazon's minimum (typically $0.02) or below the competitive bid range for your category may stop showing impressions. If you notice a keyword going to zero impressions after a bid reduction, increase the bid. Always set a minimum bid floor (e.g., $0.10) in your automation logic to prevent this.

              Can I automate Sponsored Brands or Sponsored Display campaigns too?

              Yes. The Ads API supports Sponsored Brands at /v2/hsa/* endpoints and Sponsored Display at /sd/* endpoints. The authentication and general pattern is the same, but the endpoints, attributes, and report metrics differ. Focus on Sponsored Products first since it's the most commonly automated campaign type.

              How do I get the profile_id for my Amazon Ads account?

              Call GET /v2/profiles with your Ads API access token and client headers. This returns a list of all advertising profiles authorized under your credentials, including profile_id, country, currency, and account type. Save the profile_id for your target marketplace and include it in the Amazon-Advertising-API-Scope header on every subsequent request.

              Can RapidDev help me build a custom Amazon Ads optimization system?

              Yes. RapidDev can build a complete bid management system with custom ACOS targets per product category, dayparting rules, budget pacing, and weekly performance dashboards. We handle the Ads API integration, report parsing, and automated bid logic.

              RapidDev

              Need this automated?

              Our team has built 600+ apps with API automations. We can build this for you.

              Book a free consultation
              Matt Graham

              Written by

              Matt Graham · CEO & Founder, RapidDev

              1,000+ client projects delivered. Columbia University & Harvard Business School alumnus, U.S. Navy veteran. About the author →

              Want this built for you?

              We ship production apps at a fixed price — $13K–$25K, 6–10 weeks, source code yours. You've seen what it takes; we do it every week.

              Get a fixed-price quote

              We put the rapid in RapidDev

              Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.