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

ae_sdk

v0.6.0

Published

A simple SDK for Aliexpress (dropshipping and affiliate) APIs.

Readme

AliExpress SDK npm version

Typescript CI Publish Downloads Bundle Size License

A simple, lightweight, and fully type-safe SDK for the AliExpress Open Platform APIs. Supports System Authentication, Dropshipping, and Affiliate APIs.

📖 Overview

AliExpress has completely migrated their services from the legacy Taobao Open Platform to the new Open Platform for International Developers. While this update brought significant improvements, they have yet to release an official Node.js SDK for the new platform.

This unofficial SDK bridges that gap by providing a simple, consistent interface for Node.js developers to interact with AliExpress APIs.

✨ Features

This SDK provides several key capabilities:

🔐 Authentication & Security

  • Request Signing - Automatic generation of method signatures required by AliExpress
  • Session Management - Streamlined token generation and refresh flows
  • Error Handling - Consistent error responses with detailed messages

💻 Developer Experience

  • Type Safety - Fully typed parameters and responses for all API methods
  • Intuitive API - Clean, method-based approach to API calls

🛍️ Supported APIs

  • System Authentication - Token generation, refresh, and security token operations
  • Dropshipping API - Product details, order management, shipping calculations, and more
  • Affiliate API - Product discovery, link generation, commission tracking, and reporting

📦 Installation

# Using npm
npm install ae_sdk

# Using pnpm
pnpm add ae_sdk

# Using yarn
yarn add ae_sdk

🚀 Getting Started

Prerequisites

Before using this SDK, you'll need to complete several steps on the AliExpress Open Platform:

  1. Register as a Developer

  2. Create an Application

  3. Get API Credentials

  4. Obtain Access Token

Basic Usage

1. Initialize a Client

Choose the appropriate client based on your needs (System, Dropshipper, or Affiliate):

import { DropshipperClient } from "ae_sdk";

const client = new DropshipperClient({
  app_key: "YOUR_APP_KEY",
  app_secret: "YOUR_APP_SECRET",
  session: "ACCESS_TOKEN_FROM_AUTH_FLOW",
});

2. Make API Calls

Each client provides typed methods for different API operations:

// Get product details
const productResponse = await client.productDetails({
  product_id: 1005004043442825,
  ship_to_country: "US",
  target_currency: "USD",
  target_language: "en",
});

if (productResponse.ok) {
  console.log("Product:", productResponse.data);
}

3. Handle Responses

All API methods return a consistent response structure:

// Successful response
{
  ok: true,
  data: {
    // API-specific response data
    aliexpress_ds_product_get_response: {
      result: { /* product data */ },
      rsp_code: 200,
      rsp_msg: "Call succeeds",
      request_id: "1234567890"
    }
  }
}

// Error response
{
  ok: false,
  message: "Error message explaining what went wrong",
  request_id: "1234567890", // If available
  error_response: {}, // Full AliExpress error response if available
  error: {} // JavaScript Error object if applicable
}

📚 API Examples

System Client

For authentication and token management:

import { AESystemClient } from "ae_sdk";

const systemClient = new AESystemClient({
  app_key: "YOUR_APP_KEY",
  app_secret: "YOUR_APP_SECRET",
  session: "EXISTING_ACCESS_TOKEN", // Optional for some operations
});

// Generate a new token from an authorization code
const tokenResponse = await systemClient.generateToken({
  code: "AUTH_CODE_FROM_REDIRECT",
  uuid: "OPTIONAL_UUID",
});

// Refresh an existing token before it expires
const refreshResponse = await systemClient.refreshToken({
  refresh_token: "REFRESH_TOKEN_FROM_PREVIOUS_AUTH",
});

Affiliate Client

For affiliate marketing operations:

import { AffiliateClient } from "ae_sdk";

const affiliateClient = new AffiliateClient({
  app_key: "YOUR_APP_KEY",
  app_secret: "YOUR_APP_SECRET",
  session: "ACCESS_TOKEN",
});

// Generate affiliate tracking links
const linksResponse = await affiliateClient.generateAffiliateLinks({
  promotion_link_type: 0, // 0 for normal, 2 for hot product link
  source_values: "https://www.aliexpress.com/item/1234567890.html",
  tracking_id: "YOUR_TRACKING_ID",
  app_signature: "YOUR_APP_SIGNATURE",
});

// Find trending products with high commission rates
const hotProductsResponse = await affiliateClient.getHotProducts({
  app_signature: "YOUR_APP_SIGNATURE",
  keywords: "smartphone",
  page_no: 1,
  page_size: 20,
  platform_product_type: "ALL",
  ship_to_country: "US",
  sort: "SALE_PRICE_ASC",
  target_currency: "USD",
  target_language: "EN",
  tracking_id: "YOUR_TRACKING_ID",
});

Dropshipper Client

For dropshipping operations:

import { DropshipperClient } from "ae_sdk";

const dropshipperClient = new DropshipperClient({
  app_key: "YOUR_APP_KEY",
  app_secret: "YOUR_APP_SECRET",
  session: "ACCESS_TOKEN",
});

// Calculate shipping options and costs
const shippingResponse = await dropshipperClient.shippingInfo({
  country_code: "US",
  product_id: 1005004043442825,
  product_num: 2,
  province_code: "CA",
  city_code: "Los Angeles",
  send_goods_country_code: "CN",
  price: "29.99",
});

// Create a dropshipping order
const orderResponse = await dropshipperClient.createOrder({
  logistics_address: {
    address: "123 Main Street",
    city: "Los Angeles",
    country: "US",
    full_name: "John Doe",
    mobile_no: "123-456-7890",
    phone_country: "+1",
    province: "California",
    zip: "90001",
  },
  product_items: [
    {
      logistics_service_name: "AliExpress Standard Shipping",
      order_memo: "Customer order #12345",
      product_count: 2,
      product_id: 1005004043442825,
      sku_attr: "14:350853#Black;5:361386", // SKU specification attributes
    },
  ],
});

🔍 Advanced Usage

Direct API Calls

For APIs not yet included in the SDK:

const response = await client.callAPIDirectly(
  "aliexpress.custom.api.endpoint",
  {
    param1: "value1",
    param2: "value2",
    // Additional parameters as required by the API
  },
);

🤝 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests for:

  • Bug fixes
  • New API endpoint support
  • Documentation improvements
  • Performance optimizations

📄 License

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