Amazon ads

From mvanhorn/printing-press-library · View interactive version

Amazon ads is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. Printing Press CLI for Amazon Ads reports, profitability analytics, keyword optimization, and guarded automation.

How to use this skill

Skill file

Amazon Ads — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the amazon-ads-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer. It defaults binaries to $HOME/.local/bin on macOS/Linux and %LOCALAPPDATA%\Programs\PrintingPress\bin on Windows:

```bash

npx -y @mvanhorn/printing-press-library install amazon-ads --cli-only

```

  1. Verify: amazon-ads-pp-cli --version
  2. Ensure the reported install directory is on $PATH for the agent/runtime that will invoke this skill.

If the npx install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.6 or newer):

go install github.com/mvanhorn/printing-press-library/library/commerce/amazon-ads/cmd/amazon-ads-pp-cli@latest

If --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.

Start here: profitability

For a seller focused on organic + advertising profitability, start with these commands before browsing the full API surface:

  1. amazon-ads-pp-cli break-even-acos — Calculate the maximum ACOS a product can carry before it loses money.
  2. amazon-ads-pp-cli true-profit — Calculate product profit after COGS, estimated Amazon fees, and ad spend.
  3. amazon-ads-pp-cli acos-vs-tacos --report product-performance.csv --seller-store ~/.config/amazon-seller-pp-cli/store.db — Join ad spend to seller-store sales for ACOS and TACOS by ASIN when the seller store has matching data.
  4. amazon-ads-pp-cli portfolio-dashboard --report campaign-performance.csv — Summarize spend, sales, orders, ACOS, CPC, CTR, and CVR.
  5. amazon-ads-pp-cli product-ad-profitability --report product-performance.csv --cogs-file products.toml — Estimate per-ASIN profit from ad performance and COGS.
  6. amazon-ads-pp-cli campaign-comparison --report campaign-performance.csv — Compare campaigns by spend, sales, ACOS, CPC, CTR, and CVR.

Use amazon-ads-pp-cli reports recipe <command> when a command asks for --report; it prints the exact report kind, required columns, export path, and sample header. The schema-aware flows support console CSV/TSV exports and Ads API JSON/GZIP report artifacts.

acos-vs-tacos covers ad spend joined to seller-store sales and TACOS by ASIN when the seller store overlaps the ads report. It does not yet cover organic sessions, conversion rate, parent/child ASIN rollups, refunds, COGS unless --cogs-file is provided to profit commands, or TACOS by portfolio. For the seller-side dashboard workflow, cross-check amazon-seller-pp-cli sales-intel dashboard.

Command Reference

amazon-ads-dsp-dsp — Manage amazon ads dsp dsp

amazon-ads-profiles-profiles — Manage amazon ads profiles profiles

amazon-ads-sponsored-reports — Manage amazon ads sponsored reports

assets — Manage assets

attribution — Manage attribution

audiences — Manage audiences

benchmarks — Manage benchmarks

billing — Manage billing

brands — Manage brands

currencies — Manage currencies

dp — Manage dp

dsp — Manage dsp

dsp-reports-dsp — Manage dsp reports dsp

eligibility — Manage eligibility

history — Manage history

hsa — Manage hsa

insights — Manage insights

invoices — Manage invoices

keywords — Manage keywords

manager-accounts — Manage manager accounts

measurement — Manage measurement

measurement-dsp — Manage measurement dsp

media — Manage media

overlapping-audiences — Manage overlapping audiences

page-asins — Manage page asins

pre-moderation — Manage pre moderation

product — Manage product

products — Manage products

profiles — List Amazon Ads profiles available to the authorized application.

reports — Manage reports

sb — Manage sb

sd — Manage sd

sp — Manage sp

sponsored-brands-sb — Manage sponsored brands sb

sponsored-display-sd — Manage sponsored display sd

sponsored-products-sp — Manage sponsored products sp

stores — (Not available for video campaigns)

targeting-expression — Manage targeting expression

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

amazon-ads-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Auth Setup

This CLI uses Login with Amazon OAuth2 with refresh-token rotation. Register this exact Allowed Return URL / Redirect URI in the Amazon developer app:

http://localhost:8085/callback

