Skip to main content
RapidDev - Software Development Agency
bolt-ai-integrationsBolt Chat + API Route

How to Integrate Bolt.new with AliExpress Affiliate API

To integrate AliExpress's Affiliate API with Bolt.new, register as an AliExpress affiliate, generate HMAC-signed API requests through a Next.js API route, and search products with filters for price, ratings, and shipping. The app key and app secret must never appear in client code — all HMAC signature generation happens server-side. Outbound calls to AliExpress's API work in Bolt's WebContainer preview, so you can build and test product search immediately.

What you'll learn

  • How to register as an AliExpress affiliate and obtain app key and app secret credentials
  • How to generate HMAC-MD5 signatures for AliExpress API authentication in a Next.js API route
  • How to search AliExpress products with filters for price, ratings, and shipping type
  • How to display product results in a comparison grid with affiliate tracking links
  • How to implement the dropshipping research workflow: search, evaluate, and import product data
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate18 min read30 minutesE-commerceApril 2026RapidDev Engineering Team
TL;DR

To integrate AliExpress's Affiliate API with Bolt.new, register as an AliExpress affiliate, generate HMAC-signed API requests through a Next.js API route, and search products with filters for price, ratings, and shipping. The app key and app secret must never appear in client code — all HMAC signature generation happens server-side. Outbound calls to AliExpress's API work in Bolt's WebContainer preview, so you can build and test product search immediately.

Build Dropshipping Product Research Tools with AliExpress API in Bolt.new

The AliExpress Affiliate API is one of the most practical tools for dropshipping entrepreneurs — it provides structured access to AliExpress's vast product catalog including real prices, shipping information, seller ratings, product images, and customer review scores. Unlike scraping or manual browsing, the API returns clean JSON data you can process, filter, and display in custom interfaces. Bolt.new's WebContainer architecture handles all outbound HTTPS calls to AliExpress's servers without issues, so you can build and test product research tools entirely within Bolt's preview.

The typical dropshipping workflow this integration enables: search AliExpress for products using keywords and filters (price range, minimum order quantity, shipping type, seller rating), evaluate results by comparing profit margins against retail prices on other platforms, select promising products, extract the product data (images, descriptions, variants, pricing), and either import to a storefront like WooCommerce or Shopify, or present to end customers directly. Custom product research tools built in Bolt often outperform the native AliExpress interface for finding specific niche products because you can apply multiple simultaneous filters the native search does not support.

The most important technical constraint is HMAC signature generation. AliExpress Affiliate API requires every request to be signed with an HMAC-MD5 (or HMAC-SHA256 for newer endpoints) signature computed from your request parameters and your app secret. This signing process must happen server-side — the app secret is the signing key and must never be exposed in browser code. Bolt's Next.js API route pattern handles this perfectly: your React components request products from your own `/api/aliexpress` route, which generates the signature and calls AliExpress's actual API with the signed request.

Integration method

Bolt Chat + API Route

Bolt generates a Next.js API route that generates HMAC-SHA256 signatures server-side, authenticates with the AliExpress Affiliate API, and proxies product search results to React components. Your app key and app secret never reach the client. Outbound HTTPS calls to AliExpress work in Bolt's WebContainer for immediate development and preview testing.

Prerequisites

  • A Bolt.new account with a Next.js project
  • An AliExpress account (standard shopping account at aliexpress.com)
  • An AliExpress Affiliate account registered at portals.aliexpress.com (requires application approval)
  • An application created in the AliExpress Developer Portal with app key and app secret
  • Basic understanding of the dropshipping workflow and what product data you need

Step-by-step guide

1

Register as an AliExpress Affiliate and Create a Developer Application

Access to the AliExpress Affiliate API requires two registration steps. First, join the AliExpress affiliate program at portals.aliexpress.com. Click 'Sign Up' and use your existing AliExpress shopping account or create a new one. The affiliate application asks for your website URL and traffic sources — be honest about your intended use (building a custom dropshipping research tool or storefront). Approval typically takes 1-3 business days. During this waiting period you can still explore the developer documentation. Once approved, the second step is creating a developer application. In the affiliate portal, navigate to Tools > API or Developer Center. Click 'Create Application' and provide an application name and description. You can select the AliExpress Affiliate API access. After submitting, AliExpress assigns your application an App Key and App Secret. The App Key is like a public identifier for your application; the App Secret is a private signing key used to generate HMAC signatures for every API request. Write down both your App Key and App Secret. The App Secret is shown only when the application is first created — if you lose it, you can regenerate it in the portal, but doing so invalidates all existing signatures and requires updating your `.env` file. For the affiliate tracking to work properly (to earn commission on referrals), you will also need your Tracking ID (also called publisher ID or PID) from the affiliate dashboard. This is added to product URLs as a parameter to attribute purchases to your affiliate account.

