Integration of Online Store with AliExpress (API)
AliExpress provides API for sellers through AliExpress Open Platform. Integration allows managing products, prices, stock levels, and orders on the global marketplace.
Authentication via TOP Protocol
import hashlib
import hmac
import time
class AliexpressClient:
def __init__(self, app_key: str, app_secret: str, access_token: str):
self.app_key = app_key
self.app_secret = app_secret
self.access_token = access_token
def _sign(self, params: dict) -> str:
sorted_params = sorted(params.items())
sign_string = self.app_secret
for k, v in sorted_params:
sign_string += f"{k}{v}"
sign_string += self.app_secret
return hashlib.md5(sign_string.encode()).hexdigest().upper()
def call(self, method: str, params: dict) -> dict:
base_params = {
'method': method,
'app_key': self.app_key,
'timestamp': str(int(time.time() * 1000)),
'format': 'json',
'v': '2.0',
'session': self.access_token,
**params
}
base_params['sign'] = self._sign(base_params)
resp = requests.post('https://api.taobao.com/router/rest', data=base_params)
return resp.json()
Publishing a Product
def publish_product(self, product: dict) -> str:
result = self.call('aliexpress.solution.product.schema.get', {
'subject': product['name'],
'local_price': product['price'],
'currency_code': 'USD',
})
return result.get('result', {}).get('product_id')
Stock Synchronization
def update_inventory(self, product_id: str, sku_list: list) -> None:
self.call('aliexpress.ds.add.info', {
'product_id': product_id,
'sku_stock_info': json.dumps([{
'skuAttr': sku['attributes'],
'quantity': sku['stock'],
'price': sku['price'],
} for sku in sku_list]),
})
Getting Orders
def get_orders(self, start_time: str, end_time: str) -> list:
result = self.call('aliexpress.trade.ds.order.get', {
'create_time_start': start_time,
'create_time_end': end_time,
'page_size': 50,
})
return result.get('result', {}).get('order_list', {}).get('order_dto', [])
AliExpress API Specifics
- Requires registration as AliExpress seller
- Content for EU requires compliance with Product Safety Regulation
- API works through a single endpoint (
api.taobao.com) for all operations with method in parameter - All amounts in USD for global marketplace
Timeline
Registration in AliExpress Open Platform: 1–2 weeks. Integration: 14–20 business days.







