Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Microsoft Web IQ Commerce APIs return structured products, seller offers, and product details that your application can use to ground a shopping experience. Your application can use an AI model to interpret a shopper's request and explain product choices, while it renders prices, sellers, and links from API results instead of generating them.
Note
The Commerce APIs are in private preview and are included with AppIDs that have full document access. Access is enabled separately for Search, Offers, and Product Details: Search access alone doesn't give access to the follow-up endpoints. If your AppID doesn't have them, open a Web IQ Support request (problem type Authentication & Access) with your AppID. To make your first calls, see step 8 of the Quickstart.
Choose an endpoint
| Shopper question | Endpoint | Input | Result |
|---|---|---|---|
| What products match? | POST /v3/search/commerce/products |
Product query | Ranked products with primary seller offers |
| Where can I buy this? | POST /v3/fetch/commerce/products/offers |
Product, SKU, or representative offer ID | Eligible seller offers, with representative offers first |
| What are the product details? | POST /v3/fetch/commerce/products/details |
Product or SKU ID | Zero or one product with name, description, and aggregate rating when available |
Paths are relative to https://api.microsoft.ai. Each endpoint takes a JSON body and an API key or Microsoft Entra ID token enabled for Commerce; see Authentication. You can use Search alone, and call Offers or Product Details when the experience needs them.
Connect the calls
- Send a concise shopper query to Search and select one of the returned products.
- For Offers, send every identifier that result has: the product
idasproductId, itsskuIdasskuId, and theidof its representative offer asofferId. Use IDs from the same result. At least one is required. - For Product Details, send the product
idasproductId, itsskuId, or both. - Handle
200 OKwith an emptyproductsoroffersarray as no match, not as a failed request. Follow-up requests work on one product, SKU, or representative offer at a time; these endpoints don't support batch IDs or pagination.
Treat identifiers as opaque strings. A search result might not contain every ID: some products return only an offer. If only an offer ID is available, you can request Offers but not Product Details. Don't assume that an ID stays valid over time, or that one ID takes precedence when you send several.
Choose the market
All three endpoints accept two-character language and region values, with en and US as defaults; see Supported markets for the combinations available in the private preview. Search and Offers also accept an optional location in the form lat:<latitude>;long:<longitude>, with latitude from -90 to 90 and longitude from -180 to 180. Product Details doesn't take a location.
Use the shopper's chosen market consistently across calls. Send location or other personal context only when your application is authorized to. Catalog coverage varies by market.
Control the number of results
Search maxResults requests 1 to 50 products, with a default of 10; it doesn't set the number of offers. A smaller result set can be useful when you send results directly to a model. A larger candidate set can be useful when your application filters or ranks results first. Search can return fewer products than requested.
Offers has no maxResults, offset, or cursor; the number of offers depends on availability. Product Details returns at most one product.
Build an agent tool
One approach is to expose Search as a tool and keep market settings in trusted application code. The following is an illustrative tool schema, not a Web IQ endpoint:
{
"name": "search_products",
"description": "Find ranked products and seller offers for a shopping request.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "A nonblank product query of at most 1000 characters."
},
"maxResults": {
"type": "integer",
"minimum": 1,
"maximum": 50,
"description": "Maximum number of products to request; default 10."
}
},
"required": ["query"]
}
}
Your tool handler should validate the model's arguments, add the user's selected language and region, and call Search with server-side credentials. Search accepts a nonblank query of up to 1,000 characters. For a request that involves several distinct product types, consider a separate Search call per type, and limit concurrency and request volume: each call counts against your AppID's rate limit and quota.
Give the model a compact selection of the returned fields, and keep the IDs you need for follow-up calls. Treat seller titles, descriptions, and other returned text as untrusted data, not instructions. Don't let a model generate purchase URLs or claim that a product, price, or rating exists when the API didn't return it.
Filter, rank, and render results
- Check hard constraints in application code. If the shopper specifies a maximum price, condition, size, or other attributes, check the available offer data before you show a match. If a necessary field is missing or can't be interpreted, don't claim the constraint was met. Offer
specificationscan include attributes such as brand or size, but availability and values vary. - Rank candidates. Start with the Search product rank, then apply your application's criteria. If you use a model to re-rank, send it only the candidates you want it to consider, and keep the original structured data for rendering.
- Compare like with like. For seller comparisons, check the product and variant, currency, and condition. Remove repeated offer IDs before you display a list, and verify offers before you claim a lowest price.
- Render from fields. Use the offer
name,seller.name,price,condition,shippingInfo, andimages[].urlwhen present. For every offer you present, link to itsclickUrlfrom that response. UsedisplayUrlonly to identify the merchant or seller in the display, not as a destination. See Link to offers. - Degrade gracefully. If a model step fails, show the available structured results without generated commentary when appropriate. If a Commerce request fails, say that results are unavailable and offer a retry, rather than inventing products or prices.
Product Details can return a product name, description, and aggregate rating. The rating is omitted when unavailable. Its value, scaleMin, scaleMax, and count describe the product, not an individual offer or a specific variant. Don't infer review text or a review summary from the aggregate rating.
Link to offers
For every offer you present, use its clickUrl exactly as returned in that response to send a user, or an agent acting for the user, to the offer. Use displayUrl only to identify the merchant or seller in your display or as context for a model, never for navigation. If an offer doesn't have a usable clickUrl, don't present the offer; don't fall back to displayUrl or build a link.
Treat the clickUrl as opaque: don't strip, rewrite, truncate, decode, or substitute it, don't bypass its redirects, and don't reuse it for a different response, query, user, or purpose, including through a cache. For the full rules, including when you can wrap a clickUrl in your own tracking link, see Offer links and attribution in the Commerce reference and Exhibit B of the Web IQ Terms of Use.
Build navigation in code, not in the model
Keep each original clickUrl in trusted application code, associated with its offer, response, and user. Send the model an offer handle that your application generates for that response, together with the relevant product information. The model can select a handle, but it shouldn't reproduce or modify the link. Resolve the handle against the original response when you render or navigate, and reject unknown or stale handles rather than falling back to a URL the model generated. If an agent must receive a clickUrl, make sure it receives and uses the exact original value.
The following browser example creates a link from an offer object in the current response. As a conservative application policy, it accepts only HTTPS links and rejects values that the browser's URL parser or link serialization would change. It assigns the original string, not a reconstructed URL. When it returns null, don't present that offer. You can run it in a browser console; the final check confirms that the URL is preserved and that missing or unsafe destinations are rejected.
function createOfferLink(offer) {
if (typeof offer.clickUrl !== "string" || offer.clickUrl.length === 0) {
return null;
}
try {
const parsed = new URL(offer.clickUrl);
if (parsed.protocol !== "https:" || parsed.href !== offer.clickUrl) return null;
} catch {
return null;
}
const link = document.createElement("a");
link.setAttribute("href", offer.clickUrl);
if (link.href !== offer.clickUrl) return null;
link.textContent = offer.name || "View offer";
return link;
}
const exampleClickUrl = "https://merchant.example/offer?attribution=opaque%2Fvalue";
const exampleLink = createOfferLink({ clickUrl: exampleClickUrl, name: "Example offer" });
if (
exampleLink?.getAttribute("href") !== exampleClickUrl ||
createOfferLink({ clickUrl: "javascript:alert(1)" }) !== null ||
createOfferLink({ displayUrl: "https://merchant.example/products/headphones" }) !== null
) {
throw new Error("Offer links must preserve clickUrl without a fallback.");
}
This check doesn't verify redirects or wrappers further down the path; test the complete navigation path in your application. Don't use a model-generated citation, Markdown link, or displayUrl as the destination.
Format prices
listPrice, offeredPrice, and installment amounts are integers in ISO 4217 minor units. USD uses two decimal digits, so 39999 is USD 399.99; JPY uses zero. Use the currency's own minor-unit scale, not a fixed division by 100. offeredPrice falls back to listPrice when there's no discount price. Show a list price as a previous price only if it's greater than the offered price and the applicable terms allow it.
For example, this JavaScript formatter handles three currencies explicitly:
function formatPrice(amount, currency, locale = "en-US") {
const minorUnitDigits = { USD: 2, JPY: 0, KWD: 3 };
const digits = minorUnitDigits[currency];
if (!Number.isSafeInteger(amount) || digits === undefined) {
throw new Error("Unsupported currency or unsafe integer amount");
}
const formatter = new Intl.NumberFormat(locale, {
style: "currency",
currency,
minimumFractionDigits: digits,
maximumFractionDigits: digits,
});
return formatter.format(amount / 10 ** digits);
}
console.log(formatPrice(39999, "USD")); // $399.99 in en-US
In production, use a maintained ISO 4217 minor-unit table for every currency your application supports, rather than inferring the scale from Intl display defaults. Don't compare amounts across currencies without a conversion policy. Prices and availability change, so display them from the current response.
Handle errors and rate limits
All three endpoints use the rate limits and daily quota of your AppID (15 queries per second by default), shared with the other Web IQ APIs the AppID calls. Rate and quota errors return 429; check the errorCode and retryAfter in the response.
| Response | Recommended action |
|---|---|
400, 401, 403, or 415 |
Fix the request, credentials, or access. Retrying an unchanged request doesn't help. |
429 AuthUserThrottled |
Wait at least the retryAfter time when it's present, then retry with bounded exponential backoff and jitter. Reduce request frequency. |
429 AuthUserDailyUsageExceeded |
Don't retry; the daily quota resets at 00:00 UTC. |
500 InternalServerError |
Follow any retryAfter guidance and retry with bounded backoff and jitter. If failures persist, contact Web IQ Support. |
For Commerce errors, retryAfter is a duration such as "60s" when present. Use a timeout and an overall retry budget. Log the endpoint, status, error code, and traceId, and avoid logging credentials or shopper data you don't need. See Error handling.
Test before launch
- Build a representative set of shopper queries for the categories and markets you support.
- Inspect raw Search results before you apply your own filtering and ranking, then compare the final experience.
- Check a sample of returned products, seller links, prices, and conditions against the seller pages before you make claims about them.
- Check that user and agent navigation uses the exact
clickUrlfrom the corresponding response, including through any wrapper of your own, that redirects are preserved, and that links aren't reused for another response, query, user, or purpose. - Test missing or unusable
clickUrlvalues and model-generated or stale offer handles, and make sure none of them falls back todisplayUrlor a generated link. - Test empty results, missing fields, products without a product or SKU ID, timeouts, throttling, quota exhaustion, and model failures.
- Track request volume, errors, and trace IDs. Include a relevant trace ID when you contact Web IQ Support.
Next steps
- Make your first Commerce calls in step 8 of the Quickstart.
- See the Commerce API reference for the complete request and response contract.
- Review Error handling for error codes and retry guidance.