Pro tip: AliExpress has two API environments: International (aliexpress.com) and Russia (aliexpress.ru). Use the International API at api-sg.aliexpress.com for most use cases. The API endpoint differs for Russian market focus.

Expected result: You have an AliExpress Affiliate App Key, App Secret, and Tracking ID ready to configure in your Bolt project's .env file.

2

Implement HMAC Signature Generation in the API Route

AliExpress Affiliate API requires every request to include an HMAC signature. This is a security mechanism that proves the request was made by someone with your App Secret and prevents request tampering. The signing process has several specific steps that must be implemented exactly. The signature algorithm: (1) collect all request parameters including method name, app key, timestamp, and all query parameters; (2) sort parameters alphabetically by key name; (3) concatenate them as `key1value1key2value2...` (no separators, no equals signs, no URL encoding); (4) prepend and append your App Secret to this concatenated string; (5) compute HMAC-MD5 of the full string (with App Secret as the HMAC key for newer endpoints, or wrapped around the parameter string for legacy endpoints); (6) convert to uppercase hexadecimal. The exact algorithm varies slightly between API versions — the example below implements the approach for the AliExpress Affiliate API v2. The signing must happen server-side in your Next.js API route because the App Secret is the HMAC key or wrapper. Anyone who sees the App Secret can forge signatures and make API calls under your affiliate account. Your React components must only call your own `/api/aliexpress` route — they should never receive or see the App Secret. The timestamp parameter in signatures is Unix timestamp in seconds; AliExpress accepts requests within a ±15 minute window from the timestamp, so clock synchronization is not a concern in practice.

Bolt.new Prompt

Create a Next.js API route at app/api/aliexpress/route.ts that implements AliExpress Affiliate API signature generation. The signing process: sort all params alphabetically, concatenate as key+value pairs (no separators), wrap with app secret before and after, then compute MD5 hash and uppercase. Use ALIEXPRESS_APP_KEY and ALIEXPRESS_APP_SECRET from process.env. Implement a search action that calls aliexpress.affiliate.product.query method. Return formatted product data with title, price, imageUrl, productUrl, rating, and orders.

Paste this in Bolt.new chat

