npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

amazon-sp-cli

v0.2.0

Published

CLI for Amazon Selling Partner API

Downloads

26

Readme

amazon-sp-cli

A command-line tool for Amazon sellers to manage orders, inventory, listings, and catalog items directly from the terminal using the Amazon Selling Partner API (SP-API).

$ amazon-sp orders list
┌─────────────────────┬──────────┬──────────────────────┬───────┬─────────┐
│ Order ID            │ Status   │ Purchase Date        │ Items │ Total   │
├─────────────────────┼──────────┼──────────────────────┼───────┼─────────┤
│ 123-4567890-1234567 │ SHIPPED  │ 2026-03-15T14:22:00Z │ 2     │ $49.98  │
│ 234-5678901-2345678 │ PENDING  │ 2026-03-17T09:11:00Z │ 1     │ $24.99  │
└─────────────────────┴──────────┴──────────────────────┴───────┴─────────┘

Prerequisites

  • Node.js 18+nodejs.org
  • Amazon SP-API credentials — you'll need:
    • Client ID and Client Secret (from your SP-API app in Seller Central)
    • Refresh Token (generated when you authorize your app)
    • Your selling region (na, eu, or fe)

If you haven't set up SP-API access yet, start at Seller Central → Apps & Services → Develop Apps.


Installation

From npm (recommended)

npm install -g amazon-sp-cli

From source

git clone https://github.com/cprice70/amazon-sp-cli.git
cd amazon-sp-cli
npm install
npm run build
npm link

Verify it's working:

amazon-sp --version

Authentication

Run the login wizard to store your credentials:

amazon-sp auth login

You'll be prompted for:

| Prompt | What to enter | |--------|---------------| | Client ID | Your SP-API app's Client ID (amzn1.application-oa2-client...) | | Client Secret | Your SP-API app's Client Secret | | Refresh Token | Your LWA Refresh Token (Atzr|...) | | Region | na (North America), eu (Europe), or fe (Far East) | | Marketplace ID | Your default marketplace (e.g. ATVPDKIKX0DER for US). Press Enter to skip. | | Sandbox mode | y to use the SP-API sandbox, n for production |

The CLI will attempt to auto-detect your Seller ID. If that fails, you'll be prompted to enter it manually (required for listings commands).

Credentials are saved to ~/.config/amazon-sp-cli/config.json.

Check your auth status:

amazon-sp auth status

Log out / clear credentials:

amazon-sp auth logout

Commands

Orders

List recent orders (last 30 days by default):

amazon-sp orders list
amazon-sp orders list --status UNSHIPPED
amazon-sp orders list --start 2026-01-01 --end 2026-03-01
amazon-sp orders list --json

| Flag | Description | |------|-------------| | --status <status> | Filter by status: PENDING, UNSHIPPED, SHIPPED, CANCELED, etc. | | --start <date> | ISO date for CreatedAfter (default: 30 days ago) | | --end <date> | ISO date for CreatedBefore | | --marketplace <id> | Override default marketplace ID | | --json | Output raw JSON |


Get a single order:

amazon-sp orders get --order 123-4567890-1234567
amazon-sp orders get --order 123-4567890-1234567 --json

List items in an order:

amazon-sp orders items --order 123-4567890-1234567
amazon-sp orders items --order 123-4567890-1234567 --json

Inventory

List FBA inventory:

amazon-sp inventory list
amazon-sp inventory list --sku MY-SKU-123
amazon-sp inventory list --json

| Flag | Description | |------|-------------| | --sku <sku> | Filter by seller SKU | | --marketplace <id> | Override default marketplace ID | | --json | Output raw JSON |


Listings

Search your listings:

amazon-sp listings search
amazon-sp listings search --sku MY-SKU-123
amazon-sp listings search --json

Get a listing by SKU:

amazon-sp listings get --sku MY-SKU-123
amazon-sp listings get --sku MY-SKU-123 --json

Create a listing:

amazon-sp listings create --sku MY-SKU-123 --body '{"productType":"LUGGAGE","requirements":"LISTING",...}'

| Flag | Description | |------|-------------| | --sku <sku> | The SKU to create (required) | | --body <json> | Full listing body as a JSON string (required) | | --marketplace <id> | Override default marketplace ID | | --seller <id> | Override default seller ID | | --json | Output raw JSON |


Update a listing (patch):

amazon-sp listings patch --sku MY-SKU-123 --body '{"patches":[{"op":"replace","path":"/attributes/price","value":[{"value":"19.99","currency":"USD"}]}]}'

| Flag | Description | |------|-------------| | --sku <sku> | The SKU to update (required) | | --body <json> | Patch body as a JSON string (required) | | --marketplace <id> | Override default marketplace ID | | --seller <id> | Override default seller ID | | --json | Output raw JSON |


Delete a listing:

amazon-sp listings delete --sku MY-SKU-123

Catalog

Search catalog items:

amazon-sp catalog search --query "blue widget"
amazon-sp catalog search --query "blue widget" --json

Get a catalog item by ASIN:

amazon-sp catalog get --asin B001234567
amazon-sp catalog get --asin B001234567 --json

Configuration

Credentials are stored at:

~/.config/amazon-sp-cli/config.json

You can also set credentials via environment variables (useful for CI/scripts):

| Environment Variable | Config Field | |----------------------|--------------| | AMAZON_SP_CLIENT_ID | Client ID | | AMAZON_SP_CLIENT_SECRET | Client Secret | | AMAZON_SP_REFRESH_TOKEN | Refresh Token | | AMAZON_SP_REGION | Region (na, eu, fe) | | AMAZON_SP_MARKETPLACE_ID | Default Marketplace ID | | AMAZON_SP_SELLER_ID | Default Seller ID | | AMAZON_SP_SANDBOX | Sandbox mode (true/false) |

Environment variables override values in the config file.


Troubleshooting

"Not authenticated" error Run amazon-sp auth login to set up your credentials, then amazon-sp auth status to verify they're stored correctly.

401 or 403 errors on commands Your refresh token may have expired or been revoked. Run amazon-sp auth login again to re-authenticate.

"Seller ID not set" error on listings commands Either re-run amazon-sp auth login (the wizard will attempt to detect your Seller ID) or pass --seller <id> directly, or set AMAZON_SP_SELLER_ID in your environment.


License

MIT