Amazon Associate Product Advertising API for Node.js
Simple wrapper around Amazon's PA-API SDK with a scratchpad-style developer experience.
Published on npm as |
|
amazon-paapi now includes compatibility-safe GetItemsV2, GetVariationsV2, and SearchItemsV2 helpers.
Existing methods stay available for legacy users, while new integrations can move to OffersV2 resources right away.
Important
Amazon has deprecated Offers v1 in favor of OffersV2. This package now ships with additive v2 helpers so you can migrate without breaking existing applications.
Note
This update was reviewed for backward compatibility at the package level, but it was not validated with live Amazon PA-API credentials during release preparation.
If you encounter integration issues after upgrading, you can explicitly install the previous stable package version:
npm install amazon-paapi@1.0.7Tip
Use this package in server-side code only. Amazon PA-API requests require your AccessKey and SecretKey, so this package should be called from Node.js, API routes, server actions, or backend services rather than directly from browser/client-side React components.
Amazon Associate Product Advertising API for NodeJs. A PAAPI 5.0 Extension.
A clean wrapper for amazon's NodeJs SDK. Main purpose of this module is to jumpstart development with easy to understand and clean syntax inspired with the amazon scratchpad-like operation.
npm install amazon-paapi --saveconst amazonPaapi = require('amazon-paapi');
const commonParameters = {
AccessKey: '<YOUR ACCESS KEY>',
SecretKey: '<YOUR SECRET KEY>',
PartnerTag: '<YOUR PARTNER TAG>', // yourtag-20
PartnerType: 'Associates', // Default value is Associates.
Marketplace: 'www.amazon.com', // Default value is US. Note: Host and Region are predetermined based on the marketplace value. There is no need for you to add Host and Region as soon as you specify the correct Marketplace value. If your region is not US or .com, please make sure you add the correct Marketplace value.
};
const requestParameters = {
ASIN: 'B07H65KP63',
Resources: [
'ItemInfo.Title',
'OffersV2.Listings.Price',
'VariationSummary.VariationDimension',
],
};
/** Promise */
amazonPaapi
.GetVariationsV2(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
})
.catch((error) => {
// catch an error.
console.log(error);
});const amazonPaapi = require('amazon-paapi');
const commonParameters = {
AccessKey: '<YOUR ACCESS KEY>',
SecretKey: '<YOUR SECRET KEY>',
PartnerTag: '<YOUR PARTNER TAG>', // yourtag-20
PartnerType: 'Associates', // Default value is Associates.
Marketplace: 'www.amazon.com', // Default value is US. Note: Host and Region are predetermined based on the marketplace value. There is no need for you to add Host and Region as soon as you specify the correct Marketplace value. If your region is not US or .com, please make sure you add the correct Marketplace value.
};Amazon has deprecated Offers v1 resources in favor of OffersV2. This package now exposes additive v2 helpers:
GetItemsV2GetVariationsV2SearchItemsV2
These helpers keep the same request/response flow as the existing methods and upgrade Offers.* resource strings to OffersV2.* for you. The original GetItems, GetVariations, and SearchItems methods are still available for existing integrations.
Lookup information for a Browse Node. Please see sample script here.
const requestParameters = {
BrowseNodeIds: ['3040', '3045'],
LanguagesOfPreference: ['es_US'],
Resources: ['BrowseNodes.Ancestor', 'BrowseNodes.Children'],
};
/** Promise */
amazonPaapi
.GetBrowseNodes(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
})
.catch((error) => {
// catch an error.
console.log(error);
});Lookup item information for an item. Please see sample script here.
Note: This operation only supports ASIN as id Type. If you need to lookup using UPC or EAN, you can do so under
SearchItemsoperation.
const requestParameters = {
ItemIds: ['B00X4WHP5E', 'B00ZV9RDKK'],
ItemIdType: 'ASIN',
Condition: 'New',
Resources: [
'Images.Primary.Medium',
'ItemInfo.Title',
'OffersV2.Listings.Price',
],
};
/** Promise */
amazonPaapi
.GetItemsV2(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
})
.catch((error) => {
// catch an error.
console.log(error);
});Lookup information for variations. Please see sample script here.
const requestParameters = {
ASIN: 'B07H65KP63',
Resources: [
'Images.Primary.Medium',
'ItemInfo.Title',
'OffersV2.Listings.Price',
'VariationSummary.VariationDimension',
],
};
/** Promise */
amazonPaapi
.GetVariationsV2(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
})
.catch((error) => {
// catch an error.
console.log(error);
});Searches for items on Amazon. Please see sample script here.
const requestParameters = {
Keywords: 'Harry Potter',
SearchIndex: 'Books',
ItemCount: 2,
Resources: [
'Images.Primary.Medium',
'ItemInfo.Title',
'OffersV2.Listings.Price',
],
};
/** Promise */
amazonPaapi
.SearchItemsV2(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
})
.catch((error) => {
// catch an error.
console.log(error);
});- AccessKey - An alphanumeric token that uniquely identifies you. For information about getting an Access Key, see Register for Product Advertising API.
- SecretKey - A key that is used in conjunction with the Access Key to cryptographically sign an API request. To retrieve your Access Key or Secret Access Key, refer Register for Product Advertising API.
- PartnerTag - An alphanumeric token that uniquely identifies a partner. In case of an associate, this token is the means by which Amazon identifies the Associate to credit for a sale. If the value for
PartnerTypeisAssociate, specify thestore IDortracking IDof a valid associate store from the requested marketplace as the value forPartnerTag. For example, Ifstore-20andstore-21are store id or tracking id of customer in United States and United Kingdom marketplaces respectively, then customer needs to passstore-20asPartnerTagin all PAAPI requests for United States marketplace andstore-21asPartnerTagin all PAAPI requests for United Kingdom marketplace. To obtain an Partner Tag, see Sign up as an Amazon Associate. - PartnerType - The type of Amazon program. For more information on valid values, refer PartnerType Parameter.
- Marketplace - Default value is US. Note: Host and Region are predetermined based on the marketplace value. There's is no need for you to add Host and Region as soon as you specify correct Marketplace value. If your region is not US or .com, please make sure you add the correct Marketplace value.
Due to major change from V4.0 to V5.0, most of the legacy application may not work properly since V4.0 is not supported anymore.
We're currently working on mapping some commonly used operations from the V4.0 and make it available soon to work with the V5.0.
In the mean time, please check amazon documentation on how to map.
-
What are the available resources I can add in the parameter? Please refer to this page.
-
How can I do itemLookup using a UPC or EAN? You can lookup using searchItems operation. Add your UPC or EAN under the keyword parameter. More details here.
-
What if I included an invalid ASIN value in ASIN array parameter? You will get an error response but the result of the valid ASINs are still included in the response data. Please refer to the last portion of this page.
-
Is the addCart Operation still supported in V5.0? It is deprecated, But you can use Add to Cart form to integrate cart on your websites.
If this somehow makes your job a bit easier, please consider dropping few bucks. Your contribution allows me to spend more time improving features of this project.