app/api/aliexpress/route.ts
1// app/api/aliexpress/route.ts
2import { NextResponse } from 'next/server';
3import crypto from 'crypto';
4
5const APP_KEY = process.env.ALIEXPRESS_APP_KEY || '';
6const APP_SECRET = process.env.ALIEXPRESS_APP_SECRET || '';
7const API_BASE = 'https://api-sg.aliexpress.com/sync';
8const TRACKING_ID = process.env.ALIEXPRESS_TRACKING_ID || '';
9
10function generateSign(params: Record<string, string>): string {
11 // Step 1: Sort parameters alphabetically by key
12 const sortedKeys = Object.keys(params).sort();
13
14 // Step 2: Concatenate as key+value (no separators, no encoding)
15 const paramString = sortedKeys.map(key => `${key}${params[key]}`).join('');
16
17 // Step 3: Wrap with App Secret and compute MD5
18 const stringToSign = `${APP_SECRET}${paramString}${APP_SECRET}`;
19
20 return crypto
21 .createHash('md5')
22 .update(stringToSign, 'utf8')
23 .digest('hex')
24 .toUpperCase();
25}
26
27export async function GET(request: Request) {
28 const { searchParams } = new URL(request.url);
29 const action = searchParams.get('action');
30
31 if (!APP_KEY || !APP_SECRET) {
32 return NextResponse.json(
33 { error: 'AliExpress API credentials not configured' },
34 { status: 500 }
35 );
36 }
37
38 if (action === 'search') {
39 const query = searchParams.get('q') || '';
40 const pageNo = searchParams.get('page') || '1';
41 const pageSize = searchParams.get('size') || '20';
42 const minSalePrice = searchParams.get('minPrice') || '';
43 const maxSalePrice = searchParams.get('maxPrice') || '';
44 const sort = searchParams.get('sort') || 'SALE_PRICE_ASC';
45 const trackingId = TRACKING_ID || 'default';
46
47 const timestamp = String(Date.now());
48
49 const params: Record<string, string> = {
50 app_key: APP_KEY,
51 method: 'aliexpress.affiliate.product.query',
52 timestamp,
53 sign_method: 'md5',
54 v: '2.0',
55 format: 'json',
56 // API-specific params:
57 keywords: query,
58 page_no: pageNo,
59 page_size: pageSize,
60 tracking_id: trackingId,
61 sort,
62 target_currency: 'USD',
63 target_language: 'EN',
64 ...(minSalePrice && { min_sale_price: minSalePrice }),
65 ...(maxSalePrice && { max_sale_price: maxSalePrice }),
66 };
67
68 params.sign = generateSign(params);
69
70 const queryString = new URLSearchParams(params).toString();
71 const response = await fetch(`${API_BASE}?${queryString}`);
72
73 if (!response.ok) {
74 return NextResponse.json({ error: `AliExpress API error: ${response.status}` }, { status: 502 });
75 }
76
77 const data = await response.json();
78 const result = data?.aliexpress_affiliate_product_query_response?.resp_result;
79
80 if (result?.resp_code !== 200) {
81 return NextResponse.json(
82 { error: result?.resp_msg || 'API returned error' },
83 { status: 400 }
84 );
85 }
86
87 const products = result?.result?.products?.product || [];
88
89 const formatted = products.map((p: {
90 product_id: string;
91 product_title: string;
92 sale_price: string;
93 original_price: string;
94 product_main_image_url: string;
95 evaluate_rate: string;
96 lastest_volume: number;
97 promotion_link: string;
98 ship_to_days: string;
99 }) => ({
100 id: p.product_id,
101 title: p.product_title,
102 price: parseFloat(p.sale_price),
103 originalPrice: parseFloat(p.original_price),
104 imageUrl: p.product_main_image_url,
105 rating: p.evaluate_rate,
106 orders: p.lastest_volume,
107 affiliateUrl: p.promotion_link, // Contains your tracking ID
108 shippingDays: p.ship_to_days,
109 }));
110
111 return NextResponse.json({
112 products: formatted,
113 total: result?.result?.total_record_count || 0,
114 });
115 }
116
117 return NextResponse.json({ error: 'Unknown action' }, { status: 400 });
118}

Pro tip: The AliExpress API signature is case-sensitive. The App Secret, method names, and parameter values must match exactly — including capitalization of sort values like 'SALE_PRICE_ASC'.

Expected result: The API route generates valid HMAC signatures and returns AliExpress product search results. Test with a search query and verify the response contains product titles, prices, and affiliate URLs.

3

Configure Environment Variables

Add your AliExpress credentials to the `.env` file in your Bolt project root. These are server-side variables and must not have the `NEXT_PUBLIC_` prefix — they need to stay in your Next.js API routes and never reach browser-side code. The ALIEXPRESS_APP_SECRET in particular is a signing key that must be kept confidential. The `ALIEXPRESS_TRACKING_ID` is your affiliate tracking identifier (also called publisher ID or PID). This ID is embedded in all product affiliate URLs you return to users — when a user clicks through and makes a purchase on AliExpress, the purchase is attributed to your affiliate account and you earn commission. Find your Tracking ID in the AliExpress affiliate portal under Account > Tracking IDs. After saving the `.env` file, restart the Bolt development server. Test the integration by navigating to `/api/aliexpress?action=search&q=phone+case&size=5` in the Bolt preview — you should see JSON with 5 phone case products from AliExpress with prices, ratings, and affiliate URLs.

Bolt.new Prompt

Add AliExpress environment variables to .env: ALIEXPRESS_APP_KEY, ALIEXPRESS_APP_SECRET, ALIEXPRESS_TRACKING_ID. Add an /api/aliexpress/health route that verifies credentials are present and makes a minimal test API call. Display an error card if credentials are missing.

