Skip to main content

search_shops

Searches or browses shops near the delivery location. Each result carries a shop_id and a cart_id: the cart_id encapsulates the shop and the delivery coordinates, and is the entry point for the subsequent get_shop_menu, quote_cart, and preview_order calls.
Order flow: search_shops → shop_id + cart_id (carries delivery coordinates) → get_shop_menu to pick items → quote_cart to price the cart and get quote_id → select_address to get address_id → preview_order → preview_id + confirmation_token → create_order. Pass the shop_id / cart_id to downstream tools as-is; do not synthesize them.
Two modes (switched by keyword):
  • Omit / empty keyword → browse mode: a nearby shop feed (up to 20) with decision fields — distance, rating, delivery fee, minimum order amount, and availability.
  • Provide keyword → precise search (~5 shops): keyword may be a shop name (“瑞幸咖啡”), a category (“奶茶”), or a concrete item name (“生椰拿铁”); the upstream search matches at the item level, so an item keyword returns the shops that actually carry it. Each shop includes matched_items (display-only previews of the matched items). Note: in this mode distance / rating are usually null (upstream limitation); but delivery_time_text / delivery_fee_text are now derived from the upstream orderLeadTime / floatDeliveryFee (a fee of 0 shows as “免配送费”, i.e. free delivery).
Browse pagination: in browse mode (no keyword), pass offset to page through results — send offset: 0 on the first call, then the response’s next_offset on each subsequent call, until shops comes back empty (end reached). Page size is fixed and not adjustable (it only caps how many shops one page may return). Keyword search does not support pagination.
A keyword search does not necessarily return the shop you asked for. The search never returns an empty list — when no shop name matches the keyword, it falls back to similar shops in the same category. search_match_level tells the two apart:
  • exact — at least one shop’s name or brand matches the keyword; those shops are listed first.
  • related — no shop name matched; every result is a same-category alternative. For a category keyword (“奶茶”) that is normal. For a shop or brand keyword (“星巴克”) it means that brand is not orderable at this delivery location — do not treat the results as the shop the user asked for. Tell the user it wasn’t found, or retry with a different address.

Parameters

How the delivery location is resolved: in order, ① the coordinates of the saved address behind address_id → ② the lat/lng passed explicitly → ③ the user’s most-recently-used saved address / remembered location. If none resolve, the call returns COORDS_REQUIRED. So address_id and lat/lng are both optional, but at least one location source must be resolvable.

Returns

Amount fields are in cents (integer), not yuan. e.g. min_order_amount: 0 means ¥0, price: 1600 means ¥16.00.
matched_items carry no IDs and no stock state — to order one of those, call get_shop_menu first and use the item_id / sku_id / option IDs it returns.recommend_items do carry an item_id: pair it with the shop’s cart_id and call get_item_options right away. Pricing and ordering still start with one get_shop_menu call on that cart, and the same item_id stays valid across it.

Error Codes

See Error Handling for the full list.

Example Call