Configure local credentials in ~/.config/amazon-ads-pp-cli/.env:

mkdir -p ~/.config/amazon-ads-pp-cli
chmod 700 ~/.config/amazon-ads-pp-cli
"$EDITOR" ~/.config/amazon-ads-pp-cli/.env

Use:

AMAZON_ADS_CLIENT_ID=your-client-id
AMAZON_ADS_CLIENT_SECRET=your-client-secret
AMAZON_ADS_REFRESH_TOKEN=
AMAZON_ADS_PROFILE_ID=

Then run amazon-ads-pp-cli auth login --port 8085 to authorize advertising::campaign_management and save the refresh token. The login flow also fetches advertising profiles and selects the only profile automatically, or prompts when multiple profiles are available. If you already have a refresh token, paste it into .env instead. Access tokens are refreshed automatically before API calls.

Run amazon-ads-pp-cli doctor to verify setup.

List or change the persisted Amazon Ads profile scope before running scoped endpoints:

amazon-ads-pp-cli profiles list --json
amazon-ads-pp-cli profiles select <profile-id>
amazon-ads-pp-cli profiles current --json

Novel seller analytics commands operate on exported Amazon Ads reports and optional COGS TOML.

dayparting-analysis and budget-pacing require a report export with hour, hourOfDay, or timestamped rows; the pinned DSP reporting schema exposes SUMMARY/DAILY time units, while Amazon Ads Insights timing data carries hourOfDay.

amazon-ads-pp-cli break-even-acos --price 32.99 --cogs 8.50 --fees 30 --json
amazon-ads-pp-cli true-profit --price 32.99 --cogs 8.50 --fees 30 --ad-spend 4.20 --json
amazon-ads-pp-cli acos-vs-tacos --report product-performance.csv --seller-store ~/.config/amazon-seller-pp-cli/store.db --asin B0XXXX --json
amazon-ads-pp-cli portfolio-dashboard --report campaign-performance.csv --json
amazon-ads-pp-cli campaign-comparison --report campaign-performance.csv --json
amazon-ads-pp-cli product-ad-profitability --report product-performance.csv --cogs-file ~/.config/amazon-ads-pp-cli/cogs.toml --json
amazon-ads-pp-cli reports wait <report-id> --wait-timeout 20m --json
amazon-ads-pp-cli normalize-report --input downloaded-report.csv.gz --kind performance --output normalized.jsonl --format jsonl --store --json
amazon-ads-pp-cli placement-analysis --report placement-performance.csv --json
amazon-ads-pp-cli competitor-asin-mining --report product-targeting-performance.csv --asin B0XXXX --json
amazon-ads-pp-cli seasonal-planner --report historical-performance.csv --budget-multiplier 1.25 --json
amazon-ads-pp-cli dayparting-analysis --report hourly-performance.csv --json
amazon-ads-pp-cli budget-pacing --report hourly-campaign-performance.csv --threshold 0.90 --early-hour 18 --json
amazon-ads-pp-cli share-of-voice --report share-of-voice.csv --asin B0XXXX --keywords "self journal,daily planner" --json
amazon-ads-pp-cli search-term-mining --report search-terms.csv --target-acos 25 --json
amazon-ads-pp-cli wasted-spend --report search-terms.csv --threshold 10 --json
amazon-ads-pp-cli keyword-cannibalization --report search-terms.csv --json
amazon-ads-pp-cli negative-keyword-generator --report search-terms.csv --threshold 10 --json
amazon-ads-pp-cli new-keyword-opportunities --report search-terms.csv --target-acos 25 --json
amazon-ads-pp-cli bid-optimizer --report keyword-performance.csv --target-acos 25 --json
amazon-ads-pp-cli keyword-decay --baseline keyword-performance-previous.csv --current keyword-performance-current.csv --degradation-threshold 30 --min-spend 25 --json
amazon-ads-pp-cli keyword-lifecycle --report keyword-performance.csv --target-acos 25 --json
amazon-ads-pp-cli keyword-snapshots import --report keyword-performance.csv --snapshot-at 2026-02-01 --json
amazon-ads-pp-cli keyword-snapshots list --json
amazon-ads-pp-cli bid-history --keyword "self journal" --json
amazon-ads-pp-cli auto-negate --report search-terms.csv --threshold 15 --min-clicks 20 --json
amazon-ads-pp-cli auto-promote --report search-terms.csv --min-conversions 3 --max-acos 30 --json
amazon-ads-pp-cli budget-rebalance --report campaign-performance.csv --total-budget 500 --json
amazon-ads-pp-cli bid-rules apply --report keyword-performance.csv --file rules.json --json
amazon-ads-pp-cli automation-audit --limit 20 --json