Paste this in Bolt.new chat

.env
1# .env
2ALIEXPRESS_APP_KEY=your-app-key-here
3ALIEXPRESS_APP_SECRET=your-app-secret-here
4ALIEXPRESS_TRACKING_ID=your-tracking-id-here

Pro tip: Your AliExpress Tracking ID looks like a long alphanumeric string (e.g., 'mm_123456789_987654321_1234567890'). You can create multiple tracking IDs for different campaigns or websites.

Expected result: Environment variables are configured. The API route returns real AliExpress product data when tested with a search query in the Bolt preview.

4

Build the Product Comparison Grid

With the API route returning product data, build a React component that displays AliExpress products in a comparison-friendly grid. The key information dropshippers need at a glance: product image, title, current sale price vs original price (showing discount percentage), seller rating, order count (proxy for demand), and shipping estimate. The affiliate URL should be the link for every product. For the discount percentage calculation: `discountPct = Math.round((1 - salePrice / originalPrice) * 100)`. Products with high discounts relative to original price are often good candidates for dropshipping since you can market the value angle. The orders count (lastest_volume in the API) is a proxy for product demand and supplier reliability — products with thousands of orders have proven demand and presumably reliable suppliers. For the profit margin calculator, add an input field where the user enters their planned selling price. Subtract the AliExpress sale price and estimated shipping to show expected profit and margin percentage. This helps quickly identify which products have viable margins for the target market. The affiliate URLs returned by the API (`promotion_link`) already include your tracking ID. When users click these links and make purchases on AliExpress within the attribution window (typically 30 days), you earn commission. Display these as 'Source on AliExpress' buttons — do not hide the fact they are affiliate links.

Bolt.new Prompt

Build an AliExpress product comparison grid component. Call /api/aliexpress?action=search with the search query. Display products in a responsive 2-4 column grid. Each card shows: product image, title (2 lines max), sale price in green, original price struck through in gray with discount % badge, star rating, order count formatted with K for thousands, shipping days estimate, and an affiliate 'Source on AliExpress' link button. Add a profit calculator that takes a selling price input and shows estimated margin per product.

Paste this in Bolt.new chat

