API & Embed Docs

Use our public API to search AliExpress products, embed deal banners on your site, or build custom integrations. All responses include affiliate links.

Sub-affiliate earnings: Pass your tag parameter to earn commissions on sales generated through your embeds and API integrations. Sign up for a tag here.

Quick Start — Embed a Banner

Copy this iframe to embed a dynamic product banner on any website:

<iframe
  src="https://bestcartai.com/api/embed?q=wireless+earbuds&tag=YOUR_ID&limit=4&format=html&theme=dark"
  width="100%"
  height="380"
  frameborder="0"
  style="border-radius:12px;"
></iframe>

CLI Usage

Use curl or any HTTP client:

# Search products
curl "https://bestcartai.com/api/products?q=wireless+earbuds&limit=5"

# AI chat
curl -X POST https://bestcartai.com/api/chat \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"best phone case under $10","timestamp":0}]}'

# Visual search
curl -X POST https://bestcartai.com/api/visual-search \
  -F "image=@product-photo.jpg"

# Get embed JSON for your site
curl "https://bestcartai.com/api/embed?q=led+lights&tag=my_blog&format=json"

API Endpoints

GET/api/products

Search AliExpress products with affiliate links

ParamTypeDescription
qstringSearch query (e.g. 'wireless earbuds')
limitnumberResults per page (max 50, default 40)
offsetnumberPagination offset
sortstringrelevance | price_asc | price_desc | newest
min_pricenumberMinimum price filter
max_pricenumberMaximum price filter
currencystringTarget currency (USD, EUR, GBP, etc.)
countrystringShip-to country code (US, DE, BR, etc.)
category_idstringAliExpress category ID
Example:
/api/products?q=wireless+earbuds&limit=5&currency=EUR&sort=price_asc
POST/api/chat

AI shopping assistant — conversational product search

ParamTypeDescription
messagesarray[{"role":"user","content":"...","timestamp":123}]
Example:
{"messages":[{"role":"user","content":"best bluetooth speaker under $20","timestamp":1234}]}
POST/api/visual-search

Upload an image, AI identifies the product and finds it on AliExpress

ParamTypeDescription
imageFileImage file (multipart/form-data)
Example:
curl -X POST -F 'image=@photo.jpg' https://bestcartai.com/api/visual-search
GET/api/embed

Embeddable product banner — returns HTML or JSON for publishers

ParamTypeDescription
qstringSearch query
tagstringYour sub-affiliate tracking ID
limitnumberNumber of products (max 12)
formatstringjson | html (default: json)
currencystringTarget currency
themestringdark | light
Example:
/api/embed?q=phone+cases&tag=my_blog&limit=4&format=html&theme=dark
GET/api/og

Dynamic Open Graph image for social sharing

ParamTypeDescription
titlestringProduct title
pricestringSale price
originalstringOriginal price
discountstringDiscount percentage
imagestringProduct image URL
Example:
/api/og?title=Wireless+Earbuds&price=7.22&original=14.73&discount=51

Rate Limits

Product search: 50 requests/minute per IP

Chat: 20 requests/minute per IP

Visual search: 10 requests/minute per IP

Embed: 100 requests/minute per IP (cached for 5 min)