Automation commands print plans by default. Use --apply only when the report includes the Amazon IDs required for mutation: campaign_id and ad_group_id for search-term automation, campaign_id for budget updates, and keyword_id for bid-rule updates. Apply mode de-duplicates repeated remote mutation keys before sending, is capped by --max-changes, bid mutations are capped by --max-bid, and budget rebalance is capped by --max-daily-budget when set. --apply --dry-run previews the mutation request without sending it. auto-promote --apply also requires --bid.

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.

```bash

amazon-ads-pp-cli amazon-ads-dsp-dsp list --agent --select id,name,status

```

Response envelope

Commands that read from the local store or the API wrap output in a provenance envelope:

{
  "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
  "results": <data>
}

Parse .results for data and .meta.source to know whether it's live or local. A human-readable N results (live) summary is printed to stderr only when stdout is a terminal AND no machine-format flag (--json, --csv, --compact, --quiet, --plain, --select) is set — piped/agent consumers and explicit-format runs get pure JSON on stdout.

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

amazon-ads-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
amazon-ads-pp-cli feedback --stdin < notes.txt
amazon-ads-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.local/share/amazon-ads-pp-cli/feedback.jsonl. They are never POSTed unless AMAZON_ADS_FEEDBACK_ENDPOINT is set AND either --send is passed or AMAZON_ADS_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

| Sink | Effect |

|------|--------|

| stdout | Default; write to stdout only |

| file:<path> | Atomically write output to <path> (tmp + rename) |

| webhook:<url> | POST the output body to the URL (application/json or application/x-ndjson when --compact) |

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

amazon-ads-pp-cli profile save briefing --json
amazon-ads-pp-cli --profile briefing amazon-ads-dsp-dsp list
amazon-ads-pp-cli profile list --json
amazon-ads-pp-cli profile show briefing
amazon-ads-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Async Jobs

For endpoints that submit long-running work, the generator detects the submit-then-poll pattern (a job_id/task_id/operation_id field in the response plus a sibling status endpoint) and wires up three extra flags on the submitting command:

| Flag | Purpose |

|------|---------|

| --wait | Block until the job reaches a terminal status instead of returning the job ID immediately |

| --wait-timeout | Maximum wait duration (default 10m, 0 means no timeout) |

| --wait-interval | Initial poll interval (default 2s; grows with exponential backoff up to 30s) |

Use async submission without --wait when you want to fire-and-forget; use --wait when you want one command to return the finished artifact.

Amazon sponsored report submit endpoints in the upstream schemas do not all expose generator --wait flags. Use amazon-ads-pp-cli reports wait <report-id> after creating a report to poll /v2/reports/{reportId} until Amazon returns a terminal status.

Exit Codes

| Code | Meaning |

|------|---------|

| 0 | Success |

| 2 | Usage error (wrong arguments) |

| 3 | Resource not found |

| 4 | Authentication required |

| 5 | API error (upstream issue) |

| 7 | Rate limited (wait and retry) |

| 10 | Config error |

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show amazon-ads-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

  1. Install the MCP server:

```bash

go install github.com/mvanhorn/printing-press-library/library/commerce/amazon-ads/cmd/amazon-ads-pp-mcp@latest

```

  1. Register with Claude Code:

```bash

claude mcp add amazon-ads-pp-mcp -- amazon-ads-pp-mcp

```

  1. Verify: claude mcp list

Direct Use

  1. Check if installed: which amazon-ads-pp-cli

If not found, offer to install (see Prerequisites at the top of this skill).

  1. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  2. Execute with the --agent flag:

```bash

amazon-ads-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: amazon-ads-pp-cli <command> --help.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.