Skip to main content

Shop

AI-powered natural language product search. Describe what you need, get curated results. One-shot — always returns products.

Cost: $0.10 USDC per request

Endpoint

POST /x402/shop

Request Body

FieldTypeRequiredDescription
messagestringYesNatural language product search query
contextobjectNoOptional context with price range and preferences
context.priceRangeobjectNo{ min?: number, max?: number }
context.preferencesstring[]NoList of preferences

Example

All requests require x402 payment. Use fetchWithPay from the Quick Start:

const res = await fetchWithPay("https://api.purch.xyz/x402/shop", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
message: "comfortable running shoes for marathon training under $150",
}),
});
const data = await res.json();

Response

{
"reply": "Here are some great marathon training shoes...",
"products": [
{
"asin": "B0CXYZ1234",
"title": "Nike Pegasus 41",
"price": 129.99,
"currency": "USD",
"rating": 4.7,
"reviewCount": 12453,
"imageUrl": "https://...",
"source": "amazon"
}
]
}