components/AliExpressGrid.tsx
1// components/AliExpressGrid.tsx
2import { useState } from 'react';
3
4interface AliProduct {
5 id: string;
6 title: string;
7 price: number;
8 originalPrice: number;
9 imageUrl: string;
10 rating: string;
11 orders: number;
12 affiliateUrl: string;
13 shippingDays: string;
14}
15
16export function AliExpressGrid() {
17 const [query, setQuery] = useState('');
18 const [sellingPrice, setSellingPrice] = useState('');
19 const [products, setProducts] = useState<AliProduct[]>([]);
20 const [total, setTotal] = useState(0);
21 const [loading, setLoading] = useState(false);
22
23 const search = async () => {
24 if (!query.trim()) return;
25 setLoading(true);
26 const res = await fetch(`/api/aliexpress?action=search&q=${encodeURIComponent(query)}&size=20`);
27 const data = await res.json();
28 setProducts(data.products || []);
29 setTotal(data.total || 0);
30 setLoading(false);
31 };
32
33 const discount = (sale: number, orig: number) =>
34 orig > sale ? Math.round((1 - sale / orig) * 100) : 0;
35
36 const formatOrders = (n: number) =>
37 n >= 1000 ? `${(n / 1000).toFixed(1)}K` : String(n);
38
39 const margin = (cost: number) => {
40 const sell = parseFloat(sellingPrice);
41 if (!sell || sell <= cost) return null;
42 const profit = sell - cost;
43 const pct = ((profit / sell) * 100).toFixed(0);
44 return { profit: profit.toFixed(2), pct };
45 };
46
47 return (
48 <div className="p-4">
49 <div className="flex gap-2 mb-4">
50 <input value={query} onChange={e => setQuery(e.target.value)}
51 onKeyDown={e => e.key === 'Enter' && search()}
52 placeholder="Search AliExpress products..."
53 className="flex-1 border rounded px-3 py-2" />
54 <input value={sellingPrice} onChange={e => setSellingPrice(e.target.value)}
55 placeholder="Your selling price ($)"
56 type="number" step="0.01"
57 className="w-44 border rounded px-3 py-2" />
58 <button onClick={search} className="bg-orange-500 text-white px-4 py-2 rounded">
59 Search
60 </button>
61 </div>
62 {total > 0 && <p className="text-sm text-gray-500 mb-3">{total.toLocaleString()} products found</p>}
63 {loading && <div className="text-center py-12 text-gray-500">Searching AliExpress...</div>}
64 <div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
65 {products.map(p => {
66 const d = discount(p.price, p.originalPrice);
67 const m = margin(p.price);
68 return (
69 <div key={p.id} className="border rounded-lg p-3 flex flex-col">
70 <div className="relative">
71 <img src={p.imageUrl} alt={p.title} className="w-full h-40 object-contain" />
72 {d > 0 && (
73 <span className="absolute top-1 right-1 bg-red-500 text-white text-xs px-1 rounded">
74 -{d}%
75 </span>
76 )}
77 </div>
78 <p className="text-sm font-medium line-clamp-2 mt-2 flex-1">{p.title}</p>
79 <div className="mt-2">
80 <span className="text-lg font-bold text-orange-600">${p.price.toFixed(2)}</span>
81 {p.originalPrice > p.price && (
82 <span className="text-xs text-gray-400 line-through ml-1">${p.originalPrice.toFixed(2)}</span>
83 )}
84 </div>
85 <div className="flex items-center gap-2 text-xs text-gray-500 mt-1">
86 <span> {p.rating}</span>
87 <span>{formatOrders(p.orders)} orders</span>
88 </div>
89 {p.shippingDays && (
90 <p className="text-xs text-gray-400 mt-1">Ships in ~{p.shippingDays} days</p>
91 )}
92 {m && (
93 <div className="mt-2 p-2 bg-green-50 rounded text-xs">
94 <span className="font-medium text-green-700">Margin: ${m.profit} ({m.pct}%)</span>
95 </div>
96 )}
97 <a href={p.affiliateUrl} target="_blank" rel="noopener noreferrer"
98 className="mt-2 block text-center bg-orange-100 text-orange-700 text-sm py-1.5 rounded hover:bg-orange-200">
99 Source on AliExpress
100 </a>
101 </div>
102 );
103 })}
104 </div>
105 </div>
106 );
107}

Pro tip: The 'orders' count (lastest_volume) is a rolling 30-day order count, not all-time. Products with 500+ orders in 30 days have strong demand; under 10 may indicate a new or failing product.

Expected result: The product grid displays AliExpress results with images, prices, discount badges, ratings, and order counts. The margin calculator shows profit estimates for each product based on the selling price entered.

5

Deploy for Production Use

AliExpress product searches and affiliate link generation work fully in Bolt's WebContainer preview — there are no webhook dependencies or OAuth callback requirements for the core search functionality. You can build and test the complete product research tool during development without deploying. For production deployment, push your project to GitHub from Bolt's Git panel and import the repository in Netlify. In Netlify's environment variables, add ALIEXPRESS_APP_KEY, ALIEXPRESS_APP_SECRET, and ALIEXPRESS_TRACKING_ID with your actual credential values. The Next.js build compiles your API route as a Netlify serverless function, and the app deploys with full AliExpress integration. For high-traffic production apps, consider implementing response caching. AliExpress product search results do not change in real time — prices and availability update periodically but not second by second. Caching search results for 5-10 minutes significantly reduces API calls, improves response speed, and keeps you well within AliExpress's API rate limits. You can implement simple in-memory caching in the API route as shown in the code, or use Bolt Cloud's KV storage or a Redis instance for persistent caching across serverless function invocations. For compliance with the AliExpress affiliate program terms, ensure your app clearly discloses the affiliate relationship when displaying product links. A simple footer note like 'Product links are affiliate links — we earn a commission on purchases' is typically sufficient and required by affiliate program terms of service.

Bolt.new Prompt

Add production-ready features to the AliExpress integration: 1) Response caching with a 5-minute TTL using a Map in the API route, 2) Rate limit handling (retry after 1 second on 429 responses), 3) A clear 'Affiliate disclosure' notice in the UI footer. Test with multiple different search queries to verify caching works.

Paste this in Bolt.new chat

