@amazon-sp-api-release/amazon-sp-api-sdk-js

中文文档
1.14.0发布于 2026/11/03Apache License 2.0ES Module构建来源已验证近 30 天下载 3.3万

This package is selling partner API Javascript SDK for nodeJS with LWA libraries.

原始使用文档
文档目录4 节
  1. JavaScript SDK for Selling Partner API
  2. Getting started
  3. Use the SDK
  4. Giving Feedback

JavaScript SDK for Selling Partner API

npm version

Video Thumbnail

Click on the image to watch the video.

The Selling Partner API SDK for JavaScript enables you to easily connect your JavaScript/Node.js application to Amazon's REST-based Selling Partner API.

Getting started

Credentials

Before you can use the SDK, you need to be registered as a Selling Partner API developer. If you haven't done that yet, please follow the instructions in the SP-API Registration Overview. You also need to register your application to get valid credentials to call SP-API. If you haven't done that yet, please follow the instructions in Registering your Application. If you are already registered successfully, you can find instructions on how to view your credentials in Viewing your Application Information and Credentials.

Minimum requirements

To run the SDK you need Node version 14 or higher.

Install the SDK

  1. Find the latest version number here.
  2. Add the dependency to your project (see instructions for npm, yarn and Add as an package dependency below).
Using npm:
npm install @amazon-sp-api-release/amazon-sp-api-sdk-js
Using yarn:
yarn add @amazon-sp-api-release/amazon-sp-api-sdk-js
Add as a package dependency

Add the following line to the dependencies in your package.json file:

"@amazon-sp-api-release/amazon-sp-api-sdk-js": "^1.0.0"

Use the SDK

In order to call one of the APIs included in the Selling Partner API, you need to:

  1. Configure credentials (Note: Use your individual credentials for clientId, clientSecret and refreshToken)
  2. Enable auto accessToken retrievel using our built in ApiClient function OR retrieve accessToken using our LwaAuthClient helper (Be aware for some APIs, you will need extra step to get RDT Token)
  3. Create an instance for a specific API and API client, then apply accessToken to it.
  4. Call an API operation

For an example, refer to the following sample code for connecting to Sellers API:

import {
  SellersSpApi
} from '@amazon-sp-api-release/amazon-sp-api-sdk-js';

async function getMarketplaceParticipations() {
  try {
      //Configure Sellers ApiClient
      const sellersApiClient = new SellersSpApi.ApiClient(AppConfig.spApiNAEndpoint);
      sellersApiClient.enableAutoRetrievalAccessToken('<YOUR_CLIENT_ID>','<YOUR_CLIENT_SECRET>', '<YOUR_REFRESH_TOKEN>', null);
      const sellersApi = new SellersSpApi.SellersApi(sellersApiClient);
      
      //Call GetMarkerplaceParticipations API
      const participations = await sellersApi.getMarketplaceParticipations();
      console.log(
        JSON.stringify(participations, null, ' ') + 
          '\n**********************************'
      )
  } catch (error) {
      console.error('Exception when calling getMarketplaceParticipations API', error.message);
  }
}

getMarketplaceParticipations();

Alternatively, you can go to @amazon-sp-api-release/amazon-sp-api-sdk-js/sample-node-app and copy over and modify index.js and app.config.mjs files and give them a try. You can see multiple API operation call samples with various way of retrieving token, as well how to set up rate limiter and retry logic when making API calls. Note that the rate limiter is turned on by default to protect your API calls from 429 errors.

Additional Note:

This Amazon Selling Partner API JavaScript SDK is fully compatible with ECMAScript modules (ESM). You can use modern ES6+ import/export syntax as demonstrated in the example code:

import {
  SellersSpApi,
} from '@amazon-sp-api-release/amazon-sp-api-sdk-js';

Giving Feedback

We need your help in making this SDK great. Please participate in the community and contribute to this effort by submitting issues, participating in discussion forums and submitting pull requests through the following channels:

Submit issues - this is the preferred channel to interact with our team Articulate your feature request or upvote existing ones on our Issues page

版本与发布记录

@amazon-sp-api-release/amazon-sp-api-sdk-js 共发布 28 个版本,首次发布于 2025/04/07;过去 12 个月发布了 13 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.14.0latest2026/11/032 天前
1.13.02026/10/021 个月前
1.12.02026/08/272 个月前
1.11.02026/08/072 个月前
1.10.12026/08/033 个月前
1.10.02026/07/313 个月前

其他发布通道:alpha → 1.6.1-alpha.0。

关于 @amazon-sp-api-release/amazon-sp-api-sdk-js 的常见问题

@amazon-sp-api-release/amazon-sp-api-sdk-js 是什么?

This package is selling partner API Javascript SDK for nodeJS with LWA libraries.

如何安装 @amazon-sp-api-release/amazon-sp-api-sdk-js?

在项目目录运行 npm install @amazon-sp-api-release/amazon-sp-api-sdk-js,或使用 pnpm add / yarn add / bun add。

@amazon-sp-api-release/amazon-sp-api-sdk-js 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/amazon-sp-api-release__amazon-sp-api-sdk-js 是否存在。

@amazon-sp-api-release/amazon-sp-api-sdk-js 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@amazon-sp-api-release/amazon-sp-api-sdk-js 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=14.18.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@amazon-sp-api-release/amazon-sp-api-sdk-js 可以商用吗?

@amazon-sp-api-release/amazon-sp-api-sdk-js 使用 Apache License 2.0 许可。声明的许可为 Apache License 2.0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@amazon-sp-api-release/amazon-sp-api-sdk-js 的下载量有多少?

根据 npm 官方下载统计,@amazon-sp-api-release/amazon-sp-api-sdk-js 在 2026/10/06 – 2026/11/04 这 30 天内被下载 33,136 次,日均约 1,105 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@amazon-sp-api-release/amazon-sp-api-sdk-js 还在维护吗?

最新版本 1.14.0 发布于 2026/11/03(2 天前);至今共发布 28 个版本,其中过去 12 个月发布了 13 个;首次发布于 2025/04/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。