selling-partner-api-sdk

A modularized SDK library for Amazon Selling Partner API (fully typed in TypeScript)

codecov XO code style

Bizon

Codegen Tests Release

To learn more about the Selling Partner API, visit the official Amazon documentation.
Also, see the generated documentation for each API client.

This SDK supports the following features:

  • Installing only the API clients you need, versioned independently.
  • Passing client configuration through environment variables.
  • Retrying rate-limited requests by respecting the documented rate-limts and possibly provided headers.
  • Logging (non-auth) API requests, responses and errors.
  • Passing restricted data tokens to API clients.
  • auth: Authentication helpers for the Selling Partner API.
  • common: Common utilities for the SDK.
  • schemas: JSON schemas and TypeScript types for notifications, reports and feeds.

This repository contains an API client for each of the available Selling Partner API version:

The API clients are automatically generated from the Swagger/OpenAPI models from the official models repository. A code generation workflow runs twice a day and will create a PR on this repository whenever there are changes to the models.

The SDK exposes notifications, reports and feeds schemas through @sp-api-sdk/schemas.
It exposes the JSON schemas as well as typescript types.

For example, if you need the JSON schema for Vendor inventory reports:

import { Reports } from "@sp-api-sdk/schemas";

console.log(Reports.vendorInventoryReport);

If you need the typescript type:

import { Reports } from "@sp-api-sdk/schemas";

const report = (await getVendorInventoryReportData()) as Reports.VendorInventoryReport;

To see the code generation process, see the codegen module.

Some of the source Open API models are invalid (see the issues and PRs on the Amazon repository), so this SDK defines some patches to account for those errors.

Each patch files are JSON Patches operations (1 logical change per file).

You can browse all the active patches in the patches directory.

MIT

    ╚⊙ ⊙╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝

Classes

SellingPartnerApiError

Interfaces

ClientConfiguration
OnRetryParameters
RateLimit

Type Aliases

SellingPartnerRegion

Variables

sellingPartnerRegions

Functions

createAxiosInstance