Blog / API guides

AliExpress Scraper or API: What You Get

An AliExpress scraper is code you write and maintain to run searches on AliExpress, read product cards and pages, and turn prices, discounts, ratings and order counts into structured rows. The alternative is nine AliExpress endpoints that return that data as JSON for 1 credit per successful call. A recorded search for wireless earbuds returned 60 products on one page, each with a numeric price, an original price, sold_count and an is_sponsored flag. This post compares the two routes, prices tracking per product, and gives a verdict per use case.

What would an AliExpress scraper have to handle?

An AliExpress scraper has to do four things: run a search with the right sort and filters, page through results, parse every product card into fields, and do it again on a schedule without silently losing fields. Each is code that depends on pages you don't control. Marketplace listings make the parsing harder than it looks, because a single card carries a current price, a struck-through price, a discount, a rating, an order count and promotional labels, and any of them can be missing on a given product.

Prices are the first trap. A scraper reads text such as US $4.35 and has to split it into an amount and a currency, and keep both when a listing shows more than one price. Order counts are the second: a display label like 10,000+ sold is rounded, so a scraper that keeps only the label loses the precision you need for trends. Sponsored placements are the third, because a price study that mixes paid placements with organic results measures something different from one that separates them.

Then comes the operational layer every scraper shares: request pacing, retries with backoff, alerts when a run returns fewer products than yesterday, and checks that a field which was always populated hasn't gone blank. Read AliExpress's terms before you build a collector, and if a site blocks or challenges your traffic, stop rather than work around it. None of it is hard to build once. Keeping it correct is the recurring cost.

What does one AliExpress search call return?

One search call returns a page of products with every price already parsed into numbers, plus paging fields, the facet options and the sort options. The search endpoint requires query (up to 200 characters), page and sort, where sort is one of default, orders, price_asc or price_desc. Optional parameters are min_price, max_price, ship_from and filters[]. This is the recorded request, sorted by orders:

curl "https://api.perceptlayer.com/v1/aliexpress/search?query=wireless+earbuds&page=1&sort=orders" \
  -H "X-API-Key: $API_KEY"

The recorded response, trimmed to the paging fields and the first product:

{
  "success": true,
  "data": {
    "query": "wireless earbuds",
    "sort": "orders",
    "page": 1,
    "page_size": 60,
    "total_results": 16557,
    "has_more": true,
    "results": [
      {
        "product_id": "3256812408115438",
        "title": "HTC NE79 TWS Bluetooth 6.0 Earbuds AI Translation 135 Languages ENC Noise Cancelling HiFi Stereo Headphones with LED Display",
        "url": "https://www.aliexpress.com/item/3256812408115438.html",
        "image_url": "https://ae-pic-a1.aliexpress-media.com/kf/Sff7e4be36c804173b8bf2ad0f4a81b0bA.png",
        …
        "price": {
          "amount": 4.35,
          "currency": "USD",
          "formatted": "US $4.35"
        },
        "original_price": {
          "amount": 17.31,
          "currency": "USD",
          "formatted": "US $17.31"
        },
        "discount_percent": 74,
        "rating": 4.9,
        "sold_count": 17921,
        "sold_text": "10,000+ sold",
        "selling_points": [
          "Fastest delivery in 6 days"
        ],
        "promotion": "Dollar Express",
        "is_sponsored": false
      },
      …
    ],
    …
  },
  "meta": {
    "endpoint_family": "search",
    "billable": true
  }
}

Which scraper problems do these fields remove?

Each of the three traps above maps to a field. The price arrives as price.amount (4.35) and price.currency (USD), with the display string kept separately in formatted, so there's no text to split. The order count arrives twice: sold_count: 17921 and sold_text: "10,000+ sold". The second product in the recording has sold_count: 250 and sold_text: "250 sold", so in this recording the label was rounded for the larger count and exact for the smaller one. And every result has is_sponsored, false on both recorded products, so you can filter paid placements in one line.