app/api/aliexpress/route.ts
1// Simple caching layer for the API route
2const searchCache = new Map<string, { data: unknown; expires: number }>();
3const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
4
5export async function GET(request: Request) {
6 const cacheKey = request.url;
7 const cached = searchCache.get(cacheKey);
8 if (cached && cached.expires > Date.now()) {
9 return NextResponse.json(cached.data);
10 }
11 // ... run the API call ...
12 searchCache.set(cacheKey, { data: result, expires: Date.now() + CACHE_TTL });
13 return NextResponse.json(result);
14}

Pro tip: The AliExpress Affiliate API has a default rate limit of 500 requests per day for new applications. Apply for increased limits in the developer portal if your production app needs more.

Expected result: The app is deployed to Netlify with production credentials. Caching reduces AliExpress API calls. The affiliate disclosure is visible to users.

Common use cases

Dropshipping Product Research Dashboard

Build a product research tool that searches AliExpress, filters by price range and minimum order, and calculates profit margins by letting the user input a target selling price. Display results sorted by rating with estimated shipping times and order counts to identify proven products with market demand.

Bolt.new Prompt

Build an AliExpress product research tool. Create a Next.js API route at /api/aliexpress/search that generates HMAC-MD5 signatures using ALIEXPRESS_APP_KEY and ALIEXPRESS_APP_SECRET from process.env, then calls the AliExpress Affiliate API (aliexpress.affiliate.product.query) to search products. Accept query, minPrice, maxPrice, minSalePrice, sortBy, and pageNo params. Return product title, price, original price, imageUrl, rating, orders count, and product URL. Build a React dashboard with search filters, a margin calculator field (user inputs selling price), and results in a sortable data table.

Copy this prompt to try it in Bolt.new

Niche Product Comparison Grid

Create a product comparison interface that shows multiple AliExpress results for the same niche side by side, with image, price, supplier rating, shipping cost, and minimum order quantity. Includes affiliate tracking links so the tool generates commission on referrals. Useful for entrepreneurs evaluating multiple suppliers for the same product category.

Bolt.new Prompt

Build an AliExpress product comparison grid. Using the AliExpress Affiliate API, search for products in a specific category and display results as a 3-column comparison grid. Each card shows: main product image, title, price range, original price (to show discount percentage), seller rating stars, total orders count, free shipping indicator, and a 'Source on AliExpress' affiliate tracking link. Add a niche filter sidebar with category, price range, and minimum rating sliders.

Copy this prompt to try it in Bolt.new

AliExpress to Storefront Product Importer

Build a product import tool that fetches AliExpress product details — description, all images, variants with prices — and formats them for import into a custom storefront or export as CSV. Automates the tedious manual process of copying product information from AliExpress to a store listing.

Bolt.new Prompt

Build an AliExpress product importer. Create an API route that fetches full product details from AliExpress using the aliexpress.affiliate.product.detail.get method with a product ID. Return all product images, the full product description, price variants (by color/size), shipping options, and seller information. Build a UI where I paste an AliExpress product URL, it extracts the product ID, fetches the details, shows a preview, and generates a JSON export with all product data formatted for import.

Copy this prompt to try it in Bolt.new

Troubleshooting

API returns error code 50 or 'Invalid signature' on every request

Cause: The HMAC signature generation is incorrect — common causes are wrong sorting order, including the 'sign' parameter in the signed params, or using wrong encoding.

Solution: Verify the signing process: sort all parameters alphabetically by key BEFORE adding the 'sign' parameter, concatenate as key+value pairs with no separators or equals signs, then wrap with the App Secret before and after the concatenated string. Do NOT include the 'sign' key itself in the parameter string being signed.

typescript
1// Generate sign BEFORE adding it to params:
2const paramsForSigning = { ...params }; // Does NOT include 'sign'
3delete paramsForSigning.sign;
4const sortedKeys = Object.keys(paramsForSigning).sort();
5const paramString = sortedKeys.map(k => `${k}${paramsForSigning[k]}`).join('');
6const stringToSign = `${APP_SECRET}${paramString}${APP_SECRET}`;
7const sign = crypto.createHash('md5').update(stringToSign).digest('hex').toUpperCase();
8params.sign = sign;

API returns error 'Affiliate token invalid' or returns empty product list

