Registry / aws / amazon-sp-api

amazon-sp-api

JSON →
library1.2.1jsnpmunverified

A comprehensive client library for the Amazon Selling Partner API (SP-API). Current version 1.2.1 provides automatic access token management, rate limiting, report downloading, feed uploading, and full TypeScript support. It replaces the legacy Amazon MWS API with modern authentication and endpoints. The library handles throttling internally and offers sandbox mode for testing. Release cadence is periodic, with breaking changes notable when upgrading from v0.x to v1.x.

npm install amazon-sp-api
INSTALL
IMPORT
SIG · AMAZON-SP-API
A
amazon-sp-api
awsjavascriptv1.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import SellingPartner from 'amazon-sp-api'
const SellingPartner = require('amazon-sp-api')
ESM default import. Use 'SellingPartner' (note uncommon capitalization) as the constructor.
SellingPartner
import SellingPartner from 'amazon-sp-api'
import { SellingPartner } from 'amazon-sp-api'
This is a default export, not a named export. Named import will fail.
createClient
import SellingPartner from 'amazon-sp-api'
import { createClient } from 'amazon-sp-api'
The main export is the SellingPartner class, not a factory function. Use 'new SellingPartner()'.

Initializes the client with credentials and region, then calls the getMarketplaceParticipations operation on the Sellers endpoint.

import SellingPartner from 'amazon-sp-api'; const sp = new SellingPartner({ region: 'EU', refreshToken: process.env.REFRESH_TOKEN ?? '', credentials: { SELLING_PARTNER_APP_CLIENT_ID: process.env.CLIENT_ID ?? '', SELLING_PARTNER_APP_CLIENT_SECRET: process.env.CLIENT_SECRET ?? '' } }); const res = await sp.callAPI({ operation: 'getMarketplaceParticipations', endpoint: 'sellers' }); console.log(res);
Debug
Known issues
breakingVersion 1.x introduces breaking changes from 0.x. See the breaking changes documentation in the GitHub repo.
fix
Upgrade to 1.x and update code per the migration guide.
affects: <1.0.0
deprecatedThe legacy MWS API endpoint is replaced by SP-API. Ensure you are using the new Selling Partner API.
fix
Migrate from MWS to SP-API.
affects: >=0.0.0
gotchaClass name is 'SellingPartner' with uppercase 'P', not 'Sellingpartner' or 'SellingPartnerApi'.
fix
Use the correct class name: SellingPartner.
affects: >=0.0.0
gotchaAccess tokens are automatically managed; do not manually set access tokens.
fix
Let the library handle token refresh automatically via refreshToken.
affects: >=0.0.0
gotchaSome operations may require grantless access; use the 'grantless' option in callAPI.
fix
Set grantless: true for operations that don't require a refresh token.
affects: >=0.0.0
deprecatedThe 'restore_rate' feature is experimental and may change in future versions.
fix
Monitor library updates for changes to restore rate functionality.
affects: >=0.0.0
gotchaRate limit headers are read automatically; you may still encounter throttling if limits are exceeded.
fix
Enable rate limit retry in config to have the library automatically wait and retry on throttled requests.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'amazon-sp-api'
Package not installed or import path wrong.
fix
Run 'npm install amazon-sp-api' and ensure the import statement is correct: import SellingPartner from 'amazon-sp-api'
TypeError: SellingPartner is not a constructor
Incorrect import: trying to import a named export instead of default.
fix
Use: import SellingPartner from 'amazon-sp-api' (no curly braces)
Error: Missing required parameter 'refreshToken'
Refresh token not provided in constructor config or environment variable.
fix
Set REFRESH_TOKEN environment variable or pass refreshToken in the config object. For grantless operations, set grantless: true.
Error: Invalid region. Supported regions: NA, EU, FE
Region code provided is not valid.
fix
Use one of: 'NA', 'EU', 'FE' (case-sensitive).
Error: Endpoint 'xxx' not found
The API endpoint name is misspelled or unsupported.
fix
Check the list of supported endpoints and their exact names. Use the endpoint name as defined by Amazon SP-API, e.g., 'sellers', 'catalogItems'.
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
54 hits · last 30 days
node
46
Perplexity
1
OpenAI (training)
1
Resources
amazon-sp-api — npm install amazon-sp-api · libregistry