Two fields need defensive code. promotion is "Dollar Express" on the first product and absent on the second, so treat it as optional. selling_points is a list of short strings, such as "Fastest delivery in 6 days" and "New shoppers save $34.32", which reads as marketing copy rather than a structured value.

What else comes back with the results?

The response also lists facets and sort_options. Each facet has a title, a type and options with a label and a value, such as Free shipping with filterCode:freeshipping and Choice with filterCode:choice_atm. The search endpoint takes an optional filters[] parameter, but we have no recorded call that passes one of these values back, so try it in the playground before you build on it. The sort_options pair value with label: orders is shown as Popular and default as Best matches.

How do an AliExpress scraper and the endpoints compare?

A scraper costs engineering time, hosting and repairs when pages change; the endpoints cost 1 credit per successful call and return the same field names every time. The table compares them on a recurring job: tracking prices, discounts and order counts across a product category.

DIY AliExpress scraper AliExpress endpoints
Search and sort Build URLs, parse result cards search with query, page and sort (default, orders, price_asc, price_desc)
Price Split display text into amount and currency price.amount, price.currency, price.formatted
Discount Compute from two parsed prices original_price and discount_percent
Order count Rounded label as shown sold_count as a number, sold_text as shown
Sponsored placements Detect from markup is_sponsored per result
Paging Your loop, your stopping rule page, page_size, total_results, has_more
Price bounds Your own filtering min_price, max_price, ship_from
Deeper data More parsers per page type product, product-reviews, product-shipping, store and others, 1 credit each
When pages change Parsers return blanks until fixed Same JSON fields; no parser of yours to fix
Failures Yours to detect HTTP status and error code; a failed call costs 0 credits

What does tracking a product cost?

Every AliExpress call costs 1 credit, so the cost per product depends on how you collect. A category sweep reads search pages: the recording returned page_size: 60, so one call covers up to 60 products. A fixed watchlist calls product once per product, taking the product_id, the same name as the field in search results. Its response isn't recorded here, so check its fields in the playground.

Two worked examples. A category sweep of 20 keywords, 5 pages each, once a day: 20 × 5 = 100 calls × 1 credit = 100 credits a day for up to 6,000 product rows, 3,000 credits over 30 days. The 100 free credits on signup cover the first day, and the 10,000-credit Starter pack covers 100 days. A watchlist of 200 products checked daily: 200 calls × 1 credit = 200 credits a day, 6,000 over 30 days, so the 50,000-credit Build pack covers 250 days. Shipping quotes add one product-shipping call per product per country. See pricing for what credits cost and the credits docs for how they're debited.

How do you sweep search pages in code?

Loop over pages until has_more is false or you reach your page limit, and write one row per product per day keyed on product_id. This Python script does that with sqlite3. It reads only fields that appear in the recorded response, uses .get() for promotion because it can be missing, and skips sponsored results.

import datetime
import os
import sqlite3

import requests

API = "https://api.perceptlayer.com/v1/aliexpress/search"
HEADERS = {"X-API-Key": os.environ["API_KEY"]}
KEYWORDS = ["wireless earbuds"]
MAX_PAGES = 5

db = sqlite3.connect("aliexpress_prices.db")
db.execute(
    """CREATE TABLE IF NOT EXISTS prices (
        day TEXT, keyword TEXT, product_id TEXT, price REAL, currency TEXT,
        original_price REAL, discount_percent INTEGER, rating REAL,
        sold_count INTEGER, promotion TEXT,
        PRIMARY KEY (day, keyword, product_id))"""
)
today = datetime.date.today().isoformat()

for keyword in KEYWORDS:
    for page in range(1, MAX_PAGES + 1):
        params = {"query": keyword, "page": page, "sort": "orders"}
        r = requests.get(API, params=params, headers=HEADERS, timeout=60)
        r.raise_for_status()
        data = r.json()["data"]
        for p in data["results"]:
            if p.get("is_sponsored"):
                continue
            db.execute(
                "INSERT OR REPLACE INTO prices VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                (today, keyword, p["product_id"], p["price"]["amount"],
                 p["price"]["currency"], (p.get("original_price") or {}).get("amount"),
                 p.get("discount_percent"), p.get("rating"), p.get("sold_count"),
                 p.get("promotion")),
            )
        print(keyword, "page", page, "credits left:", r.headers.get("X-Credits-Remaining"))
        if not data.get("has_more"):
            break
