{"id":22253026,"url":"https://github.com/moh3a/ae_sdk","last_synced_at":"2025-10-27T15:16:06.349Z","repository":{"id":193592504,"uuid":"689122808","full_name":"moh3a/ae_sdk","owner":"moh3a","description":"A simple SDK for Aliexpress (dropshipping and affiliate) APIs.","archived":false,"fork":false,"pushed_at":"2024-11-30T10:00:15.000Z","size":208,"stargazers_count":29,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-30T11:18:00.227Z","etag":null,"topics":["ae","aliexpress","sdk","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moh3a.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-08T21:26:55.000Z","updated_at":"2024-11-30T10:00:20.000Z","dependencies_parsed_at":"2023-11-14T19:25:12.871Z","dependency_job_id":"7e7b86a9-165c-4e95-b572-f15776508ed9","html_url":"https://github.com/moh3a/ae_sdk","commit_stats":null,"previous_names":["moh3a/ae_sdk"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moh3a%2Fae_sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moh3a%2Fae_sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moh3a%2Fae_sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moh3a%2Fae_sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moh3a","download_url":"https://codeload.github.com/moh3a/ae_sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227323949,"owners_count":17764612,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ae","aliexpress","sdk","typescript"],"created_at":"2024-12-03T07:15:45.142Z","updated_at":"2025-10-27T15:16:06.223Z","avatar_url":"https://github.com/moh3a.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AliExpress SDK ![npm version](https://img.shields.io/npm/v/ae_sdk?label=)\n\n![Typescript](https://img.shields.io/badge/-TypeScript-007ACC?style=flat-square\u0026logo=typescript\u0026logoColor=white)\n![CI](https://img.shields.io/github/actions/workflow/status/moh3a/ae_sdk/main.yml?logo=githubactions\u0026logoColor=white\u0026label=CI)\n![Publish](https://img.shields.io/github/actions/workflow/status/moh3a/ae_sdk/publish.yml?logo=githubactions\u0026logoColor=white\u0026label=Publish)\n[![Downloads](https://img.shields.io/npm/dw/ae_sdk?logo=npm)](https://www.npmjs.com/package/ae_sdk)\n[![Bundle Size](https://img.shields.io/bundlephobia/minzip/ae_sdk?label=size\u0026logo=npm)](https://bundlephobia.com/package/ae_sdk)\n[![License](https://img.shields.io/github/license/moh3a/ae_sdk)](https://github.com/moh3a/ae_sdk/blob/master/LICENSE)\n\nA simple, lightweight, and fully type-safe SDK for the AliExpress Open Platform APIs. Supports System Authentication, Dropshipping, and Affiliate APIs.\n\n## 📖 Overview\n\nAliExpress has completely migrated their services from the legacy [Taobao Open Platform](https://developers.aliexpress.com) to the new [Open Platform for International Developers](https://openservice.aliexpress.com). While this update brought significant improvements, [they have yet to release an official Node.js SDK](https://openservice.aliexpress.com/doc/doc.htm?nodeId=27493\u0026docId=118729#/?docId=1371) for the new platform.\n\nThis unofficial SDK bridges that gap by providing a simple, consistent interface for Node.js developers to interact with AliExpress APIs.\n\n## ✨ Features\n\nThis SDK provides several key capabilities:\n\n### 🔐 Authentication \u0026 Security\n\n- **Request Signing** - Automatic generation of method signatures required by AliExpress\n- **Session Management** - Streamlined token generation and refresh flows\n- **Error Handling** - Consistent error responses with detailed messages\n\n### 💻 Developer Experience\n\n- **Type Safety** - Fully typed parameters and responses for all API methods\n- **Intuitive API** - Clean, method-based approach to API calls\n\n### 🛍️ Supported APIs\n\n- **System Authentication** - Token generation, refresh, and security token operations\n- **Dropshipping API** - Product details, order management, shipping calculations, and more\n- **Affiliate API** - Product discovery, link generation, commission tracking, and reporting\n\n## 📦 Installation\n\n```sh\n# Using npm\nnpm install ae_sdk\n\n# Using pnpm\npnpm add ae_sdk\n\n# Using yarn\nyarn add ae_sdk\n```\n\n## 🚀 Getting Started\n\n### Prerequisites\n\nBefore using this SDK, you'll need to complete several steps on the AliExpress Open Platform:\n\n1. **Register as a Developer**\n\n   - Create or use an existing AliExpress account\n   - Register as a developer at [AliExpress Open Platform](https://openservice.aliexpress.com/)\n   - [Detailed registration guide](https://openservice.aliexpress.com/doc/doc.htm?nodeId=27493\u0026docId=118729#/?docId=1362)\n\n2. **Create an Application**\n\n   - Register a new application on the platform\n   - [Application registration guide](https://openservice.aliexpress.com/doc/doc.htm?nodeId=27493\u0026docId=118729#/?docId=1361)\n\n3. **Get API Credentials**\n\n   - Retrieve your `app_key` and `app_secret` from your registered application\n   - [Credential retrieval guide](https://openservice.aliexpress.com/doc/doc.htm?nodeId=27493\u0026docId=118729#/?docId=1360)\n\n4. **Obtain Access Token**\n   - Guide users through the authorization flow to get an access token\n   - [Authorization flow guide](https://openservice.aliexpress.com/doc/doc.htm?nodeId=27493\u0026docId=118729#/?docId=1364)\n\n### Basic Usage\n\n#### 1. Initialize a Client\n\nChoose the appropriate client based on your needs (System, Dropshipper, or Affiliate):\n\n```typescript\nimport { DropshipperClient } from \"ae_sdk\";\n\nconst client = new DropshipperClient({\n  app_key: \"YOUR_APP_KEY\",\n  app_secret: \"YOUR_APP_SECRET\",\n  session: \"ACCESS_TOKEN_FROM_AUTH_FLOW\",\n});\n```\n\n#### 2. Make API Calls\n\nEach client provides typed methods for different API operations:\n\n```typescript\n// Get product details\nconst productResponse = await client.productDetails({\n  product_id: 1005004043442825,\n  ship_to_country: \"US\",\n  target_currency: \"USD\",\n  target_language: \"en\",\n});\n\nif (productResponse.ok) {\n  console.log(\"Product:\", productResponse.data);\n}\n```\n\n#### 3. Handle Responses\n\nAll API methods return a consistent response structure:\n\n```typescript\n// Successful response\n{\n  ok: true,\n  data: {\n    // API-specific response data\n    aliexpress_ds_product_get_response: {\n      result: { /* product data */ },\n      rsp_code: 200,\n      rsp_msg: \"Call succeeds\",\n      request_id: \"1234567890\"\n    }\n  }\n}\n\n// Error response\n{\n  ok: false,\n  message: \"Error message explaining what went wrong\",\n  request_id: \"1234567890\", // If available\n  error_response: {}, // Full AliExpress error response if available\n  error: {} // JavaScript Error object if applicable\n}\n```\n\n## 📚 API Examples\n\n### System Client\n\nFor authentication and token management:\n\n```typescript\nimport { AESystemClient } from \"ae_sdk\";\n\nconst systemClient = new AESystemClient({\n  app_key: \"YOUR_APP_KEY\",\n  app_secret: \"YOUR_APP_SECRET\",\n  session: \"EXISTING_ACCESS_TOKEN\", // Optional for some operations\n});\n\n// Generate a new token from an authorization code\nconst tokenResponse = await systemClient.generateToken({\n  code: \"AUTH_CODE_FROM_REDIRECT\",\n  uuid: \"OPTIONAL_UUID\",\n});\n\n// Refresh an existing token before it expires\nconst refreshResponse = await systemClient.refreshToken({\n  refresh_token: \"REFRESH_TOKEN_FROM_PREVIOUS_AUTH\",\n});\n```\n\n### Affiliate Client\n\nFor affiliate marketing operations:\n\n```typescript\nimport { AffiliateClient } from \"ae_sdk\";\n\nconst affiliateClient = new AffiliateClient({\n  app_key: \"YOUR_APP_KEY\",\n  app_secret: \"YOUR_APP_SECRET\",\n  session: \"ACCESS_TOKEN\",\n});\n\n// Generate affiliate tracking links\nconst linksResponse = await affiliateClient.generateAffiliateLinks({\n  promotion_link_type: 0, // 0 for normal, 2 for hot product link\n  source_values: \"https://www.aliexpress.com/item/1234567890.html\",\n  tracking_id: \"YOUR_TRACKING_ID\",\n  app_signature: \"YOUR_APP_SIGNATURE\",\n});\n\n// Find trending products with high commission rates\nconst hotProductsResponse = await affiliateClient.getHotProducts({\n  app_signature: \"YOUR_APP_SIGNATURE\",\n  keywords: \"smartphone\",\n  page_no: 1,\n  page_size: 20,\n  platform_product_type: \"ALL\",\n  ship_to_country: \"US\",\n  sort: \"SALE_PRICE_ASC\",\n  target_currency: \"USD\",\n  target_language: \"EN\",\n  tracking_id: \"YOUR_TRACKING_ID\",\n});\n```\n\n### Dropshipper Client\n\nFor dropshipping operations:\n\n```typescript\nimport { DropshipperClient } from \"ae_sdk\";\n\nconst dropshipperClient = new DropshipperClient({\n  app_key: \"YOUR_APP_KEY\",\n  app_secret: \"YOUR_APP_SECRET\",\n  session: \"ACCESS_TOKEN\",\n});\n\n// Calculate shipping options and costs\nconst shippingResponse = await dropshipperClient.shippingInfo({\n  country_code: \"US\",\n  product_id: 1005004043442825,\n  product_num: 2,\n  province_code: \"CA\",\n  city_code: \"Los Angeles\",\n  send_goods_country_code: \"CN\",\n  price: \"29.99\",\n});\n\n// Create a dropshipping order\nconst orderResponse = await dropshipperClient.createOrder({\n  logistics_address: {\n    address: \"123 Main Street\",\n    city: \"Los Angeles\",\n    country: \"US\",\n    full_name: \"John Doe\",\n    mobile_no: \"123-456-7890\",\n    phone_country: \"+1\",\n    province: \"California\",\n    zip: \"90001\",\n  },\n  product_items: [\n    {\n      logistics_service_name: \"AliExpress Standard Shipping\",\n      order_memo: \"Customer order #12345\",\n      product_count: 2,\n      product_id: 1005004043442825,\n      sku_attr: \"14:350853#Black;5:361386\", // SKU specification attributes\n    },\n  ],\n});\n```\n\n## 🔍 Advanced Usage\n\n### Direct API Calls\n\nFor APIs not yet included in the SDK:\n\n```typescript\nconst response = await client.callAPIDirectly(\n  \"aliexpress.custom.api.endpoint\",\n  {\n    param1: \"value1\",\n    param2: \"value2\",\n    // Additional parameters as required by the API\n  },\n);\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Feel free to open issues or submit pull requests for:\n\n- Bug fixes\n- New API endpoint support\n- Documentation improvements\n- Performance optimizations\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/moh3a/ae_sdk/blob/master/LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoh3a%2Fae_sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoh3a%2Fae_sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoh3a%2Fae_sdk/lists"}