Cause: The tracking_id parameter is missing, malformed, or the affiliate account is not approved yet.

Solution: Verify your Tracking ID in the AliExpress affiliate portal under Account > Tracking IDs. Use your actual Tracking ID, not a placeholder. If your affiliate account is under review, the API may return limited results. Try 'default' as a tracking_id value for initial testing.

Product images are broken or not loading in the Bolt preview

Cause: AliExpress product image URLs contain dynamic CDN paths that may return different images after caching or have CORS headers that block direct loading in some browsers.

Solution: Add a fallback image URL and an error handler to the img elements. AliExpress image URLs are generally stable, but some use formats that browsers handle inconsistently. Use the largest available image URL from the API response (product_main_image_url) which is typically the most reliable.

typescript
1<img
2 src={p.imageUrl}
3 alt={p.title}
4 onError={(e) => { (e.target as HTMLImageElement).src = '/placeholder-product.png'; }}
5 className="w-full h-40 object-contain"
6/>

API returns valid products but affiliate URLs do not contain the tracking ID

Cause: The ALIEXPRESS_TRACKING_ID environment variable is empty or the tracking_id parameter is not included in the signed request parameters.

Solution: Verify ALIEXPRESS_TRACKING_ID is set in .env and that it is included in the params object before signature generation. The tracking_id must be part of the signed parameters — adding it after signing invalidates the signature.

Best practices

  • Always include the tracking_id in signed request parameters from the start — adding it as an afterthought is a common mistake that produces invalid signatures.
  • Cache AliExpress search results for 5-10 minutes, since product data does not change in real time and caching reduces API usage and improves page load speed for users searching popular terms.
  • Display affiliate disclosure clearly — AliExpress affiliate terms require disclosure of the commercial relationship, and transparency builds user trust.
  • Use high-resolution product images from the API (product_main_image_url) and implement loading states since AliExpress CDN images can take 1-2 seconds to load from outside Asia.
  • Filter products with zero or very low order counts (under 10) from search results by default — these are typically untested products with unknown quality and may reflect supplier reliability issues.
  • Store ALIEXPRESS_APP_SECRET server-side only and never in any variable with NEXT_PUBLIC_ prefix — the secret signs all API requests and exposure would allow others to use your affiliate quota.
  • Implement pagination from the start using page_no and page_size parameters — AliExpress returns up to 50 results per page and many searches have thousands of products worth browsing.

Alternatives

Frequently asked questions

Do I need to be an AliExpress affiliate to use the API?

Yes — the AliExpress Affiliate API is exclusively available to approved affiliates. You must register at portals.aliexpress.com and be accepted into the affiliate program before receiving an App Key and App Secret. The approval process typically takes 1-3 business days. There is no public browsing API for AliExpress products outside the affiliate program.

Can I use the AliExpress API in Bolt's preview without deploying?

Yes — AliExpress API calls are outbound HTTPS requests that work fine in Bolt's WebContainer. You can build and test the full product search, filtering, and display functionality in the Bolt preview. There are no webhook or callback requirements for the core search features. Deploy to Netlify or Bolt Cloud when you are ready to share the tool publicly.

Why does the AliExpress API require HMAC signing when simpler APIs use just an API key?

HMAC signing prevents request tampering — a request signed with your App Secret cannot be modified in transit without invalidating the signature. If AliExpress used only an API key (passed as a URL parameter), anyone intercepting the request could modify the parameters (like changing the tracking ID to redirect commissions). The HMAC signature binds the specific parameter values to the request authentically.

How much commission does the AliExpress affiliate program pay?

Commission rates vary by product category, typically ranging from 4% to 10% of the purchase price. Electronics often pay around 4-6%, while fashion and accessories can pay 8-10%. Commission is paid on completed purchases made within 30 days of a user clicking your affiliate link. Payment is made monthly after reaching the minimum payout threshold. Current rates are shown in your affiliate portal dashboard.

Are AliExpress API product prices in real-time?

The AliExpress Affiliate API returns current listed prices at the time of the API call. Prices on AliExpress can change frequently due to flash sales, seller promotions, and currency fluctuations. Implement price disclaimers in your UI (e.g., 'Price at time of search — verify on AliExpress before purchasing') and avoid caching prices for more than 10-15 minutes to show reasonably current data.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.