amazon-creators-api
v1.2.2
Published
Amazon Creators API NodeJS SDK
Downloads
362
Maintainers
Readme
Amazon Creators API Node.js SDK
This is an unofficial TypeScript wrapper for the Amazon Creators API Node.js SDK.
This package implements a thin TypeScript wrapper around Amazon's JS runtime internals to add proper types to the Node.js SDK.
Prerequisites
- Node.js version 18 or higher
- Register for the Creators API
Installation
npm install amazon-creators-apiUsage
See the examples directory for usage examples.
Get Items
import {
ApiClient,
GetItemsRequestContent,
GetItemsResource,
TypedDefaultApi,
} from "amazon-creators-api";
// Initialize API client
const apiClient = new ApiClient();
// Add credential details
// You can find these in the Creators API dashboard: https://affiliate-program.amazon.com/creatorsapi
apiClient.credentialId = "<YOUR CREDENTIAL ID>";
apiClient.credentialSecret = "<YOUR CREDENTIAL SECRET>";
apiClient.version = "<YOUR CREDENTIAL VERSION>";
// Initialize typed API wrapper
const api = new TypedDefaultApi(apiClient);
/**
* Sample function to demonstrate GetItems API usage
*/
async function getItems(): Promise<void> {
/**
* Add marketplace. For more details, refer: https://affiliate-program.amazon.com/creatorsapi/docs/en-us/api-reference/common-request-headers-and-parameters#marketplace-locale-reference
*/
const marketplace = "<YOUR MARKETPLACE>"; // e.g. "www.amazon.com" for US marketplace
// Create GetItems request
// Enter your partner tag (store/tracking id)
const partnerTag = "<YOUR PARTNER TAG>";
// Choose item id(s) - ASINs to retrieve
const itemIds = ["B0DLFMFBJW", "B0BFC7WQ6R", "B00ZV9RDKK"];
const getItemsRequest = new GetItemsRequestContent(partnerTag, itemIds);
/**
* Choose resources you want from GetItemsResource enum
* For more details, refer: https://affiliate-program.amazon.com/creatorsapi/docs/en-us/api-reference/operations/get-items#resources-parameter
*/
const resources = [
"images.primary.medium",
"itemInfo.title",
"itemInfo.features",
"offersV2.listings.price",
"offersV2.listings.availability",
"offersV2.listings.condition",
"offersV2.listings.merchantInfo",
].map((resource) => GetItemsResource.constructFromObject(resource));
getItemsRequest.resources = resources;
try {
const response = await api.getItems(marketplace, getItemsRequest);
console.log("API called successfully.");
console.log("Complete Response:\n", JSON.stringify(response, null, 2));
} catch (error) {
console.log("Error calling Creators API!");
console.log("Full Error Object:\n", JSON.stringify(error, null, 2));
}Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
Licensed under the Apache License, Version 2.0. See the https://github.com/ryanschiang/amazon-creators-api/blob/main/LICENSE.txt file for details.
Original authorship belongs to Amazon.com, Inc. or its affiliates. See the https://github.com/ryanschiang/amazon-creators-api/blob/main/NOTICE.txt file for details.
Modifications copyright (c) 2026 Ryan Chiang.
