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 🙏

© 2026 – Pkg Stats / Ryan Hefner

aliexpress-api-sdk

v1.1.0

Published

Node.js SDK for AliExpress API

Readme

AliExpress API SDK for Node.js

npm version License: MIT

A Node.js SDK for the AliExpress API, making it easy to integrate with AliExpress services in your JavaScript applications. Supports both CommonJS and ESM (ECMAScript Modules), with full TypeScript type definitions.

DISCLAIMER: This is a non-official Node.js implementation of the official AliExpress SDK. It replicates the logic and functionality of the official SDK but is maintained independently. For official support, please refer to the AliExpress Open Platform.

Table of Contents

Installation

npm install aliexpress-api-sdk

Usage

Basic Usage

CommonJS

const aliexpress = require('aliexpress-api-sdk');

// Initialize client with your credentials
const client = new aliexpress.IopClient(
    'https://api-pre.aliexpress.com/sync', 
    'YOUR_APP_KEY',
    'YOUR_APP_SECRET'
);

// Create a request
const request = new aliexpress.IopRequest('aliexpress.logistics.redefining.getlogisticsselleraddresses', 'POST');
request.set_simplify();
request.add_api_param('seller_address_query', 'pickup');

// Execute the request
async function callApi() {
    try {
        const response = await client.execute(request, 'YOUR_ACCESS_TOKEN');

        // Check response status
        console.log('Response type:', response.type);
        console.log('Response code:', response.code);
        console.log('Response message:', response.message);
        console.log('Request ID:', response.request_id);

        // Process response data
        console.log('Response body:', response.body);
    } catch (error) {
        console.error('API call failed:', error);
    }
}

callApi();

ESM (ECMAScript Modules)

import { IopClient, IopRequest } from 'aliexpress-api-sdk';

// Initialize client with your credentials
const client = new IopClient(
    'https://api-pre.aliexpress.com/sync', 
    'YOUR_APP_KEY',
    'YOUR_APP_SECRET'
);

// Create a request
const request = new IopRequest('aliexpress.logistics.redefining.getlogisticsselleraddresses', 'POST');
request.set_simplify();
request.add_api_param('seller_address_query', 'pickup');

// Execute the request
async function callApi() {
    try {
        const response = await client.execute(request, 'YOUR_ACCESS_TOKEN');

        // Check response status
        console.log('Response type:', response.type);
        console.log('Response code:', response.code);
        console.log('Response message:', response.message);
        console.log('Request ID:', response.request_id);

        // Process response data
        console.log('Response body:', response.body);
    } catch (error) {
        console.error('API call failed:', error);
    }
}

callApi();

File Upload

const fs = require('fs');
const aliexpress = require('aliexpress-api-sdk');

// Initialize client
const client = new aliexpress.IopClient(
    'https://api.aliexpress.com/rest',
    'YOUR_APP_KEY',
    'YOUR_APP_SECRET'
);

// Create a request
const request = new aliexpress.IopRequest('/path/to/upload/api');
request.add_api_param('file_name', 'example.jpg');

// Add file parameter
const fileContent = fs.readFileSync('/path/to/your/file.jpg');
request.add_file_param('file_bytes', fileContent);

// Execute the request
client.execute(request, 'YOUR_ACCESS_TOKEN')
    .then(response => {
        console.log('Upload successful:', response.body);
    })
    .catch(error => {
        console.error('Upload failed:', error);
    });

Debug Mode

const aliexpress = require('aliexpress-api-sdk');

// Initialize client
const client = new aliexpress.IopClient(
    'https://api.aliexpress.com/rest',
    'YOUR_APP_KEY',
    'YOUR_APP_SECRET'
);

// Enable debug logging
client.log_level = aliexpress.P_LOG_LEVEL_DEBUG;

// Create and execute request as normal
// ...

API Reference

IopClient

The main client for making API requests.

const client = new aliexpress.IopClient(serverUrl, appKey, appSecret, timeout);

Parameters:

  • serverUrl (string): The API server URL
  • appKey (string): Your application key
  • appSecret (string): Your application secret
  • timeout (number, optional): Request timeout in seconds (default: 30)