db.commit()

A day-over-day change in sold_count for the same product_id is an order-velocity signal; a change in price.amount with a steady original_price is a discount change. If a request fails, raise_for_status() stops the run before that page is written, the call costs nothing, and the JSON body carries a code from the errors docs, such as rate_limited (429) with a Retry-After header.

Which route fits your job?

Pick by how often you collect and how much of the catalogue you need. A scraper's cost is upkeep; the endpoints' cost is 1 credit per call. These verdicts assume a recurring job. For checking a handful of listings once, the AliExpress site in a browser is enough.

  • Category price and demand tracking: sweep search with sort=orders for each keyword and store price.amount, sold_count and discount_percent by product_id. 1 credit per page of up to 60 products.
  • Watching specific products: call product per product_id daily. 1 credit per product per check.
  • Landed cost by destination: add product-shipping with a country for the products you care about.
  • Product research for a store: use min_price, max_price and ship_from on search to narrow before you read details, and product-reviews for what buyers report. Leave reviewers' names and profile details out of anything you store.
  • An AI shopping or sourcing agent: connect the AliExpress endpoints through the MCP server, as the AI agents docs describe, so the agent calls search instead of reading pages.
  • Learning to scrape: practise on a site built for it, not a live marketplace.

Price Monitoring Tool: Build One on Product APIs turns rows like these into alerts, AliExpress API: product search and reviews covers the product and review calls, and eBay Scraper or API and Walmart Scraper or API run the same comparison for other retailers. The marketplaces APIs page lists the rest. To check the fields for your own keyword, run search in the playground on the AliExpress API page, then get a free API key.

APIs in this post

Frequently asked questions

Is scraping AliExpress allowed?

That depends on AliExpress's terms, how you store and use the data, and the law where you operate, so read the terms and get legal advice for commercial use. Don't get around blocks or challenges. Product prices and order counts are lower risk than personal data; leave reviewers' names and profile details out of anything you keep.

How many products does one AliExpress search call return?

The recorded search for wireless earbuds returned page_size: 60 with total_results: 16557 and has_more: true. The page size isn't documented as fixed, so read page_size and has_more from each response rather than hard-coding 60. Every page is a separate call at 1 credit.

Why are there two sold fields?

sold_count is a number and sold_text is the label as shown. In the recording, the first product had sold_count: 17921 and sold_text: "10,000+ sold", while the second had 250 and "250 sold". Use sold_count for trends and calculations, and sold_text only when you need to show the label.

Does a failed AliExpress call cost credits?

No. Only a successful response debits credits. A failed call returns an HTTP status and a JSON error with a code, a message and a request_id, plus X-Credits-Used: 0. Most AliExpress parameters are required, so a call missing one fails with invalid_parameters (422) and costs nothing.

How fast can I run a daily AliExpress sweep?

Limits are per account, shared by all its keys, and counted per minute. A free account gets 1 request a second (60 a minute), so a 100-call sweep takes about two minutes. Paying accounts run at least 5 requests a second. The rate limits docs list the rate each pack includes.

  1. Etsy Scraper or API: What You Get

    An Etsy scraper vs one 10-credit product endpoint: a recorded listing with price, discount, quantity, variations and favorites, and the cost per item tracked.

  2. Shopify Scraper or API: What You Get

    A Shopify scraper vs a 1-credit products call: a recorded store page of 30 products with variant SKUs, prices and stock flags, and the cost per product tracked.

  3. Google Shopping Scraper or API: What You Get

    A Google Shopping scraper vs one GET at 1 credit: the recorded iphone 15 search with source, extracted_price and product_id, and the cost per item tracked.

Start with 100 free credits

No password to set. We email you a sign-in link, and your key works on every API.

No credit card. 100 free credits on signup.