npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ayasdev/amazon-ads-sdk

v1.0.8

Published

A comprehensive TypeScript/JavaScript SDK for Amazon Advertising API with full type support

Readme

Amazon Ads SDK

TypeScript/JavaScript SDK for Amazon Advertising API.

⚠️ Important Notice

This SDK is primarily developed for internal use in our company's applications. As such:

  • The API structure may undergo significant changes without prior notice
  • Breaking changes are likely to occur frequently
  • Features may be added or removed based on our internal needs

Recommendation: If you want to use this SDK in your project, we strongly recommend:

  1. Fork the repository
  2. Create your own package under your organization's name
  3. Maintain your own version based on your specific requirements

This approach will give you full control over the SDK's development and protect you from unexpected breaking changes.

Features

  • TypeScript support
  • Environment variables configuration
  • Sandbox mode
  • Sponsored Products API support
    • Campaign management
    • Targeting
    • Keywords
    • Budget rules

Prerequisites

Before using this SDK, you need to:

  1. Set up Amazon Advertising API access - Apply for API Access
  2. Create an LWA application - Create LWA App Guide
  3. Assign API access to users - Assign API Access
  4. Generate authorization credentials - Create Authorization Grant

Installation

npm install @ayasdev/amazon-ads-sdk

or

yarn add @ayasdev/amazon-ads-sdk

Configuration

Environment Variables

Store your credentials securely in a .env file:

AMAZON_CLIENT_ID=your-client-id
AMAZON_CLIENT_SECRET=your-client-secret
AMAZON_REFRESH_TOKEN=your-refresh-token
AMAZON_REGION=EU
SANDBOX_MODE=false

SDK Initialization

import { AmazonAdsSDK } from '@ayasdev/amazon-ads-sdk';

const sdk = new AmazonAdsSDK({
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  refreshToken: 'your-refresh-token',
  region: 'EU', // Supported regions: NA (North America), EU (Europe), FE (Far East)
  sandbox: false // Set to true for sandbox mode
});

API Structure

Sponsored Products (SP) Namespace

SDK structure for the Sponsored Products section of Amazon Advertising API:

sdk.sp
  ├── campaigns
  │   ├── optimization
  │   └── budget
  ├── adGroups
  ├── productAds
  ├── keywords
  │   ├── recommendations
  │   └── negative
  └── targeting
      ├── product
      │   └── promotions
      └── negative
          ├── campaign
          └── api

Campaigns

  • sdk.sp.campaigns: Campaign management (CRUD operations)
  • sdk.sp.campaigns.optimization: Campaign optimization rules
  • sdk.sp.campaigns.budget: Budget management operations

Keywords

  • sdk.sp.keywords: Keyword management
  • sdk.sp.keywords.recommendations: Keyword recommendations
  • sdk.sp.keywords.negative: Negative keyword operations

Targeting

  • sdk.sp.targeting: Targeting operations
  • sdk.sp.targeting.negative.campaign: Campaign-level negative targeting
  • sdk.sp.targeting.negative: Ad group-level negative targeting
  • sdk.sp.targeting.product.promotions: Product promotion targeting

Other Operations

  • sdk.sp.adGroups: Ad group management
  • sdk.sp.productAds: Product ad operations
  • sdk.sp.productRecommendations: Product recommendations

Usage Examples

// Get campaigns
const campaigns = await sdk.sp.campaigns.list(profileId);

// Get ad groups
const adGroups = await sdk.sp.adGroups.list(profileId);

// Get targeting
const targeting = await sdk.sp.targeting.list(profileId);

// Get negative targeting
const negativeTargeting = await sdk.sp.targeting.negative.list(profileId);

Error Handling

try {
  const campaigns = await sdk.sp.campaigns.list(profileId);
} catch (error) {
  if (error.response) {
    // Amazon API error
    console.error('API Error:', error.response.data);
  } else {
    // Network or other error
    console.error('Error:', error.message);
  }
}

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, please open an issue in the GitHub repository or contact the maintainers directly.