Methods:

  • execute(request, accessToken): Execute an API request

Properties:

  • log_level: Set the logging level (P_LOG_LEVEL_DEBUG, P_LOG_LEVEL_INFO, P_LOG_LEVEL_ERROR)

IopRequest

Class for building API requests.

const request = new aliexpress.IopRequest(apiName, httpMethod);

Parameters:

  • apiName (string): The API name or path
  • httpMethod (string, optional): The HTTP method (GET or POST, default: POST)

Methods:

  • add_api_param(key, value): Add an API parameter
  • add_file_param(key, value): Add a file parameter
  • set_simplify(): Set the simplify flag to true
  • set_format(value): Set the response format

IopResponse

Class representing an API response.

Properties:

  • type: Response type (nil, ISP, ISV, SYSTEM)
  • code: Response code (0 for success)
  • message: Response message
  • request_id: Request ID
  • body: Full response body

Methods:

  • toString(): Get string representation of the response

Examples

Getting Product Information

const aliexpress = require('aliexpress-api-sdk');

// Initialize client
const client = new aliexpress.IopClient(
    'https://api.aliexpress.com/rest',
    'YOUR_APP_KEY',
    'YOUR_APP_SECRET'
);

// Create a request to get product details
const request = new aliexpress.IopRequest('aliexpress.ds.product.get');
request.add_api_param('product_id', '1000001234567');

// Execute the request
async function getProductDetails() {
    try {
        const response = await client.execute(request, 'YOUR_ACCESS_TOKEN');

        if (response.code === "0") {
            console.log('Product details:', response.body.aliexpress_ds_product_get_response.result);
        } else {
            console.error('Error:', response.message);
        }
    } catch (error) {
        console.error('API call failed:', error);
    }
}

getProductDetails();

Searching for Products

const aliexpress = require('aliexpress-api-sdk');

// Initialize client
const client = new aliexpress.IopClient(
    'https://api.aliexpress.com/rest',
    'YOUR_APP_KEY',
    'YOUR_APP_SECRET'
);

// Create a request to search for products
const request = new aliexpress.IopRequest('aliexpress.ds.product.search');
request.add_api_param('keywords', 'smartphone');
request.add_api_param('page_size', 20);
request.add_api_param('page_no', 1);

// Execute the request
async function searchProducts() {
    try {
        const response = await client.execute(request, 'YOUR_ACCESS_TOKEN');

        if (response.code === "0") {
            const products = response.body.aliexpress_ds_product_search_response.result.products;
            console.log(`Found ${products.length} products`);
            products.forEach(product => {
                console.log(`- ${product.product_title} (${product.product_id})`);
            });
        } else {
            console.error('Error:', response.message);
        }
    } catch (error) {
        console.error('API call failed:', error);
    }
}

searchProducts();

Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository - Fork the project on GitHub.

  2. Clone your fork - Clone your fork to your local machine:

    git clone https://github.com/your-username/aliexpress-api-sdk.git
    cd aliexpress-api-sdk
  3. Create a branch - Create a new branch for your feature or bugfix:

    git checkout -b feature/your-feature-name
  4. Make your changes - Implement your feature or fix the bug and commit your changes:

    git commit -m "Add feature or fix bug"
  5. Push your changes - Push your changes to your fork:

    git push origin feature/your-feature-name
  6. Create a Pull Request - Go to the original repository and create a pull request from your branch.

Development Guidelines

  • Follow the existing code style
  • Add tests for new features
  • Update documentation for any changes
  • Make sure all tests pass before submitting a pull request

Publishing

This package uses GitHub Actions for automated publishing to npm. The workflow can be triggered manually from the GitHub Actions tab:

  1. Go to the "Actions" tab in the GitHub repository
  2. Select the "Publish to npm" workflow
  3. Click "Run workflow"
  4. Optionally specify a new version (e.g., "patch", "minor", "major", or a specific version)
  5. Click "Run workflow" to start the publishing process

Note: Publishing requires an NPM_TOKEN secret to be configured in the repository settings.

License

MIT