开发文档
AliExpress API 参考:8 个操作
AliExpress API 参考文档:其 8 个操作各输入的作用、地区货币与 id 之间的关系,以及返回数据的含义。
另见: AliExpress API:搜索、商品详情、评论与运费数据概览与价格 · AliExpress API 指南:搜索、详情与折扣工作流
本页内容
aliexpress-deals:排序与折扣筛选的先后顺序
aliexpress-deals 返回 results。其中每一项带有 product_id、title、url、image 与 images;price、original_price、currency、discount_pct 与 price_formatted 描述价格;sold_count、rating、sku_id、product_type 与 promo_tags 则补齐卡片其余信息。这些卡片上没有 store_name 与 store_url;商品所属的店铺要通过 aliexpress-product-detail 才能得知。
body.sort 只用于在 body.min_discount 筛掉未达到所给折扣比例的商品之前对候选池排序,因此 results 最终始终按 discount_pct 排列——排序只决定哪些候选能进入该筛选,而不决定它们返回时的顺序。body.country 设为 RU 时会在这里直接被拒绝,因为该操作不属于 AliExpress 俄罗斯站所服务的两个操作之一。
本节涉及的字段(5)
aliexpress-deals, body.query, body.min_discount, body.sort, body.country
aliexpress-description:文字与图片独立于商品主图
aliexpress-description 返回 text、描述自身的 images、block_count 与 format;这组图片与 aliexpress-product-detail 在其自己的 images 下返回的主图是分开的,因为同一商品的描述内容与主图是各自独立填写的。body.description_url 接受此前某次 aliexpress-product-detail 调用针对同一商品已经返回的 description_url 取值,这样可以省去本操作仅凭 body.product_id 或 body.url 还要单独执行的一次查找。
body.country 设为 RU 时会直接被拒绝,因为俄语商品的完整描述文字并非通过本操作提供。block_count 统计 text 被拆分成的区块数量,format 则说明使用的是哪种区块格式。
本节涉及的字段(5)
aliexpress-description, body.product_id, body.url, body.description_url, aliexpress-product-detail
aliexpress-product-detail:价格、库存与卖家自己填写的商品文字
aliexpress-product-detail 返回一个 product 对象。price_min 与 price_max 限定了所有 SKU 规格共同的价格区间,而 rating、review_count 与 sold_count 描述的是商品本身而非卖家。total_stock 是所有规格 stock 的总和,images 与 video_url 提供主图与视频,specs 列出卖家自己填写的名称/数值规格行。
tags 说明该商品是否带有 AliExpress 的 choice、local_plus 或 scene_type 标签;interest_point 是 AliExpress 为该商品附加的一句简短卖点;coupons 列出该商品可用的 promotion_id 优惠券;sale 在有促销倒计时时给出其 type 与 ends_at。selling_points、wishlist_count 与 store_wished_count 补充了商品自身的营销数据,description_url 则是要发送给 aliexpress-description 以获取完整描述文字的取值。
本节涉及的字段(3)
aliexpress-product-detail, body.product_id, body.url
aliexpress-product-detail:SKU 规格、店铺信息与商品重量
在 sku_variants 中,每一项的 price、stock 与 available 描述的是该具体组合,image 只有在其所属维度为视觉维度时才会出现。颜色或款式这类维度会带有 image;尺码、型号或材质这类维度则没有,需依靠 sku_properties[].has_images 提前说明,并以已公开的 size_chart 与 size_measurements 代替。store 中的 store_id 是店铺编号,也出现在 store_url 中,并作为 aliexpress-store-info 自己的输入值;shop_id 则是 AliExpress 内部使用、用于自己店铺链接的编号,二者指向同一家店却从不相等。
seller_feedback_count 统计的是卖家整体的反馈,而不是本商品的评论,因此它可能远小于 review_count;当卖家完全没有反馈时,seller_positive_rate 与 seller_score 会返回 null,而不是 0 分。logo 为 null 只说明该店从未上传过 logo,而不是把某张共享的占位图当作该店自己的图片返回。shipping 概括了某个目的地的 shipping_cost、free 与 delivery_estimate(对应 ship_to)。
其 delivery_days_min 与 delivery_days_max 以天数限定同一个估计,aliexpress-shipping 则会针对该国家给出每个可用物流商的完整信息。weight 只有在卖家自己填写的属性文字给出一个明确重量时才会有数值;weight_unit 取值为 g、kg、lb 或 oz 之一。weight_raw 与 weight_source 则在 weight 为 null 时保留卖家的原始文字及其来源属性。
本节涉及的字段(4)
aliexpress-product-detail, body.product_id, aliexpress-store-info, aliexpress-shipping
aliexpress-reviews:summary 字段与翻页预算
aliexpress-reviews 返回 reviews 与一个 summary 对象。每条评论包含 rating、text、date、country、sku_info 与 logistics;附带的 images 或 labels 同样一并返回。summary 则给出 total_reviews、total_pages、average_star 与覆盖五个星级的 distribution,以及分别统计的好评、中评与差评数量。
body.filter 可选择 all、image 或 additional 评论——这是 AliExpress 公开记录的三个取值,而不是 all 加上其界面可能提供的任意更多筛选项。body.page_size、body.max_pages 与 body.max_results 从不同角度限定同一次获取的数量,三者中隐含数量最小的那一个决定实际返回的条数,因此直接设置 body.max_results 比自己去计算 body.page_size 乘以 body.max_pages 更简单。body.review_sort 用于高级场景下切换排序方式;其自身的默认值 complex_default 是大多数调用应当保留的取值。
本节涉及的字段(6)
aliexpress-reviews, body.filter, body.page_size, body.max_pages, body.max_results, body.review_sort
aliexpress-search:结果卡片,以及相关词与趋势词
aliexpress-search 返回的卡片形状与 aliexpress-deals 相同。该形状带有 product_id、title、price、original_price 与 discount_pct;也带有 sold_count 与 rating。此外还有 related_searches 与 ranking_searches,即 AliExpress 针对所给查询给出的相关词与趋势词列表。
body.min_price 与 body.max_price 以 body.currency 为单位限定价格区间,本身没有默认值,因此省略其中任何一个都会完全取消该方向的限制,而不是退回某个数值。body.ship_from 只保留从指定国家发货的商品,body.free_shipping 只保留包邮的商品;两者在省略时都默认不做筛选。body.country 设为 RU 时本操作可以提供服务,由 AliExpress 俄罗斯站响应,价格以卢布、标题以俄语返回,且每张卡片都会带有 store_name/store_url/配送说明文字而不是为空——这与别处记录的卡片形状正好相反——而 body.ship_from 在该情形下并不适用。
本节涉及的字段(6)
aliexpress-search, body.min_price, body.max_price, body.ship_from, body.free_shipping, body.country
aliexpress-shipping:方案及其对应的目的地
aliexpress-shipping 返回 options,其中每一项带有 carrier、以 currency 计的 cost 及送达时间估计,并附带表示该列表大小的 option_count。options 中的每一项都只针对本次调用所传入的 body.country——换一个 body.country 再次调用,可能得到完全不同的物流商与不同的 option_count,而不只是同一份列表上的不同 cost。body.province 会改变这些方案能否解析成功;body.city 只能在已设置 body.province 后进一步细化估计,本身并不影响能否解析成功。
本节涉及的字段(4)
aliexpress-shipping, body.country, body.province, body.city
aliexpress-similar:以商品或以搜索词作为起点
aliexpress-similar 返回的卡片形状与 aliexpress-search 相同,此外还有 seed_query,即本次比较实际使用的搜索词,以及在确实查到起点商品时该商品自己的标题 title。body.product_id 或 body.url 用于指定起点商品,其标题会被自动读取;body.query 会直接覆盖该标题,而不是与其叠加,这样做也会完全跳过对起点商品的查找,因此即使只有一个词组而没有已知商品,也仍能获取可比较的商品列表。body.sort 以及分页相关的输入,行为与 aliexpress-search 上完全一致。
本节涉及的字段(5)
aliexpress-similar, body.product_id, body.url, body.query, body.sort
aliexpress-store-info:店铺资料,以及商品匹配时的卖家指标
aliexpress-store-info 返回一个 store 对象。其核心字段是 store_id、回显所给 store_id 的 canonical_store_id、name、store_url 与 source。seller_id、business_type、business_license_url 与 tab_count 仅在 AliExpress 也提供该店铺自身资料数据时才会出现,而这类数据并非每个店铺都有。
seller_metrics 包含 seller_score、seller_positive_rate、seller_feedback_count、seller_country 与 top_rated。它只有在传入 body.query 且该词匹配该店铺自己的某个商品时才会出现;如果传入的 body.query 没有匹配到该店铺的任何商品,seller_metrics 就会和完全没有传入查询词时一样被省略。传入的 id 若根本不属于任何店铺,则会返回 NOT_FOUND,而不是一个空的 store。
本节涉及的字段(4)
aliexpress-store-info, body.store_id, body.store_url, body.query
AliExpress API 的语言覆盖情况
body.language 在每个操作上都可以使用。它接受任意两位字母代码,遇到无法识别的代码会被忽略,回复只会继续以英文返回,而不会导致调用失败。在 AliExpress 所记录的一组代码中,经测量有 11 个会改变商品标题;中文代码是例外,因为卖家没有提供中文译名时,AliExpress 并没有中文内容可以返回。
本节涉及的字段(1)
body.language
{
"body": {
"product_id": "3256808363596774"
}
}{
"body": {
"store_id": "1103576287",
"query": "earbuds"
}
}操作
公共网关操作统一使用 POST /api/v1/{project}/{action}。
使用 JSON 对象,按文档将参数放入 path、query、headers 和 body,省略未使用的位置。input.headers 是供操作使用的 JSON 数据,不是浏览器请求头。请勿在此填写凭证。按文档保留 body 的数组、标量或 null;省略与 null 含义不同。
折扣商品
POST /api/v1/aliexpress/aliexpress-deals
按关键词查找 AliExpress 的折扣商品,可设置最低折扣比例,结果按折扣幅度排序。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.query | string | 必填 | — | — | — |
body.country | string | 可选 | "US" | — | — |
body.currency | string | 可选 | "USD" | — | — |
body.language | string | 可选 | "en" | — | — |
body.max_pages | integer | 可选 | 1 | — | 1–10 |
body.min_discount | integer | 可选 | 0 | — | 0–99 |
body.page | integer | 可选 | 1 | — | 1–60 |
body.sort | string | 可选 | "orders" | "best_match""orders""price_low""price_high""newest""default""best_selling""price_asc""price_desc" | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/aliexpress/aliexpress-deals' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"query":"wireless earbuds"}}'商品描述
POST /api/v1/aliexpress/aliexpress-description
按商品 id 或链接返回商品的完整描述文字及描述中的图片。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.city | string | 可选 | — | — | — |
body.country | string | 可选 | "US" | — | — |
body.currency | string | 可选 | "USD" | — | — |
body.description_url | string | 可选 | — | — | — |
body.language | string | 可选 | "en" | — | — |
body.product_id | string | 可选 | — | — | — |
body.province | string | 可选 | — | — | — |
body.url | string | 可选 | — | — | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/aliexpress/aliexpress-description' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"url":"https://www.aliexpress.com/item/3256808363596774.html"}}'商品详情
POST /api/v1/aliexpress/aliexpress-product-detail
按商品 id 或链接返回商品的价格区间、每个 SKU 规格、参数、图片、店铺资料、运费摘要与评分。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.city | string | 可选 | — | — | — |
body.country | string | 可选 | "US" | — | — |
body.currency | string | 可选 | "USD" | — | — |
body.language | string | 可选 | "en" | — | — |
body.product_id | string | 可选 | — | — | — |
body.province | string | 可选 | — | — | — |
body.url | string | 可选 | — | — | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/aliexpress/aliexpress-product-detail' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"product_id":"3256808363596774"}}'评论
POST /api/v1/aliexpress/aliexpress-reviews
返回某商品的买家评论及评分分布,可在多页评论间翻页。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.country | string | 可选 | "US" | — | — |
body.currency | string | 可选 | "USD" | — | — |
body.filter | string | 可选 | "all" | "all""image""additional" | — |
body.language | string | 可选 | "en" | — | — |
body.max_pages | integer | 可选 | 1 | — | 1–20 |
body.max_results | integer | 可选 | — | — | 1–400 |
body.page | integer | 可选 | 1 | — | 1–60 |
body.page_size | integer | 可选 | 10 | — | 1–20 |
body.product_id | string | 可选 | — | — | — |
body.review_sort | string | 可选 | "complex_default" | — | — |
body.url | string | 可选 | — | — | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/aliexpress/aliexpress-reviews' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"page_size":10,"product_id":"3256808363596774"}}'搜索
POST /api/v1/aliexpress/aliexpress-search
按关键词搜索 AliExpress 商品,支持按价格区间、发货地和包邮进行筛选。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.query | string | 必填 | — | — | — |
body.country | string | 可选 | "US" | — | — |
body.currency | string | 可选 | "USD" | — | — |
body.free_shipping | boolean | 可选 | false | — | — |
body.language | string | 可选 | "en" | — | — |
body.max_pages | integer | 可选 | 1 | — | 1–10 |
body.max_price | number | 可选 | — | — | ≥ 0 |
body.max_results | integer | 可选 | — | — | 1–500 |
body.min_price | number | 可选 | — | — | ≥ 0 |
body.page | integer | 可选 | 1 | — | 1–60 |
body.ship_from | string | 可选 | — | — | — |
body.sort | string | 可选 | "best_match" | "best_match""orders""price_low""price_high""newest""default""best_selling""price_asc""price_desc" | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/aliexpress/aliexpress-search' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"country":"US","currency":"USD","query":"wireless earbuds"}}'运费方案
POST /api/v1/aliexpress/aliexpress-shipping
返回某商品发往指定目的地国家时可用的物流商、费用与预计送达时间。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.city | string | 可选 | — | — | — |
body.country | string | 可选 | "US" | — | — |
body.currency | string | 可选 | "USD" | — | — |
body.language | string | 可选 | "en" | — | — |
body.product_id | string | 可选 | — | — | — |
body.province | string | 可选 | — | — | — |
body.url | string | 可选 | — | — | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/aliexpress/aliexpress-shipping' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"url":"https://www.aliexpress.com/item/3256808363596774.html"}}'相似商品
POST /api/v1/aliexpress/aliexpress-similar
返回与给定商品相似的商品列表,也可改用搜索词代替商品本身。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.country | string | 可选 | "US" | — | — |
body.currency | string | 可选 | "USD" | — | — |
body.language | string | 可选 | "en" | — | — |
body.max_pages | integer | 可选 | 1 | — | 1–10 |
body.max_results | integer | 可选 | — | — | 1–500 |
body.page | integer | 可选 | 1 | — | 1–60 |
body.product_id | string | 可选 | — | — | — |
body.query | string | 可选 | — | — | — |
body.sort | string | 可选 | "best_match" | "best_match""orders""price_low""price_high""newest""default""best_selling""price_asc""price_desc" | — |
body.url | string | 可选 | — | — | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/aliexpress/aliexpress-similar' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"url":"https://www.aliexpress.com/item/3256808363596774.html"}}'店铺信息
POST /api/v1/aliexpress/aliexpress-store-info
返回店铺的基本资料,并在确认属于该店铺的商品后返回卖家指标。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.city | string | 可选 | — | — | — |
body.country | string | 可选 | "US" | — | — |
body.currency | string | 可选 | "USD" | — | — |
body.language | string | 可选 | "en" | — | — |
body.province | string | 可选 | — | — | — |
body.query | string | 可选 | — | — | — |
body.store_id | string | 可选 | — | — | — |
body.store_url | string | 可选 | — | — | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/aliexpress/aliexpress-store-info' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"store_id":"1103576287"}}'调用方式
- 使用
POST /api/v1/aliexpress/<action>,并携带x-api-key、Content-Type: application/json和必需的Idempotency-Key。 - 调用成功时返回
ok: true:data是操作的结果,meta.requestId标识已记录的请求,meta.chargedCreditUnits是实际扣费金额。否则ok为false,error.code说明原因;请读取ok和error.code,不要只依赖 HTTP 状态码。每个网关响应都带有供支持使用的请求 ID:meta.requestId;没有meta的响应(如受理前被拒绝)则为顶层requestId。 - 只有调用成功才按标价扣费。失败不扣费;结果无法确认时,最多 900 秒后释放,不扣费。
- 请求完成后,以同一个 Idempotency-Key 重复发送相同请求,24 小时内返回已保存的响应,不会再次扣费。
网关调用参考: