/search_v2, /autocomplete_v2, and /events on runway.depict.ai. It maps those calls to the Platform API’s /v4 endpoints.
For an integration that calls the v2 or v3 endpoints on api.depict.ai, use Upgrade from v3/v2. For a new integration, start at the introduction.
What changes
- The host becomes
https://api.depict.ai. Every path starts with/v4/{merchant}. - Read your store’s markets and locales from
context. - Search uses
browse, which returns one JSON object. Remove the parser forkey:valuestream lines. - Pass the response’s
cursorto get the next page. There is nopageparameter. - Set
limitexplicitly. The default changes from 30 products to 24. - Convert filter objects to a
filter_bystring. - Suggestions are typed objects, not strings with completion markup.
- Events use NDJSON. Each card’s
tracking_idreplaces separate search and position fields on impressions and clicks.
Routes
Every data endpoint takes GET parameters or a POST JSON body. Events take only POST. V4 does not need an API key or
depict_token.
Requests
ReadGET /v4/{merchant}/context first. Use your store’s name in Depict as {merchant}. Confirm it instead of assuming that every old merchant_id is a V4 name.
Each context market lists its
key, currency, locales, and default_locale. Its optional countries list maps country codes to currencies. Select the shopper’s market and language from these values. A market’s presence does not mean every language is available there.
An unknown merchant, market, or locale produces an error. Unknown request fields also produce an error. Do not copy the old request body unchanged. See Errors.
Filters
Convert each old filter object to a clause. Join clauses with&&.
For example,
{field: "price", operator: "<=", value: 500} becomes price:<=500.
Use the field and value names returned in V4 facets. Do not assume old names such as colors are valid for every store. schema lists the store’s filter and sort fields.
Send booleans as true or false. Put values with spaces or punctuation in backticks, such as material:=`Organic cotton` . Use URLSearchParams to encode the whole expression in a GET. Filters and sorts gives the full syntax.
Sorts
Read the available sorts from the response’s
sorts section. An unknown sort field produces an error.
Sections
Withoutinclude, browse returns product cards, facets, and sorts. Request include=facets,sorts,content to add content pages.
In a GET, keep commas between include values unescaped. Encode each value separately.
Named sections replace the default sections. Thus, include=content does not also request facets and sorts. The card extras attributes and variants add card fields without removing the default sections. See Sections.
Responses
Search pages
Useresponse.json() once. Do not split the response into stream lines.
Content entries can also have
description, snippet, and highlights. Set content_limit to keep the same top content results on each product page. It also adds content_total. See Browse.
Pages
Pass the response’scursor in the next request. Keep the query, market, locale, filters, sort, sections, and limit unchanged. The last page has no cursor.
Reset the cursor when the shopper changes the search or a filter. Do not construct cursors or convert page numbers to cursors. Keep previous pages or cursors if your interface needs a back button.
Search matches
On a search,keyword_matched says whether products matched the query’s words. When it is false, V4 can return products closest in meaning.
This field is not a direct rename of is_fallback. Do not use the old flag’s parser or assume that a search without keyword matches returns no products. See Browse response.
Product cards
IDs are strings. Do not parse a V4 ID as a number, remove a prefix, or substitute
group_id for a variant ID. Use the store’s required cart ID when its cart needs an ID other than variants[].product_id. See Merchant attributes.
Use variants[selected] for the initial variant. If your cart needs another ID, read its declared attribute from that variant’s attributes. The store’s schema identifies this attribute with role: "add_to_cart" and its configured key. Have Depict configure that required attribute if it is missing. Do not derive a cart ID by removing part of a V4 ID.
Use a variant’s title when present; otherwise use the card’s title. Use size for the size option.
Prices use major currency units: 1999 means 1,999 SEK. Convert to minor units only where your own renderer requires them. Use the response currency for every card. currency can be absent when there are no products.
Card in_stock describes whether any variant in any colorway is in stock in the selected market. Use a variant’s in_stock for that size. The old stock flag and the new card flag can describe different groups.
Product links
Resolveslug using your storefront’s product routes and locale root. Do not always append /products/ to a value that is already a path.
For a Shopify storefront that returns a bare handle, build the product URL from its locale root, /products/, and that handle. For example, handle rain-jacket and root /en-se/ give /en-se/products/rain-jacket. If slug is empty, the product has no path in that locale. See Product.
Attributes and tags
V4 does not automatically return every field from the old product object. Display settings determine which fieldsinclude=attributes adds.
Read variant values from variants[i].attributes. A card’s attributes can combine distinct variant values into a list. Do not assume every card attribute is a scalar.
tags and product_type are built-in display attributes when configured. Other fields, such as material, gender, or occasions, need a configured source. Check required fields before switching. For filters, use returned facet values and counts instead of counts built only from loaded cards. See Display attributes.
To receive tags, include it in the store’s display settings and request include=attributes. Read the selected variant’s attributes.tags when you need its tags. An absent attribute does not prove that the product has no tags. A configured tags list can be empty. Have Depict configure missing required fields, then verify their values on representative products.
Color filters
Replace filters derived from the oldcolors array with the returned facet’s field and values. Do not derive filter values from words in shade labels. If your interface groups shades into color families, keep the original facet values for each group. Send those values in filter_by.
When present, color.name is the general color used by the color filter; color.label is the shopper-facing shade name. Use colorways to render color choices on a card. These fields do not guarantee the old array or its grouping rules. See Color.
The old product’s facet_values has no fixed card-field replacement. Use response facets for filter controls, or configured attributes when you need product-level values.
Suggestions
GET /v4/{merchant}/suggest replaces /autocomplete_v2. Map merchant_id, country, locale, and query as described above.
The old response contains completion strings with ** markup. V4 returns typed objects:
query as text. Search for that value when selected. A listing suggestion opens its listing; it is not a query completion.
V4 returns matching listings followed by popular query suggestions. Its limit controls listing suggestions, not the number of query suggestions. There is no ** completion markup or promise of identical suggestion text. See Suggest.
Start view
Send an emptyquery= to suggest for start-view phrases and listing suggestions. Send browse without a query or listing for start-view products. Saved start-view pins apply to this browse request.
These are separate responses. Do not expect the old combined /empty-state-products response or its localized_strings. Keep your interface text in your client.
Tracking
Send supported actions toPOST /v4/{merchant}/events. Send one JSON event per line with Content-Type: application/x-ndjson. A JSON array is not the V4 event format.
Replace any old search-reporting proxy call with this endpoint. Omit depict_token and X-Depict-Token; V4 does not use them. The old proxy’s request body is not the V4 event contract. Supply the required event fields in your client, including fields the proxy previously supplied.
Event types
A product view is not a replacement for visits to other page types. See Not available yet.
Event fields
Return the card’s
tracking_id unchanged. Do not build it from the old search ID or product ID. For cart and product-view events, it identifies the selected variant. Supply product_id when the shopper acts on another variant, or when no tracking ID is available.
Create the device ID once and store it on the device. Use the same ID across visits and across your search, cart, and purchase events. A native app needs persistent device storage, not a new ID at each launch.
When a click opens a product page, keep its card’s tracking_id, query, market, and locale with the navigation state. Use the same persistent device ID for later actions. Do not populate V4 events from a stored legacy search_id or result position. For a cart action, send the acted-on product_id when it differs from the card’s selected variant.
For purchases, transaction_id becomes purchase.transaction_id, and currency becomes purchase.currency. Convert parallel transaction_product_ids, prices, and quantities into purchase.items[] entries with sku, price, and quantity. The transaction product ID is the SKU by default. See Purchases.
Check both the HTTP status and rejected in the response. HTTP 200 can include rejected lines. A positive accepted count confirms validation, not report attribution. Depict does not remove duplicate events by event_id. Send each shopper action only once. See Events.
The Shopify app’s search reports do not yet count clicks, add to carts, or orders from V4 events alone. We are working on this.
Native mobile apps
Native iOS and Android apps can use the samebrowse, suggest, and events endpoints. V4 uses HTTPS and JSON responses. Events use NDJSON. No API key or Depict SDK is required. Use your app’s HTTP client.
Native HTTP clients do not apply browser CORS rules or need an Origin header. JavaScript inside a WebView still follows browser CORS rules. Select market and locale from context, as for the web integration.
The app must supply the event fields:
- Generate
event_idandtsfor each action. Sendtsas an ISO timestamp with an offset. - Send
type,market, andsession_id. Optionallocaleidentifies the language. - Use a persistent device ID for
session_id. Store it on the device and reuse it across visits and app launches. - Return the card’s
tracking_idunchanged on impressions and clicks. Follow the event reference for cart, product-view, and purchase fields.
User-Agent value.
For tests, suppress tracking on content reads and validate event payloads locally. Do not send test events to the live API. The track: false header does not suppress event writes.
Worked examples
Replaceacme with your merchant name. Select a market and locale from your own context. The first example suppresses tracking on product reads. Remove that header for real shopper requests.
Run test reads with the track: false header from a server or curl. The current CORS preflight does not allow this header in browser requests.
Search and the next page
tracking_id with that card. Keep its query, market, and locale for later events. A changed search starts without a cursor.
One product click
The function below usesbase, market, locale, and parameters from the search example. Call it for a real shopper click. Do not call it as a test against the live API: the track: false header does not suppress event writes.
Prompt for a coding agent
Copy this prompt into your coding agent and replace{merchant} with your store’s name in Depict.

