# Depict Documentation
> This file is very large and may be truncated. For an index of this content, please refer to https://docs.depict.ai/llms.txt instead.
# Data Ingestion
Source: https://docs.depict.ai/api-guide/data-ingestion
A reminder of the data ingestion process
Before you continue, make sure you have read and followed the [Data Ingestion](/data-ingestion-guide/overview-of-data-ingestion) guide.
Typically, there's a delay between the time of data ingestion and when the data becomes available in the API. If you want to verify the availability of the data, use the [preview browser](https://demo.depict.ai).
# Integrating with the Platform API
Source: https://docs.depict.ai/api-guide/introduction
What the Depict Platform API covers (search, listings, recommendations, tracking), the v2 vs v3 version status, and how markets, locales and currency are resolved.
The Platform API is the HTTP API at `https://api.depict.ai`. Use it when you want full control over the UX instead of the pre-built [Depict UI SDK](/react-ui-guide/introduction). It covers four areas, which you can integrate independently:
1. [Search](/api-guide/search) — search results and query suggestions
2. [Listings](/api-guide/listings) — category and collection pages: listing metadata, the navigation tree, and products
3. [Recommendations](/api-guide/recommendations/introduction) — product recommendations
4. [Tracking](/api-guide/tracking/introduction) — the interaction events that power attribution, metrics and ranking
The generated endpoint reference is in the API Reference tab, under **Platform API**. Whichever areas you integrate, also complete the [tracking guide](/api-guide/tracking/introduction) — without tracking events, attribution and ranking do not work.
## Build with an AI agent
Use [Build an integration with an AI agent](/api-reference/headless/build-with-ai-agent)
for search, listings, recommendations and tracking.
Use [Build collection pages with an AI agent](/api-reference/headless/build-collections-with-ai-agent)
for category and collection pages. Both pages include a short prompt and
reference instructions. Supply your merchant configuration when the agent asks.
## Versions
> [!WARNING]
>
> The Platform API currently has two active versions. Build new integrations
> against the `/v3` endpoints — `/v3` is the successor to `/v2`. `/v2` is
> expected to be deprecated within roughly 6 months and `/v3` within roughly 9
> months, with a v4 API expected in Q4. These are expectations, not committed
> dates — confirm timelines with your Depict contact before planning a
> migration deadline.
The `/v2/recommend/products/category` endpoint follows a different schedule from the rest of `/v2`: see [category recommendations](/api-guide/recommendations/api#category-recommendations).
## Request conventions on v3
| Convention | v3 | v2 |
| - | - | - |
| Store identifier field | `merchant` | `tenant` |
| `locale` | Required on every request | Optional, falls back to the default locale |
| User identity fields | `session_id` only | `user_id`, `session_id`, `dsid` |
> [!WARNING]
>
> v3 request bodies silently ignore unknown fields. A misspelled field name
> (for example `Limit` instead of `limit`) is dropped without an error, so the
> request succeeds with the field's default instead of failing.
## Markets, locales and currency
Enumerate the valid `market` and `locale` values for your account at runtime:
| Endpoint | Method | Response body |
| - | - | - |
| `/v3/markets?merchant={merchant}` | GET | `{"markets": ["..."]}` — sorted market ids |
| `/v3/locales?merchant={merchant}` | GET | `{"locales": ["..."]}` — sorted locale ids |
> [!NOTE]
>
> These endpoints return separate lists. They do not return valid market and
> locale pairs. Use the pairs configured for your storefront.
There is no currency request parameter anywhere in the API. Prices arrive pre-resolved inside display objects for the requested `market` and `locale`, and the only currency code the serving API emits is on range-filter metadata (for price sliders). On tracking events you supply `currency` yourself.
> [!TIP]
>
> If you are using TypeScript you can see all [API type definitions here](https://unpkg.com/browse/@depict-ai/types@latest/api/)
# Listings
Source: https://docs.depict.ai/api-guide/listings
How to call the Platform API listing endpoints: addressing by listing_id or external_id, listing metadata and content cards, the navigation tree, and fetching products.
> [!WARNING]
>
> The Platform API currently has two active versions. Build new integrations
> against the `/v3` endpoints — `/v3` is the successor to `/v2`. `/v2` is
> expected to be deprecated within roughly 6 months and `/v3` within roughly 9
> months, with a v4 API expected in Q4. These are expectations, not committed
> dates — confirm timelines with your Depict contact before planning a
> migration deadline.
Listings are category, collection and campaign pages. The Platform API splits a listing page across two calls: a GET for the listing's metadata (title, breadcrumbs, subcategories, content cards) and a POST for its products.
| Endpoint | Method | Purpose |
| - | - | - |
| `/v3/listings` | GET | The full listing tree — build navigation menus from one call |
| `/v3/listings/{listing_id}` | GET | Metadata for one listing, addressed by Depict id |
| `/v3/listings/external_id/{external_id}` | GET | Metadata for one listing, addressed by your own id |
| `/v3/listings/{listing_id}/products` | POST | Products in a listing, addressed by Depict id |
| `/v3/listings/external_id/{external_id}/products` | POST | Products in a listing, addressed by your own id |
## Limits and behavior
* Every route exists in two addressing variants: by Depict `listing_id` (a UUID) or by `external_id` (the listing's id in your PIM, CMS or e-commerce platform). Use whichever id system you store.
* The products response contains no listing metadata — no title, breadcrumbs or content cards. Fetch metadata with the GET routes.
* Filters, sorting and pagination on the products endpoint work exactly as on [search](/api-guide/search); the same limits apply (cursor `limit` 1–250, `hits_per_page` 1–200, no mixing of pagination styles).
* There is no `query` field on listing requests. The per-response tracking id is `product_listing_request_id` (search: `search_request_id`) and each display carries `product_listing_result_id` (search: `search_result_id`).
* The GET routes carry a 10-second cache header — they are designed to be called on every page load.
* An unknown `listing_id` or `external_id` returns 404.
* v2's body-based addressing (`query_id` — typically the slug — plus `type` to disambiguate name collisions) does not exist on v3. v3 addresses listings by path parameter, so slug ambiguity cannot occur.
* Response fields with null values are omitted from the JSON (`exclude_none` serialization).
## The listing object
All listing endpoints return listings in this shape:
| Field | Type | Description |
| - | - | - |
| `listing_id` | string (UUID) | Depict's id for the listing |
| `external_id` | string | The listing's id in your own system. May be absent |
| `listing_type` | string | One of `category`, `campaign`, `smart_pick`, `brand`, `look`, `style`, `long_tail_collection` — see [types of listing pages](/reference/glossary/types-of-listing-pages) |
| `title` | string | Display title of the listing |
| `slug` | string | URL slug. May be absent |
| `page_url` | string | The listing's page URL, when supplied. May be absent; use your storefront route mapping otherwise |
| `image_urls` | array of strings | Images for the listing |
| `show_in_breadcrumbs` | boolean | Whether to show the listing in navigation breadcrumbs |
| `show_in_quicklinks` | boolean | Whether to show the listing in quicklinks |
## Listing metadata
`GET /v3/listings/{listing_id}` or `GET /v3/listings/external_id/{external_id}` with query parameters `merchant`, `market`, `locale` (all required) and optional `session_id`.
The response is [the listing object](#the-listing-object) plus:
| Field | Type | Description |
| - | - | - |
| `ancestors` | array of listings | Ordered ancestors, root first — use for breadcrumbs |
| `siblings` | array of listings | Listings sharing the same parent, including the requested listing itself |
| `children` | array of listings | Direct children — use for subcategory navigation |
| `content_blocks` | array | The listing's content cards, to place in the product grid |
### Content cards
Content cards are merchandising tiles (images or videos) placed in the product grid. On the wire the field is named `content_blocks`. Each element:
| Field | Type | Description |
| - | - | - |
| `span_columns` | integer | Grid columns the card spans |
| `span_rows` | integer | Grid rows the card spans |
| `row` | integer | Grid row the card is placed on |
| `position` | string | Horizontal placement: `left`, `center` or `right` |
| `aspect_ratio` | number, optional | `1.5` for a Landscape 3:2 card: keep the card at width ÷ height = 1.5 instead of sizing it by the grid row. Absent for every other card |
| `visibility` | string, optional | The one device class the card shows on: `desktop` or `mobile`. Absent means every device. See [showing a card on one device](#showing-a-card-on-one-device) |
| `content` | object | The media: `type` (`image` or `video`), `url`, optional `link`, and the optional text overlay fields below |
The text overlay fields on `content`:
| Field | Type | Description |
| - | - | - |
| `text` | string or null | Single-line copy shown on the card, up to 140 characters |
| `cta` | string or null | Optional call-to-action line shown under `text` (for example "Shop now"), up to 60 characters |
| `text_position` | string | Where to place the overlay: one of `top-left`, `top-center`, `top-right`, `middle-left`, `middle-center`, `middle-right`, `bottom-left`, `bottom-center`, `bottom-right`. Defaults to `bottom-center` |
The API never sends `text` or `cta` longer than these limits: longer copy is shortened to fit rather than dropped, and line breaks and invisible characters are removed, so you can render the values as they arrive.
The API sends only the words and their position, never a font, colour or size. Your storefront renders the overlay, so style `text` and `cta` with your own CSS, for example with your brand font.
#### Showing a card on one device
A merchant can limit a card to desktop or to phones, for example to show a landscape video on desktop and a 9:16 video on phones. The card then carries `visibility`:
* `desktop`: show the card on desktop only.
* `mobile`: show the card on phones only.
* No `visibility`: show the card on every device. Treat any value you do not recognise the same way.
Leave a hidden card out **before** you place the cards in the grid, so products fill its cells. Hiding it with CSS after placement leaves a gap. Cards keep their own `row` and `position`, so the other cards do not move.
Your storefront decides which screens count as phones. Depict's own storefront components (`@depict-ai/ui` 4.10.32 and later) treat a viewport up to 990 px wide as a phone, the same breakpoint as Shopify Lite, and switch as the viewport changes. Use the same breakpoint unless your layout switches elsewhere.
## Navigation tree
`GET /v3/listings` with query parameters `merchant`, `market`, `locale` (all required) and an optional repeatable `types` parameter to filter by `listing_type`.
The response is a list of [listing objects](#the-listing-object), each extended with a recursive `children` array of the same shape — the complete listing tree in one call.
## Products in a listing
`POST /v3/listings/{listing_id}/products` or `POST /v3/listings/external_id/{external_id}/products` with a JSON body:
| Field | Type | Required | Description |
| - | - | - | - |
| `merchant` | string | Yes | Your merchant identifier |
| `market` | string | Yes | Market identifier |
| `locale` | string | Yes | Locale identifier |
| `filters` | array | No | Same semantics as [search filters](/api-guide/search#filters) |
| `sort` | object | No | Same semantics as [search sorting](/api-guide/search#sorting) |
| `session_id` | string | No | Session identifier; required for the request to be tracked and attributable |
| `metadata` | object | No | String-to-string map; only use values agreed with Depict |
| `cursor` / `limit` / `page` / `hits_per_page` | — | No | [Pagination](/api-guide/search#pagination), same rules as search |
Example request:
```json theme={null}
{
"merchant": "MERCHANT_ID",
"market": "MARKET",
"locale": "en",
"limit": 40,
"session_id": "SESSION_ID"
}
```
### Response
| Field | Type | Description |
| - | - | - |
| `displays` | array of objects | The products, one object per card. Merchant-specific product data; each display carries a `product_listing_result_id` used for [tracking](/api-guide/tracking/product-cards) |
| `n_hits` | integer | Total number of products in the listing. Not necessarily exact |
| `sorts` | array | Available sorting methods |
| `filters` | array | Available filters |
| `product_listing_request_id` | string | Identifier for this response, used in tracking |
| `cursor` | string | Cursor for the next page. Absent when there are no more results |
| `page` | integer | Echoed page index when page-based pagination was used; absent otherwise |
## Quicklinks and breadcrumbs when replacing the UI SDK
The metadata response supplies `ancestors`, `children` and `siblings`. It does
not supply a computed `quick_links` or `breadcrumbs` array.
To preserve the UI SDK's quicklink selection:
1. Select `children` when the unfiltered array is not empty.
2. Otherwise, select `siblings`.
3. Keep entries whose `show_in_quicklinks` value is `true`.
4. Keep the returned order.
For breadcrumbs, use `ancestors` in their returned order. Display entries
whose `show_in_breadcrumbs` value is `true`.
If your design also shows parent quicklinks, read them directly from the
metadata's `ancestors`. Filter these parents by `show_in_quicklinks`. Exclude
the current `listing_id` from the parent group. Remove duplicate listing IDs.
Do not require the current listing to occur in the selected quicklink group.
It usually does not occur in `children`.
Build links with your storefront's route function and the full ancestor
`slug` chain. For a child link, include the current listing's `slug` before
the child's `slug`. For a sibling link, use the current listing's ancestors.
Keep all route segments, even when a navigation flag hides a segment's label.
If a slug is absent, use your existing CMS route mapping.
# Interfacing directly with the API
Source: https://docs.depict.ai/api-guide/recommendations/api
How to call POST /v3/recommend/products: request fields, how product_ids selects the recommendation flavor, the response shape on the wire, and the status of category recommendations.
> [!WARNING]
>
> The Platform API currently has two active versions. Build new integrations
> against the `/v3` endpoints — `/v3` is the successor to `/v2`. `/v2` is
> expected to be deprecated within roughly 6 months and `/v3` within roughly 9
> months, with a v4 API expected in Q4. These are expectations, not committed
> dates — confirm timelines with your Depict contact before planning a
> migration deadline.
If you don't want to use our API Client you can make the requests yourself. Recommendations are served by a single endpoint:
```
POST https://api.depict.ai/v3/recommend/products
```
It replaces the three v2 endpoints `/v2/recommend/products/general`, `/v2/recommend/products/product` and `/v2/recommend/products/products` — the number of ids in `product_ids` selects the behavior. The full request/response schema is in the API Reference tab, under **Platform API**.
## Limits and behavior
* `limit` is 1–128.
* No category parameter exists on `/v3/recommend/products`, and category recommendations have no v3 endpoint — see [Category recommendations](#category-recommendations).
* Valid `type` values are configured per merchant. Get your list from your Depict contact; an unconfigured combination returns an error (see [Errors](#errors)).
* Unknown request fields are silently ignored — a misspelled field name is dropped, not rejected.
* Display fields depend on your merchant configuration — see [Response](#response).
## Request
| Field | Type | Required | Description |
| - | - | - | - |
| `merchant` | string | Yes | Your merchant identifier, provided by Depict |
| `market` | string | Yes | Market identifier |
| `locale` | string | Yes | Locale identifier |
| `type` | string | Yes | The recommendation type, e.g. `cross_sell`. Configured per merchant |
| `product_ids` | array of strings | No | Zero, one or multiple product identifiers — selects the behavior, see below. Default `[]` |
| `limit` | integer | No | Maximum number of recommendations, 1–128 |
| `session_id` | string | No | Session identifier; links the request to tracking |
`product_ids` selects which recommendations you get:
| `product_ids` | Behavior | Typical placement | v2 endpoint it replaces |
| - | - | - | - |
| Empty / omitted | General recommendations for the page type | Front page | `/v2/recommend/products/general` |
| One id | Recommendations for that product | Product page | `/v2/recommend/products/product` |
| Two or more ids | Recommendations for the set of products | Cart | `/v2/recommend/products/products` |
Common surface names include `after_basket` for a cart drawer and `checkout`
for checkout recommendations. These are separate surfaces. Preserve the type
and product context used by your existing integration. Confirm availability
for each market with Depict. Do not select a type only from a surface's display
title.
Example request:
```json theme={null}
{
"merchant": "MERCHANT_ID",
"market": "MARKET",
"locale": "en",
"type": "TYPE",
"product_ids": ["product-1", "product-2"],
"session_id": "SESSION_ID"
}
```
## Response
On the wire the response is:
| Field | Type | Description |
| - | - | - |
| `displays` | array of objects | The recommendations, one object per product card. Merchant-specific product data; each display carries a `recommendation_id` used for [tracking](/api-guide/tracking/product-cards) |
| `error` | string | Error message. Absent on success |
| `variant` | integer | A/B test variant, when an experiment is running. May be absent |
| `experiment_id` | string | A/B test experiment identifier. May be absent |
> [!NOTE]
>
> Displays contain merchant-specific objects. Confirm the fields your product
> cards need with Depict. Preserve each display's `recommendation_id` when you
> transform its product data.
## Category recommendations
> [!WARNING]
>
> `POST /v2/recommend/products/category` is deprecated and closed to new
> integrations. It remains available for its existing consumers, and its
> removal is aligned with the upcoming v4 recommendations launch — not with
> the general v2 deprecation timeline. No v3 equivalent exists today, and
> `/v3/listings` is not a substitute: it serves merchandised category browsing,
> which is a different contract from category recommendations.
If you have an existing integration on this endpoint: it takes a v2-shaped body (`tenant`, `market`, `category_id`, `type`) and returns the same response shape as above. Do not build new functionality on it.
## Errors
* An unconfigured merchant returns 400 with `{"detail": "Merchant {merchant} not configured for recommendations."}`.
* An unconfigured `(merchant, market, type)` combination returns 400 with `{"error": "(tenant, market, type) not yet configured. Please contact Depict."}`. The message wording uses the v2 vocabulary (`tenant`) and may change — match on the presence of `error`, not on the exact message text.
# JavaScript API client
Source: https://docs.depict.ai/api-guide/recommendations/api-client
Install the Depict UI package, import the recommendations client, and fetch recommendations for a page, a product or a set of products.
The JavaScript API client wraps `POST /v3/recommend/products` so you don't build the request yourself. It ships inside the Depict UI packages.
## Install
```shell NPM (React) theme={null}
npm i @depict-ai/react-ui
```
```shell Yarn (React) theme={null}
yarn add @depict-ai/react-ui
```
```shell NPM (JS) theme={null}
npm i @depict-ai/js-ui
```
```shell Yarn (JS) theme={null}
yarn add @depict-ai/js-ui
```
## Import
Add the import at the top of the file where you fetch recommendations:
```typescript js-ui theme={null}
import { fetchDepictRecommendations } from "@depict-ai/js-ui";
```
```typescript react-ui theme={null}
import { useFetchRecommendations } from "@depict-ai/react-ui";
// In the component that needs recommendations:
const { fetchRecommendations } = useFetchRecommendations();
// `merchant` and `market` are taken from the DepictProvider, so you don't
// pass them to this `fetchRecommendations`.
```
## Fetch recommendations
`fetchDepictRecommendations` takes an options object and returns a promise of an array of displays (product data). Every option is listed in the [reference](/reference/recommendations-sdk/recommendations-sdk-api-wrapper).
> [!NOTE]
>
> Where to find your merchant and market ids: see [Set up DPC](/api-guide/tracking/setup#merchant-and-market-ids).
> [!TIP]
>
> For a list of possible types, try checking the [preview browser](https://demo.depict.ai/null/null/recommendations?headers=%7B%22force-new-displays%22%3A%221%22%7D) or ask your Depict contact. Usually the available types are also detailed in the kickoff slides. If you get a response whose `error` says the `(tenant, market, type)` combination is not yet configured, that means a type isn't available for you - let us know if you want it. (The exact message text uses the v2 vocabulary `tenant` and may change.)
| Use case | Extra option | Example |
| - | - | - |
| General recommendations for a page type, most often the front page | none | `type: "front_page"` |
| Recommendations for one product, for example below the description on a product page | `productId` | `productId: "this-is-an-amazing-product"` |
| Recommendations for several products, for example everything in the cart | `productIds` | `productIds: ["product-1", "product-2"]` |
```typescript TypeScript theme={null}
import { fetchDepictRecommendations } from "@depict-ai/js-ui";
const frontPageRecs = await fetchDepictRecommendations({
merchant: "MERCHANT_ID",
market: "MARKET",
locale: "en_GB", // See demo.depict.ai for available locales
type: "TYPE",
});
const productPageRecs = await fetchDepictRecommendations({
merchant: "MERCHANT_ID",
market: "MARKET",
locale: "en_GB",
type: "TYPE",
productId: "this-is-an-amazing-product",
});
const cartRecs = await fetchDepictRecommendations({
merchant: "MERCHANT_ID",
market: "MARKET",
locale: "en_GB",
type: "TYPE",
productIds: ["product-1", "product-2", "product-3"],
});
```
That's it for fetching. Render the displays with your own product card, then follow the [tracking guide](/api-guide/tracking/introduction) so clicks and purchases are attributed to the recommendations.
# Introduction
Source: https://docs.depict.ai/api-guide/recommendations/introduction
We provide two ways to use the API:
1. [With our JavaScript API client (recommended)](/api-guide/recommendations/api-client)
2. [By making the requests yourself](/api-guide/recommendations/api) against `POST /v3/recommend/products`
To experiment with what recommendations are available for you and see queries made in action, checkout the [preview browser](https://demo.depict.ai/null/null/recommendations?headers=%7B%22force-new-displays%22%3A%221%22%7D).
> [!NOTE]
>
> Don't forget to follow the [tracking guide](/api-guide/tracking/introduction)
# Search
Source: https://docs.depict.ai/api-guide/search
How to call the Platform API search endpoints: the /v3/search/results request and response, pagination, filter and sort semantics, and /v3/search/suggestions.
> [!WARNING]
>
> The Platform API currently has two active versions. Build new integrations
> against the `/v3` endpoints — `/v3` is the successor to `/v2`. `/v2` is
> expected to be deprecated within roughly 6 months and `/v3` within roughly 9
> months, with a v4 API expected in Q4. These are expectations, not committed
> dates — confirm timelines with your Depict contact before planning a
> migration deadline.
Search on the Platform API consists of these endpoints:
| Endpoint | Method | Purpose |
| - | - | - |
| `/v3/search/results` | POST | Search results for a query, with filters, sorting and pagination |
| `/v3/search/suggestions` | GET | Query and listing suggestions for autocomplete |
| `/v3/search/related` | POST | Related-products recommendations for a search — returns a recommendations-shaped response, see the note below |
> [!NOTE]
>
> `/v3/search/related` returns the same response shape as
> [`/v3/recommend/products`](/api-guide/recommendations/api), not a search
> response. Its displays carry `recommendation_id` (not `search_result_id`) for
> [tracking](/api-guide/tracking/product-cards).
## Limits and behavior
* Every response is a single JSON body. No search endpoint streams; there is no SSE or chunked delivery.
* Two pagination styles exist — cursor-based and page-based. They are mutually exclusive: mixing fields from both in one request returns 400.
* Cursor-based `limit`: 1–250. Page-based `hits_per_page`: 1–200 and required whenever `page` is sent.
* `merchant`, `market` and `locale` are required on every request. Enumerate valid values via [`/v3/markets` and `/v3/locales`](/api-guide/introduction#markets-locales-and-currency).
* Unknown request fields are silently ignored — a misspelled field name is dropped, not rejected.
* Available filters and sorts are per-merchant configuration. Do not hardcode them: read them off the `filters` and `sorts` arrays in each response.
* `GET /v2/search/content` (dedicated content search) has no v3 equivalent. Content results are available only as `content_search_links` inside `/v3/search/results` responses.
* Suggestions responses carry a one-hour cache header; `limit` for suggestions is 1–10, default 3.
* Response fields with null values are omitted from the JSON (`exclude_none` serialization).
## Search results
`POST /v3/search/results` with a JSON body:
| Field | Type | Required | Description |
| - | - | - | - |
| `merchant` | string | Yes | Your merchant identifier, provided by Depict |
| `market` | string | Yes | Market identifier |
| `locale` | string | Yes | Locale identifier |
| `query` | string | No | The search query |
| `filters` | array | No | Filters to apply — see [Filters](#filters) |
| `sort` | object | No | Sorting method — see [Sorting](#sorting) |
| `session_id` | string | No | Session identifier; required for the request to be tracked and attributable |
| `metadata` | object | No | String-to-string map that can modify search behavior; only use values agreed with Depict |
| `cursor` | string | No | Cursor-based pagination — see [Pagination](#pagination) |
| `limit` | integer | No | Cursor-based pagination: max results per response, 1–250 |
| `page` | integer | No | Page-based pagination: 1-based page index |
| `hits_per_page` | integer | No | Page-based pagination: results per page, 1–200; required when `page` is sent |
Example request:
```json theme={null}
{
"merchant": "MERCHANT_ID",
"market": "MARKET",
"locale": "en",
"query": "jeans",
"limit": 40,
"session_id": "SESSION_ID"
}
```
### Response
| Field | Type | Description |
| - | - | - |
| `displays` | array of objects | The results, one object per product card. The contents are merchant-specific product data; each display also carries a `search_result_id` used for [tracking](/api-guide/tracking/product-cards) |
| `n_hits` | integer | Total number of results for the query. Not necessarily exact |
| `sorts` | array | Available sorting methods. Any element can be sent as `sort` in a subsequent request |
| `filters` | array | Available filters that can be sent back in a subsequent request |
| `search_request_id` | string | Identifier for this response, used in tracking |
| `cursor` | string | Cursor for the next page. Absent when there are no more results |
| `page` | integer | Echoed page index when page-based pagination was used; absent otherwise |
| `content_search_links` | array | Content pages matching the query — see [Content results](#content-results) |
## Pagination
| Style | Request fields | How to page |
| - | - | - |
| Cursor-based | `cursor`, `limit` (1–250) | Omit `cursor` for the first request. Send the response's `cursor` in the next request until the response has no `cursor` |
| Page-based | `page` (≥1), `hits_per_page` (1–200) | Request each page by index. `hits_per_page` is required whenever `page` is sent |
Rules for how the two styles interact:
* The styles are mutually exclusive. A request that mixes fields from both returns 400 with `{"error": "Cannot mix cursor-based and page-based pagination."}`.
* `page` without `hits_per_page` returns 400.
* An undecodable `cursor` returns 400 with `{"error": "Invalid pagination cursor."}`.
* The response mirrors the style used: page-based requests always echo `page` (defaulting to 1) and omit `cursor`; cursor-based requests omit `page`.
## Filters
Each response's `filters` array describes the available filters. To apply a
filter, send its `field`, `op` and selected `data` in the next request.
The schema requires `field` and `op`. It permits omitted or null `data`, but
that does not select a value. An empty selection does not constrain results.
A filter object:
| Field | Type | Description |
| - | - | - |
| `field` | string | The product attribute the filter applies to |
| `op` | string | One of `eq`, `neq`, `in`, `nin`, `leq`, `geq`, `inrange` |
| `data` | varies | The selected state — format depends on the filter type, see below |
| `meta` | object | UI metadata (type, title, selectable values, counts, display names). Returned by the API; not required when sending a filter back |
| `id` | string | Groups filters that belong together. Optional |
The filter type is in `meta.type`:
| `meta.type` | Selection behavior | `data` format |
| - | - | - |
| `range` | Numeric range, e.g. price | `[min, max]` |
| `radio` | Exactly one value selectable | List with the selected value |
| `checkbox` | Multiple values selectable | List of selected values |
| `checkbox-grid` | Same as `checkbox`; render compactly as a grid (typically sizes) | List of selected values |
| `checkbox-color` | Same as `checkbox`; `meta.swatches` provides color swatches per value | List of selected values |
| `checkbox-hierarchical` | Tree of values, typically categories | List of paths — see below |
### Range filters
`data` is `[min, max]`. `meta` carries the selectable bounds `min` and `max`, plus optional `unit` and `currency` for rendering.
### Value filters
`data` is the list of selected values. `meta.values` lists the selectable values, `meta.counts` the result count per value, and `meta.names` optional display names.
### Hierarchical filters
`data` is a list of paths, where each path is the list of node titles from the root to a selected node. If a parent is selected, all of its children must also be included as selected.
Example: a category tree where the user selected **Shirts** and **Jeans**:
1. Clothes
1. **Shirts**
1. **Cotton Shirts**
2. **Linen Shirts**
2. Pants
1. **Jeans**
2. Shorts
Selecting Shirts (a parent) implies both of its children, so the corresponding `data` is:
```json theme={null}
[
["Clothes", "Shirts"],
["Clothes", "Shirts", "Cotton Shirts"],
["Clothes", "Shirts", "Linen Shirts"],
["Clothes", "Pants", "Jeans"]
]
```
Invalid filter, market or locale combinations return 422 with `{"error": "Invalid request parameters. Please check your filters, market, and locale."}`.
## Sorting
Each response's `sorts` array lists the available sorting methods for your catalog; the default is relevance. To sort, send one of them back as `sort`: `{"field": "...", "order": "asc" | "desc"}`. The `meta` object on each sort (title, selectable orders, display names) is for rendering and does not need to be sent back.
## Query suggestions
`GET /v3/search/suggestions` with query-string parameters:
| Parameter | Type | Required | Description |
| - | - | - | - |
| `merchant` | string | Yes | Your merchant identifier |
| `market` | string | Yes | Market identifier |
| `locale` | string | Yes | Locale identifier |
| `query` | string | No | The partial query the user has typed |
| `session_id` | string | No | Session identifier |
| `limit` | integer | No | Maximum number of suggestions, 1–10. Default 3 |
The response is `{"suggestions_request_id": "...", "suggestions": [...]}` where each suggestion is one of two shapes:
| `type` | Fields | Meaning |
| - | - | - |
| `query` | `query`, `suggestions_result_id` | A suggested search query |
| `listing` | `listing_id`, `external_id`, `listing_type`, `title`, `slug`, `image_urls`, `show_in_breadcrumbs`, `show_in_quicklinks`, `ancestors`, `suggestions_result_id` | A suggested [listing](/api-guide/listings). `ancestors` is the ordered breadcrumb path, root first |
> [!NOTE]
>
> On v2 the suggested-query field was named `title` and listing suggestions
> were category suggestions. On v3 the field is `query` and suggestions
> reference listings.
Suggestions responses carry a one-hour cache header. If the suggestions index for the requested locale has not been built yet, the endpoint returns 404 with an `{"error": ...}` body.
## Content results
There is no dedicated content-search endpoint on v3 — `GET /v2/search/content` has no successor. Content results arrive as the `content_search_links` array on `/v3/search/results` responses. Each element:
| Field | Type | Description |
| - | - | - |
| `type` | string | Always `content_link` |
| `title` | string | Title of the content page |
| `description` | string | Short description. May be absent |
| `image_url` | string | Image for the content page. May be absent |
| `page_url` | string | URL of the content page |
| `highlights` | array | Snippets showing why the query matched |
## Errors
| Status | Body | Cause |
| - | - | - |
| 400 | `{"error": "..."}` | Invalid cursor, `page` without `hits_per_page`, mixed pagination styles, unknown merchant/market configuration |
| 422 | `{"error": "..."}` | Invalid filters, market or locale |
| 422 | `{"detail": [...]}` | Request body fails schema validation (missing required field, wrong type) |
| 404 | `{"error": "..."}` | Suggestions index or search backend resource not found |
| 500 | `{"error": "..."}` | A handled search backend failure; the message includes an `Error ID` |
| 503 | `{"detail": "..."}` | Search is temporarily unavailable; the response can include `Retry-After` |
Handled unexpected search errors include an `Error ID`. Give that ID to Depict
support. Other failures can have a different body. Check the HTTP status before
you read response fields. Apply a request timeout in your storefront. Keep the
page usable if the request fails. Depict does not specify a storefront timeout
or a rate-limit policy on this page.
## Product card data
`displays` contains merchant-specific product objects. Confirm your display
mapping with Depict before you assign types to these objects.
If your mapping uses `variant_displays` and `variant_index`, select the card
variant with `display.variant_displays[display.variant_index]`. The
[display transformer guide](/reference/listings-search/display-transformers)
shows this structure and the usual card fields:
* `product_id` identifies the selected variant for product page and add-to-cart tracking.
* `title` supplies the card title.
* `image_urls` is an array of image URLs. Some mappings use one `image_url` instead.
* `sale_price` and `original_price` supply the resolved prices.
* `page_url` can come from your display transformer. It is not guaranteed in the raw response.
* If your mapping supplies `in_stock`, use it for the card's availability state.
Preserve `search_result_id` on the outer display for card tracking. Use the
returned prices for the requested market and locale. Keep the API's product
order. If a returned variant is unavailable, disable its add-to-cart control.
Do not infer availability from the image or price. Provide an image placeholder
when no usable image is present.
# Add to cart tracking
Source: https://docs.depict.ai/api-guide/tracking/add-to-cart
You need to track both the add-to-cart button on your product page and, if applicable, on your product cards
You can either send `addToCart` events manually to Depict, or automatically by marking add-to-cart buttons in the DOM using the `depict-add-to-cart` class. The automatic tracking is limited to one product id per product detail page and product card. If your website uses size and color selectors before adding to cart, the imperative tracking is more reliable.
**Sending add-to-cart events imperatively**
> [!NOTE]
>
> Use the same variant-level `product_id` that our API returns in the displays
> — the same id vocabulary as [`setProductId`](/api-guide/tracking/product-pages).
> See [Which ID goes where](/api-guide/tracking/ids).
Whenever a product was successfully added to the cart anywhere on your website (including surfaces not directly related to Depict), send an `addToCart` event with the corresponding product id. If you implement imperative tracking, skip the automatic tracking section below.
```typescript dpq theme={null}
dpq("addToCart", "[PRODUCT_ID_FOR_ADDED_PRODUCT]");
```
```typescript DPC instance theme={null}
dpc.sendAddToCartEvent({ product_id: "[PRODUCT_ID_FOR_ADDED_PRODUCT]" });
```
**Mark up your add-to-cart buttons for automatic tracking**
Add the `depict-add-to-cart` class to all add-to-cart buttons on your website, including product cards and product detail pages. Depict will automatically track clicks as necessary, using the [product id](/api-guide/tracking/product-pages) set on product detail pages or [result id](/api-guide/tracking/product-cards) for buttons inside product cards.
```html HTML theme={null}
```
# Which ID goes where
Source: https://docs.depict.ai/api-guide/tracking/ids
Tracking uses three different kinds of ids. Sending the right one in each event is what makes attribution work.
Depict tracking uses **three id vocabularies**. They look similar but are not interchangeable, and sending the wrong kind does not produce an error — the event is accepted and then silently fails to match anything, which quietly degrades your metrics. This page is the reference for which id each event needs.
| Event | Id to send | Where it comes from |
| - | - | - |
| Product card clicks | **result id** (`search_result_id`, `recommendation_id` or `product_listing_result_id`) | Returned inside every display in our API responses. You place it on the card as a data attribute — see [Product Card Tracking](/api-guide/tracking/product-cards). |
| `setProductId` (PDP views) | **product id** (`product_id`) | The `product_id` field of the displays our API returns. It identifies the product on variant level — on Shopify this is the variant id. |
| `addToCart` | **product id** (`product_id`) | Same as `setProductId`. Use the id of the variant that was added. |
| `purchase` → `items[].item_id` | **transaction product id** | The id your product data was ingested with for transaction matching. By default this is the SKU from your catalog; on Shopify it is the variant's SKU, or the variant id for variants without a SKU. |
## Why the difference matters
* **Result ids** are unique per API response, not per product — they tie a click to the exact search, listing or recommendation that produced it. That link is what powers surface-level performance metrics and lets ranking learn from real behaviour.
* **Product ids** join PDP views and add-to-carts to your catalog. If the id you send doesn't match the displays' `product_id`, those events can't be connected to products.
* **Transaction product ids** join purchase line items to your catalog through a mapping that is refreshed on every catalog ingestion. A line item whose `item_id` doesn't match drops out of per-product revenue, best-seller and funnel metrics — while still counting toward raw totals, which makes the gap easy to miss.
> [!WARNING]
>
> The most common integration mistake is sending the displays' `product_id` as
> a purchase `item_id` (or vice versa). They are different vocabularies —
> purchases match on your SKUs, not on `product_id` — unless your catalog
> happens to use the same value for both.
## Result-id lifetime and event validation
Rules that apply when sending events — DPC follows them automatically, so they matter mostly for server-side or custom event senders posting to `/create-events`:
* **A result id is attributable for 10 minutes** after the API response that contained it was generated. Send click events promptly with the exact id from the clicked display — an event with an expired or unknown result id is accepted with a 200 but can no longer be attributed to its search, listing or recommendation.
* Every event must carry at least one identity field: `session_id`, `user_id` or `dsid`. A batch containing an event without one is rejected with 422, naming the index of the failing event.
* A `click` event must carry at least one of `search_result_id`, `recommendation_id`, `product_listing_result_id` or `click_location` — otherwise the batch is rejected with 422.
Which result id each endpoint returns:
| Endpoint the display came from | Result id on the display |
| - | - |
| `/v3/search/results` | `search_result_id` |
| `/v3/listings/.../products` | `product_listing_result_id` |
| `/v3/recommend/products` | `recommendation_id` |
| `/v3/search/related` | `recommendation_id` — related-products displays are recommendations and do **not** carry `search_result_id` |
## How to verify
The "Tracking status" tab on [app.depict.ai](https://app.depict.ai) shows your incoming events live. The table at the bottom lists examples of valid product ids from your ingested catalog — compare them against what your events are sending. After your first test purchases, confirm they map to catalog products rather than only appearing in raw event counts.
# Introduction
Source: https://docs.depict.ai/api-guide/tracking/introduction
A guide to setting up tracking for your Depict API integration
For any Depict product that's integrated, it is important to set up tracking so that our product performs correctly. Visit the "Tracking status" tab on [app.depict.ai](https://app.depict.ai) for live feedback on your tracking events.
This guide will walk you through the steps to set up tracking for your Depict project using DPC (Depict Performance Client).
> [!NOTE]
>
> Is your integration built on the legacy `@depict-ai/react-ui` SDK? That
> package installs and initialises DPC automatically — skip ahead to [Product
> Card Tracking](/api-guide/tracking/product-cards) and follow it for any
> product cards you render yourself. `@depict-ai/js-ui` does not initialise DPC
> for you — if you use it, install and initialise DPC by following this guide.
> [!NOTE]
>
> For more detailed information see the [DPC
> Reference](/reference/performance-client/introduction-to-depict-performance-client)
## Testing without polluting analytics
There is no sandbox host and no test merchant: `https://api.depict.ai` is the only environment, and tracked test traffic counts toward your production analytics. Do not use a merchant id ending in `demo` as a staging stand-in — those ids are proxied to a legacy backend and do not behave like production v3.
To keep test and load-test traffic out of your analytics:
* Send the header `track: false` on `/v3/search/results` and `/v3/listings/.../products` requests. These endpoints record a search/listing analytics event server-side on every tracked request, so load tests without this header inflate your dashboards.
* Omit `session_id` from serving requests. Requests without a session id are excluded from tracking.
* Requests from load-test tools identifying as `Locust...` and from common crawler user agents are excluded automatically: serving-side tracking is skipped, and `POST /create-events` returns `{"message": "ok"}` without processing the events.
When verifying that events are accepted, use a browser-like `User-Agent` — a crawler-like one makes `/create-events` a no-op that still returns 200. A 200 `{"message": "ok"}` confirms the batch parsed, not that attribution resolved; use the "Tracking status" tab on [app.depict.ai](https://app.depict.ai) to confirm events arrive, and see [result-id lifetime](/api-guide/tracking/ids#result-id-lifetime-and-event-validation) for the rules that make events attributable.
# Product Card Tracking
Source: https://docs.depict.ai/api-guide/tracking/product-cards
How to make sure DPC tracks your product cards correctly
> [!NOTE]
>
> These steps apply to product cards you render yourself. Cards rendered by a
> legacy Depict UI SDK already carry these attributes.
We need to tell DPC about the product cards that you created using Depict data. Also, you need to enable Depict to understand what product this product card is in our internal representation.
In the response from all our API:s there's an id inside each display. You need to add this id to your product card template as a data attribute.
The ID is called different things based on different endpoints
| Endpoint you got product data from | Name of ID in `display` (display = product data provided from API response) | Attribute name to be used |
| - | - | - |
| /v3/listings/\* | product_listing_result_id | data-product-listing-result-id |
| /v2/product-listing | product_listing_result_id | data-product-listing-result-id |
| /v3/recommend/products | recommendation_id | data-recommendation-id |
| /v2/recommend/\* | recommendation_id | data-recommendation-id |
| /v3/search/results | search_result_id | data-search-result-id |
| /v2/search/results | search_result_id | data-search-result-id |
| /v3/search/related | recommendation_id | data-recommendation-id |
| /v2/search/related | recommendation_id | data-recommendation-id |
> [!NOTE]
>
> `/v3/search/suggestions` returns no displays, so there is nothing to tag for it.
This step enables DPC to track clicks on the product cards — including clicks on [add-to-cart buttons](/api-guide/tracking/add-to-cart) inside them. Cards added later (for example after client-side navigation or infinite scroll) are picked up automatically.
## Examples
One attribute per card, named after the endpoint the display came from (see the table above). The value is the id from that display.
```html Collection or category page (/v3/listings/*) theme={null}
```
## Product card impressions
A click data attribute does not prove that impression tracking is active.
When you render cards yourself, add visibility tracking for search, listing
and recommendation cards. Check the events your installed DPC version sends
before you add a second sender.
Send a card impression when the card becomes visible. Send it from the
browser, after rendering. Do not send an impression only because the server
rendered a card in HTML.
A custom sender can use `POST https://api.depict.ai/create-events` with a JSON
array. Each event requires `tenant`, `market`, `type` and at least one identity
field: `session_id`, `user_id` or `dsid`. For an impression, set `type` to
`element_visible`. Include the result ID from the visible display and its
selected variant's `product_id`.
```json theme={null}
[
{
"tenant": "MERCHANT_ID",
"market": "MARKET",
"session_id": "SESSION_ID",
"type": "element_visible",
"search_result_id": "RESULT_ID_FROM_DISPLAY",
"product_id": "PRODUCT_ID_FROM_SELECTED_VARIANT"
}
]
```
For listing cards, use `product_listing_result_id` instead of `search_result_id`.
For recommendation cards, use `recommendation_id`. Include exactly the result
ID for the card's source. A custom click sender uses the same endpoint and
identity fields, with `type: "click"` and the card's result ID.
`/create-events` uses `tenant`, although v3 serving requests use `merchant`.
Use the same session ID in serving requests, DPC and custom events. Configure
DPC with [`setSessionId`](/reference/performance-client/performance-client#informing-depict-of-logged-in-users-optional).
The [ID guide](/api-guide/tracking/ids#result-id-lifetime-and-event-validation)
explains the 10-minute result ID lifetime and event validation.
Check the HTTP status when sending events. A `200` response with
`{"message": "ok"}` confirms that the batch passed validation. It does not
prove that result IDs matched. Confirm event arrival and product matching in
the portal's Tracking status tab.
# Product Page Tracking
Source: https://docs.depict.ai/api-guide/tracking/product-pages
How to make sure DPC tracks your Product Details Page (PDP) views correctly.
> [!NOTE]
>
> The product id used in `setProductId` and `addToCart` events must be the
> same id that our API returns in the displays as `product_id` — see [Which ID
> goes where](/api-guide/tracking/ids). For examples of valid product ids, see
> the bottom table on the "Tracking status" tab on
> [app.depict.ai](https://app.depict.ai).
Every time after navigating to a page representing a product on your website, you need to send a `setProductId` event to register which product id is currently viewed. This includes client-side route changes in single-page apps: DPC detects the navigation and invalidates the previous product id, but it never infers the new one — send `setProductId` again on every PDP view.
```typescript dpq theme={null}
dpq("setProductId", "PRODUCT_ID_FOR_CURRENT_PDP");
```
```typescript DPC instance theme={null}
dpc.setProductId("PRODUCT_ID_FOR_CURRENT_PDP");
```
# Purchase tracking
Source: https://docs.depict.ai/api-guide/tracking/purchases
To calculate revenue figures, you need to track purchases. This is done with the `purchase` event.
A purchase is an event that tracks when a user has gone through the checkout process and paid for a set of products. Send it once, from your order-confirmation page.
Send events for **all** purchases — including ones that had nothing to do with Depict. Store-wide purchase data is the baseline that Depict's performance and analytics metrics are computed against.
```typescript dpq theme={null}
dpq("purchase", {
transaction_id: "YOUR_TRANSACTION_ID",
items: [{ item_id: "white-socks-xl", price: 89.9, quantity: 12 }],
currency: "SEK",
});
```
```typescript DPC instance theme={null}
dpc.sendPurchaseEvent({
transaction_id: "YOUR_TRANSACTION_ID",
items: [{ item_id: "white-socks-xl", price: 89.9, quantity: 12 }],
currency: "SEK",
});
```
## Field reference
* **`transaction_id`** — the id of the order in your system. It must be stable and unique per purchase: Depict deduplicates purchase events on it, so accidentally sending the same order twice is safe, but reusing an id across different orders loses data.
* **`items`** — one entry per order line:
* **`item_id`** — the id this product was ingested with as its *transaction product id*. By default that is the SKU from your product data; on Shopify it is the variant's SKU, or the variant id for variants without a SKU. See [Which ID goes where](/api-guide/tracking/ids).
* **`price`** — the final **per-unit** price, after taxes and discounts. If a discount applies to a whole line, spread it across the units. Items with price `0` (for example free gifts) are excluded from purchase metrics.
* **`quantity`** — a whole number, at least 1.
* **`currency`** — the ISO 4217 code the prices are denominated in (e.g. `SEK`, `EUR`). Revenue is converted for display in the portal, so the code must be correct.
> [!WARNING]
>
> A wrong `item_id` does not produce an error — the line item is accepted but
> can't be matched to your catalog, so it silently disappears from per-product
> metrics and attribution while still counting toward raw totals. After going
> live, check the "Tracking status" tab on
> [app.depict.ai](https://app.depict.ai) to confirm your purchases map to
> catalog products.
> [!NOTE]
>
> Purchase events are sent from the browser. If your checkout completes on a
> domain where DPC can't run, or you'd rather report purchases
> server-to-server, [contact us](mailto:support@depict.ai) — we'll set it up
> together.
> [!TIP]
>
> Tracking is set up. Open the "Tracking status" tab on [app.depict.ai](https://app.depict.ai) to confirm that product card, product page, add-to-cart and purchase events arrive.
# Set up DPC
Source: https://docs.depict.ai/api-guide/tracking/setup
Install, import and initialise the Depict Performance Client once, then send events from anywhere in your app.
DPC (Depict Performance Client) is the small browser library that sends tracking events to Depict. Set it up once; the event pages that follow assume `dpc` is initialised.
## Install
Add the dependency to your project:
```shell NPM theme={null}
npm i @depict-ai/dpc
```
```shell Yarn theme={null}
yarn add @depict-ai/dpc
```
If you don't use a module bundler, skip this step and load DPC from a CDN in the next one.
## Import
Add the import at the top of the file where you initialise DPC:
```ts ESM theme={null}
import { DPC } from "@depict-ai/dpc";
```
```ts CommonJS theme={null}
const { DPC } = require("@depict-ai/dpc");
```
```html Not using a module bundler theme={null}
```
## Initialise
Execute this once in your application, with your merchant id and the market the visitor is browsing:
```ts theme={null}
import { DPC } from "@depict-ai/dpc";
const dpc = new DPC("{merchant_id}", { market: "market" })
```
Both values are case-sensitive; merchant ids are always lowercase. Once DPC is initialised, the `dpq` global for sending events imperatively is also available. See the [DPC reference](/reference/performance-client/performance-client) for more information.
### Merchant and market ids
> [!NOTE]
>
> Your **merchant id** is the first path segment after `/v2` in the portal URL:
> when you're logged in at [app.depict.ai](https://app.depict.ai) the address
> looks like `app.depict.ai/v2/your-merchant-id/dashboard`. It's always
> lowercase.
> [!NOTE]
>
> Your **market ids** are set up together with your data ingestion and appear
> in the market filters throughout the portal (for example on the Analytics
> page). Use them exactly as written there — they are case-sensitive. If in
> doubt, ask your Depict contact.
> [!WARNING]
>
> **Consent management:** DPC stores a single random visitor identifier in
> `localStorage` under the key `_dep_id` (with a cookie fallback of the same
> name) and starts sending events as soon as it is initialised — it has no
> built-in consent gating. If your consent policy requires it, only initialise
> DPC after the visitor has consented to performance/analytics tracking.
# A collection's copies across the multi-store group, with replication sources
Source: https://docs.depict.ai/api-reference/a-collections-copies-across-the-multi-store-group-with-replication-sources
/api-reference/openapi/lite.json get /multi-store/replication-data/{collection_id}
For one of `merchant_id`'s collections, every linked copy in the group's stores (the collection itself included) and which store each copy replicates from. Call it before editing replication for a collection. Empty when the merchant has no group or the collection is not linked. Read-only.
# A product's available stock per variant and market group
Source: https://docs.depict.ai/api-reference/a-products-available-stock-per-variant-and-market-group
/api-reference/openapi/lite.json get /products/{product_id}/variant-stock
Available quantity of each variant in each of the merchant's market groups. Read-only. A single-market store, or a failed stock read, answers the empty payload (no groups).
# Add, change or remove some of a collection version's content cards
Source: https://docs.depict.ai/api-reference/add-change-or-remove-some-of-a-collection-versions-content-cards
/api-reference/openapi/lite.json patch /brand-features/{collection_id}
Merges changes into one collection version's content cards: cards the body does not name are left exactly as they are. Read the cards first with `GET /brand-features/{collection_id}`, then send each card you change whole, as GET returned it with only your change applied: a field left out is cleared. A handle of this version's cards updates that card in place; a card without a handle is created and placed first. A handle that belongs to a card outside this collection version is refused (409). `delete_handles` removes cards from this version. Versions of a collection can share a card, so an update shows in every version that lists it. Send one PATCH at a time per collection: a PATCH that races another is refused (409) and must be retried from a fresh GET. Media must be existing Shopify file gids (for example one another card uses); uploading new images or videos is not available. Side effects: Shopify metaobject writes, live on the storefront at once when the version is the collection's published one. Returns the version's resulting cards in GET's shape, including generated handles. Give each new card a `handle` of your own (lowercase letters, digits, `-`, `_`), so resending a PATCH whose answer you lost updates the card instead of creating it twice.
# An AI assistant's pending connection request, for the consent panel
Source: https://docs.depict.ai/api-reference/an-ai-assistants-pending-connection-request-for-the-consent-panel
/api-reference/openapi/lite.json get /mcp/consent
Reads the request an MCP client (an AI assistant such as Claude Code) parked when it started signing in to a store's endpoint: which client asks, where approving sends the browser, for which scopes, on which store. The Settings page calls it with the link's `mcp_txn` to render the consent panel, then POST /mcp/consent to approve. Read-only; a request lasts 10 minutes.
# Compare Analytics Endpoint
Source: https://docs.depict.ai/api-reference/analytics/compare-analytics-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/analytics/compare
# Create Api Key Endpoint
Source: https://docs.depict.ai/api-reference/analytics/create-api-key-endpoint
/api-reference/openapi/portal.json post /api/v1/merchants/{merchant_id}/analytics/api-keys
# Export Analytics Endpoint
Source: https://docs.depict.ai/api-reference/analytics/export-analytics-endpoint
/api-reference/openapi/portal.json post /api/v1/merchants/{merchant_id}/analytics/export
# Get Analytics Overview Endpoint
Source: https://docs.depict.ai/api-reference/analytics/get-analytics-overview-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/analytics/overview
Merchant-wide analytics for the hub page. Defaults to last 30 days vs
the previous 30; pass ``start_timestamp`` / ``end_timestamp`` (Unix seconds,
UTC date only) for a custom range. ``None`` when the metrics backend is
unavailable (degrade like api_v0's KPI endpoints, never a 500).
# Get Analytics Periods Endpoint
Source: https://docs.depict.ai/api-reference/analytics/get-analytics-periods-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/analytics/periods
# List Api Keys Endpoint
Source: https://docs.depict.ai/api-reference/analytics/list-api-keys-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/analytics/api-keys
# Revoke Api Key Endpoint
Source: https://docs.depict.ai/api-reference/analytics/revoke-api-key-endpoint
/api-reference/openapi/portal.json delete /api/v1/merchants/{merchant_id}/analytics/api-keys/{key_id}
# Apply one automated sort to many collections
Source: https://docs.depict.ai/api-reference/apply-one-automated-sort-to-many-collections
/api-reference/openapi/lite.json put /collections/bulk-automated-sorting
Saves `sort_order` (plus optional collection-specific boost/bury rules) as the main version of up to 100 collections and syncs each back to Shopify; with `publish_non_live`, collections Depict did not manage yet are activated too (plan-capped, 402). Per-collection failures land in `errors`. Returns the rollup.
# Approve an AI assistant's connection request
Source: https://docs.depict.ai/api-reference/approve-an-ai-assistants-connection-request
/api-reference/openapi/lite.json post /mcp/consent
Approves a request read with GET /mcp/consent: grants the MCP client the scopes it asked for and the user approved, on the request's store, and answers the client's OAuth redirect. Navigate the top-level window to `redirect_to` to finish connecting. Side effects: one OAuth grant for the store, replacing the approving user's earlier grants of the same client (other users' grants of it stay); it lasts 30 days; the client's registration is renewed for 90 days; the request is used up (approving it again answers 404).
# Build the unpublished theme copy with search in it
Source: https://docs.depict.ai/api-reference/build-the-unpublished-theme-copy-with-search-in-it
/api-reference/openapi/lite.json post /search-onboarding/go-live
Queues the job that duplicates the live theme and applies the prepared search header to the copy. Allowed once the status is `stashed` (or to retry `golive_failed`, or to recreate at `live_ready`). Poll searchOnboardingStatus until `live_ready`, which carries the editor and preview links; the merchant publishes the copy in Shopify. Needs a plan that includes Search.
# Cancel a collection version's scheduled publish
Source: https://docs.depict.ai/api-reference/cancel-a-collection-versions-scheduled-publish
/api-reference/openapi/lite.json put /collections/{collection_id}/unschedule_version/{version}
Clears the version's schedule. Nothing is unpublished.
# Cancel the subscription and drop to the free tier
Source: https://docs.depict.ai/api-reference/cancel-the-subscription-and-drop-to-the-free-tier
/api-reference/openapi/lite.json delete /settings/subscription
Downgrades the merchant to the free tier. Side effects, in order: sync-back to Shopify is switched off for the listed collections (at most 3; more is a 400 before anything changes), then the Shopify app subscription is cancelled with proration. Answers null.
# Cart and order stages each Depict feature led to
Source: https://docs.depict.ai/api-reference/cart-and-order-stages-each-depict-feature-led-to
/api-reference/openapi/lite.json get /depict-funnel
The bridged funnel stages (carts, carted, ordered, orders) of the collection, recommendation and search funnels under the same rule as depictAttribution, for the window and the one before. Read-only.
# Change search settings and the empty-state configuration
Source: https://docs.depict.ai/api-reference/change-search-settings-and-the-empty-state-configuration
/api-reference/openapi/lite.json patch /search-config
Partial update of the merchant's search config: every field is optional and an omitted field keeps its stored value; `search_configuration` merges key by key. Saves the store's search settings, which live storefront search uses, so a save changes what shoppers see. Read back with the configuration and states routes. An empty body is a no-op.
# Change the multi-store group's settings
Source: https://docs.depict.ai/api-reference/change-the-multi-store-groups-settings
/api-reference/openapi/lite.json put /multi-store/group-settings/{merchant_id}
Sets the toggles present in the body for `merchant_id`'s whole group and returns the resulting settings. Side effects: enabling auto_replicate_enabled makes the caller the replication source (if none is recorded) and stamps existing links to replicate from it; enabling sync_publish_status publishes every replica whose source is live and syncs those stores back to Shopify. Switching a toggle from off to on requires multi-store in the plan (402 otherwise); re-sending an unchanged toggle or switching one off never does.
# Clicks per content block in a collection over a date range
Source: https://docs.depict.ai/api-reference/clicks-per-content-block-in-a-collection-over-a-date-range
/api-reference/openapi/lite.json get /brand-features/content-block-clicks/{collection_id}
Storefront clicks (and, where recorded, click and impression sessions) per content block in the collection between from_date and to_date inclusive, from Depict analytics. Use it to rank content blocks by engagement. Read-only; ranges up to 365 days.
# Clicks, views and CTR per product in one collection
Source: https://docs.depict.ai/api-reference/clicks-views-and-ctr-per-product-in-one-collection
/api-reference/openapi/lite.json get /analytics/collections/{collection_id}/product-clicks
Per product in the collection's grid over from_date..to_date: clicks, share of the top product's clicks, average grid position, views and CTR. Optionally narrowed to one market or market group. Read-only.
# Add Collection Favourite Endpoint
Source: https://docs.depict.ai/api-reference/collections/add-collection-favourite-endpoint
/api-reference/openapi/portal.json put /api/v1/merchants/{merchant_id}/collections/{collection_id}/favourite
# Compare Collection Analytics Endpoint
Source: https://docs.depict.ai/api-reference/collections/compare-collection-analytics-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/collections/{collection_id}/analytics/compare
# Create Collection Endpoint
Source: https://docs.depict.ai/api-reference/collections/create-collection-endpoint
/api-reference/openapi/portal.json post /api/v1/merchants/{merchant_id}/collections
# Delete Collection Endpoint
Source: https://docs.depict.ai/api-reference/collections/delete-collection-endpoint
/api-reference/openapi/portal.json delete /api/v1/merchants/{merchant_id}/collections/{collection_id}
# Discard Collection Curation Override Endpoint
Source: https://docs.depict.ai/api-reference/collections/discard-collection-curation-override-endpoint
/api-reference/openapi/portal.json delete /api/v1/merchants/{merchant_id}/collections/{collection_id}/curation
# Get Collection Analytics Endpoint
Source: https://docs.depict.ai/api-reference/collections/get-collection-analytics-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/collections/{collection_id}/analytics
# Get Collection Curation Endpoint
Source: https://docs.depict.ai/api-reference/collections/get-collection-curation-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/collections/{collection_id}/curation
# Get Collection Endpoint
Source: https://docs.depict.ai/api-reference/collections/get-collection-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/collections/{collection_id}
# Get Collection Metrics Endpoint
Source: https://docs.depict.ai/api-reference/collections/get-collection-metrics-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/collections/{collection_id}/metrics
# Get Collections Metrics Endpoint
Source: https://docs.depict.ai/api-reference/collections/get-collections-metrics-endpoint
/api-reference/openapi/portal.json post /api/v1/merchants/{merchant_id}/collections/metrics
Metrics for an explicit set of collections in one request.
Replaces the per-row `GET /{collection_id}/metrics` burst from the
collections list: the whole-catalog Tinybird fetch is shared across the
batch and memberships resolve concurrency-capped server-side. The id cap
is route-level only (batch internals serve the 300-collection overview)
and fits the list page's max page size; larger sets must be chunked by
the caller.
# Get Collections Metrics Summary Endpoint
Source: https://docs.depict.ai/api-reference/collections/get-collections-metrics-summary-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/collections/metrics/summary
Storewide totals over the whole catalog's metrics — the collections
KPI row's source. Route safety is by shape, not declaration order:
``{collection_id}`` can't match across ``/`` so it can't swallow
``metrics/summary``, and ``/{collection_id}/metrics`` needs a literal
``metrics`` second segment — don't add a ``:path`` convertor to those.
503 (not an all-zero summary) when the listing metrics are unavailable,
so degraded infrastructure reads as "unavailable" client-side rather
than as a store with no traffic.
# List Collection Favourites Endpoint
Source: https://docs.depict.ai/api-reference/collections/list-collection-favourites-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/collections/favourites
# List Collection Products Endpoint
Source: https://docs.depict.ai/api-reference/collections/list-collection-products-endpoint
/api-reference/openapi/portal.json post /api/v1/merchants/{merchant_id}/collections/{collection_id}/products
# List Collections Endpoint
Source: https://docs.depict.ai/api-reference/collections/list-collections-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/collections
# Remove Collection Favourite Endpoint
Source: https://docs.depict.ai/api-reference/collections/remove-collection-favourite-endpoint
/api-reference/openapi/portal.json delete /api/v1/merchants/{merchant_id}/collections/{collection_id}/favourite
# Save Collection Endpoint
Source: https://docs.depict.ai/api-reference/collections/save-collection-endpoint
/api-reference/openapi/portal.json patch /api/v1/merchants/{merchant_id}/collections/{collection_id}
# Update Collection Parent Endpoint
Source: https://docs.depict.ai/api-reference/collections/update-collection-parent-endpoint
/api-reference/openapi/portal.json put /api/v1/merchants/{merchant_id}/collections/{collection_id}/parent
# Compose a recommendation surface
Source: https://docs.depict.ai/api-reference/compose-a-recommendation-surface
/api-reference/openapi/lite.json post /recommendations/compose
Composes a surface by id (or an unsaved `draft` of it) from the merchant's current candidate pools, as the storefront would, and returns the product id per slot with the shuffle seed used. Pass `anchor` for a product or category surface and `recent_views` to exercise history-seeded steps. Use it to test what shoppers would see; for the editor's saved-surface preview by name, see the surface preview routes. Read-only: nothing is written or recomputed.
# Connect an Instagram account from an OAuth code
Source: https://docs.depict.ai/api-reference/connect-an-instagram-account-from-an-oauth-code
/api-reference/openapi/lite.json post /instagram/{merchant_id}/account/connect
Finishes Instagram's OAuth flow: exchanges the code for a long-lived token and stores it encrypted as the merchant's Instagram login, replacing any previous one. Only useful right after the OAuth dialog redirects back; codes are single-use. Returns JSON `null`.
# Connect another store to this merchant's multi-store group
Source: https://docs.depict.ai/api-reference/connect-another-store-to-this-merchants-multi-store-group
/api-reference/openapi/lite.json post /multi-store/connect-store/{merchant_id}
Joins `merchant_id` and the store whose activation code is given into one multi-store group (creating the group if neither has one). Call it when a merchant enters another store's activation code. Side effect: writes both merchants' group. Follow with create-collection-mappings to link their collections by handle. Refused when both stores are already in groups. Requires multi-store in the plan of the caller and of every store it would put into a group (402 otherwise).
# Connect or release collections across the group's stores
Source: https://docs.depict.ai/api-reference/connect-or-release-collections-across-the-groups-stores
/api-reference/openapi/lite.json post /multi-store/collection-mappings/{group_id}
Puts `connect.collections` into one cross-store connection (an existing `group_collection_id`, or a new one) and/or releases `disconnect.collections` from theirs (the mapping row stays, unlinked). Every merchant named must belong to the group. Side effects: writes mapping rows; if the group has auto-replicate on, new links are stamped to replicate from its source. Connecting requires multi-store in the caller's plan (402 otherwise); releasing never does. Answers null.
# Copy an image or video from a public URL into the merchant's Shopify Files
Source: https://docs.depict.ai/api-reference/copy-an-image-or-video-from-a-public-url-into-the-merchants-shopify-files
/api-reference/openapi/lite.json post /media/{merchant_id}/upload_media_from_url
Downloads `url` and uploads it to Shopify Files like /upload does (same waiting, same multi-store fan-out and side effects), returning the processed file node. Used to import Instagram media into a content block. A source that answers 4xx (e.g. an expired Instagram CDN link) is a 400; the source must send a Content-Length.
# Count the merchant's active collections
Source: https://docs.depict.ai/api-reference/count-the-merchants-active-collections
/api-reference/openapi/lite.json get /collections/nbr-of-active-collections
Returns how many collections Depict currently manages (sync_back_to_shopify on) for the merchant: the number plan limits cap. Read-only.
# Count what this store would have to unlink before disconnecting
Source: https://docs.depict.ai/api-reference/count-what-this-store-would-have-to-unlink-before-disconnecting
/api-reference/openapi/lite.json get /multi-store/unlink-collections/{merchant_id}
How many mapping rows `merchant_id` has in its group, and how many of them GET collection-mappings does not show. Call it before offering disconnect. Read-only; zeros for a store in no group.
# Countries that searched in a date range
Source: https://docs.depict.ai/api-reference/countries-that-searched-in-a-date-range
/api-reference/openapi/lite.json get /search-reports/countries
The country codes seen in the inclusive from_date..to_date range, for a country filter. Not narrowed by country. Read-only.
# Create a market group (or rename the group its name maps to)
Source: https://docs.depict.ai/api-reference/create-a-market-group-or-rename-the-group-its-name-maps-to
/api-reference/openapi/lite.json post /{merchant_id}/market-groups
Creates a group whose id is derived from `name` (lowercased; spaces, dashes and `/ \ ? # %` to underscores; an all-dot id to underscores) and moves the given markets into it. A name that maps to an existing id renames that group instead. Returns the group.
# Create or replace a recommendation surface
Source: https://docs.depict.ai/api-reference/create-or-replace-a-recommendation-surface
/api-reference/openapi/lite.json put /recommendations/surfaces/{surface_name}
Creates the surface named in the path, or replaces its editable fields (context, steps, filters, limit, exclusions) if it exists; an existing surface keeps its id and serving directives. The body's `name` must equal the path's. Side effects: writes the storefront metaobject in Shopify, then the recommendations config; deletes pins whose anchor type the new context no longer admits; queues a background recompute of this surface and replicates the change to linked stores. Requires recommendations in the store's plan (402 otherwise),. Changed metafield keys request full ingestion after saving. Returns the saved surface.
# Create or update a collection version
Source: https://docs.depict.ai/api-reference/create-or-update-a-collection-version
/api-reference/openapi/lite.json put /collections/{collection_id}/update_version
Saves the body as a version of the collection without publishing it (publishing is PUT …/publish_version/{version}); `version` null or unknown creates a new version. Side effects: writes the version row, and when `is_market_active` is true deactivates the other versions of the same market or market group; then triggers a Shopify order sync-back (its failure does not fail the save). Setting `is_market_active` true makes the version live for its market, so it requires collection versions in the plan like publishing does (402 otherwise); drafting never does. Returns the version as stored.
# Create, update or delete a collection version's brand features
Source: https://docs.depict.ai/api-reference/create-update-or-delete-a-collection-versions-brand-features
/api-reference/openapi/lite.json put /brand-features/{collection_id}
Writes one kind of brand feature (content blocks, image settings, product duplicates or the legacy A/B test) for a collection version: upserts `upsert_metaobjects` as Shopify metaobjects (matched by `handle`) and deletes `delete_metaobjects_by_handle`, then records the version's feature list. Side effects: Shopify metaobject writes (live on the storefront for the published version), definition creation on first use, and multi-market expansion. Returns a list of warnings; `[]` when there are none.
# Daily results of a collection A/B test
Source: https://docs.depict.ai/api-reference/daily-results-of-a-collection-ab-test
/api-reference/openapi/lite.json get /ab-test/{collection_id}/metrics
Page views, clicks, add-to-carts and purchases per day for variant A (the original collection) and B (Depict's), their rates, and a p-value per rate over the whole window. Read the test's dates from its metaobject and pass them as from_date/to_date. Read-only; the input for abTestGenerateConclusion.
# Daily search health: no-results, click rates, latency
Source: https://docs.depict.ai/api-reference/daily-search-health:-no-results-click-rates-latency
/api-reference/openapi/lite.json get /search-reports/guardrails-daily
Per day: searches, no-result rate, click-through, no-click rate, median click position and index latency. Takes the current and previous windows (from_ts/to_ts, prev_from_ts/prev_to_ts) and answers both, for period-over-period comparison. Read-only.
# Decline an AI assistant's connection request
Source: https://docs.depict.ai/api-reference/decline-an-ai-assistants-connection-request
/api-reference/openapi/lite.json delete /mcp/consent
Declines a request read with GET /mcp/consent: nothing is granted. The client is told (`redirect_to` carries `error=access_denied`) only when its redirect URI is on this computer (loopback): anyone can register any other, and following it would turn a click on Cancel into a redirect to a stranger's page. Works while AI assistants are off for the store or the Depict app is not installed on it, so a refused request can still be answered. Side effect: the request is used up (declining it again answers 404).
# Delete a collection version
Source: https://docs.depict.ai/api-reference/delete-a-collection-version
/api-reference/openapi/lite.json delete /collections/{collection_id}/delete_version/{version}
Deletes the version: retires it from any market it is live on (a failure there is logged, not fatal), removes it from the Shopify versions metafields, and if it was main clears the main pointer and the live brand-feature metafields; then deletes the row and triggers the order sync-back. Irreversible. An unknown version still answers 200. Returns null.
# Delete a recommendation surface and its pins
Source: https://docs.depict.ai/api-reference/delete-a-recommendation-surface-and-its-pins
/api-reference/openapi/lite.json delete /recommendations/surfaces/{surface_name}
Deletes the surface named in the path. Side effects: deletes its Shopify metaobject, removes it from the recommendations config, deletes all its pins, and replicates the deletion to linked stores; other surfaces are unaffected and no recompute is queued. Returns `{deleted: }`. Irreversible.
# Delete an ended collection version A/B test
Source: https://docs.depict.ai/api-reference/delete-an-ended-collection-version-ab-test
/api-reference/openapi/lite.json delete /collections/{collection_id}/ab-tests/{test_id}
Deletes a test that is no longer running, with its Shopify metaobjects. A running test must be ended first (409). No content (204).
# Delete this store's own cross-store collection links
Source: https://docs.depict.ai/api-reference/delete-this-stores-own-cross-store-collection-links
/api-reference/openapi/lite.json post /multi-store/unlink-collections/{merchant_id}
Permanently deletes `merchant_id`'s own mapping rows (all, or the listed collections), which is what lets it disconnect. All or nothing: refused with 409 while another store still replicates from any of them; those stores unlink first. Never touches another store's rows.
# Disconnect an AI assistant from a store
Source: https://docs.depict.ai/api-reference/disconnect-an-ai-assistant-from-a-store
/api-reference/openapi/lite.json delete /mcp/grants/{grant_id}
Revokes one grant from GET /mcp/grants and every token issued under it: the assistant's next call is refused, and it has to be connected again. Idempotent: an unknown or already revoked grant also answers 204.
# Disconnect the merchant's Instagram account
Source: https://docs.depict.ai/api-reference/disconnect-the-merchants-instagram-account
/api-reference/openapi/lite.json post /instagram/{merchant_id}/account/disconnect
Stores an Instagram config with no login, so `instagramAccount` answers `null` and `instagramMedia` 400s until an account is connected again. Instagram itself is not called. Returns JSON `null`.
# Enable or disable every market in a market group
Source: https://docs.depict.ai/api-reference/enable-or-disable-every-market-in-a-market-group
/api-reference/openapi/lite.json put /{merchant_id}/market-groups/{group_id}/toggle
Enables or disables Depict for all markets in the group. Disabling returns a warning with the number of active collection versions that target the group, and queues a Shopify sort sync for the merchant's active collections.
# End, extend or refresh a collection version A/B test, or promote a winner
Source: https://docs.depict.ai/api-reference/end-extend-or-refresh-a-collection-version-ab-test-or-promote-a-winner
/api-reference/openapi/lite.json patch /collections/{collection_id}/ab-tests/{test_id}
Applies one lifecycle action (see the body). Promoting makes the variant's version the collection's main version and syncs it to Shopify. Returns the updated test.
# Create Events
Source: https://docs.depict.ai/api-reference/events/create-events
/api-reference/openapi/storefront.json post /create-events
Send a JSON array of card impression or click events. This endpoint uses tenant, although v3 serving requests use merchant. Read the product card tracking guide at /api-guide/tracking/product-cards for event examples and ID rules. A successful response confirms validation; it does not prove attribution.
# Create Events V2
Source: https://docs.depict.ai/api-reference/events/create-events-v2
/api-reference/openapi/storefront.json post /v2/create-events
# Every theme-onboarding run for a merchant, newest first
Source: https://docs.depict.ai/api-reference/every-theme-onboarding-run-for-a-merchant-newest-first
/api-reference/openapi/lite.json get /onboarding/{merchant_id}/onboardings
The full history behind the admin Theme Onboardings page: per run, the theme, when it ran, and each resource Depict generated (with the patched file and whether it changed against the next-older run). Unpaginated and potentially tens of MB for long-lived stores; bodies past 8 MB stream, so a late failure truncates the body instead of answering 500. Read-only; for support/debugging, not for routine polling.
# Build collection pages with an AI agent
Source: https://docs.depict.ai/api-reference/headless/build-collections-with-ai-agent
A short agent prompt and API reference instructions for category and collection pages.
> [!WARNING]
>
> **Legacy.** These pages describe the v2 and v3 endpoints. New integrations use the
> [Platform API](/api-v4/introduction). To move an existing integration, see
> [Upgrade from v3/v2](/api-v4/upgrade).
Use this prompt when you want to replace collection and category grids with
Platform API calls. Copy it into your coding agent. Use the
[full integration prompt](/api-reference/headless/build-with-ai-agent) for a
migration that also includes search and recommendations.
## Agent prompt
```text theme={null}
Integrate Depict collection and category listings into our storefront with direct Platform API calls.
Follow https://docs.depict.ai/api-guide/listings
Use https://docs.depict.ai/api-guide/search#pagination and https://docs.depict.ai/api-guide/search#filters for request controls.
Follow https://docs.depict.ai/api-guide/tracking/product-cards and https://docs.depict.ai/api-guide/tracking/ids
Use the endpoint reference: https://docs.depict.ai/api-reference/headless/overview#api-overview
Read the machine contract: GET https://api.depict.ai/openapi.json
Treat actual serving responses as the runtime authority. Verify card event acceptance and attribution in Tracking status.
Ask me for our merchant id, our markets and locales, listing IDs, and where product routes and tracking data live.
```
## Runtime authority
Read the published machine contract at `GET https://api.depict.ai/openapi.json`.
Use actual serving responses for your merchant, market and locale. Confirm
card event acceptance and attribution in the portal's Tracking status tab.
HTTP 200 alone does not prove attribution. Product fields depend on the
merchant's display mapping.
## Scope and server rendering
Replace only the category and collection page integration. Keep the store's
existing search, recommendation and other tracking integrations.
Render products, navigation and metadata in the first server response.
Hydrate that response without a second first-page request. Fetch metadata and
products independently when their listing ID is already known. Use the same
session identity in serving requests and browser events. Confirm how the
store supplies that identity during the first SSR request.
If your current grid renders after browser mounting, move its first render
to the server. Reuse your storefront's route function, product card design
and currency formatter.
## Endpoint contract
Use `https://api.depict.ai`. GET requests carry query parameters; POST
requests carry JSON bodies. Required serving fields are `merchant`, `market`
and `locale`. Send `session_id` for attributable product requests.
| Method and path | Other request inputs | Response fields |
| - | - | - |
| GET `/v3/listings/{listing_id}` | Required UUID path ID; optional `session_id` | Listing metadata below |
| GET `/v3/listings/external_id/{external_id}` | Required merchant listing ID; optional `session_id` | Same metadata shape |
| POST `/v3/listings/{listing_id}/products` | Required path ID; optional `filters`, `sort`, pagination | `displays`, `n_hits`, `filters`, `sorts`, `product_listing_request_id`, `cursor` or `page` |
| POST `/v3/listings/external_id/{external_id}/products` | Required merchant listing ID; same body | Same product response shape |
Listing product requests have no `query` field. Product responses do not
contain listing metadata. Fetch that metadata with the GET route.
Use the existing CMS mapping to obtain the listing ID or external ID.
For discovery, GET `/v3/markets?merchant={merchant}` returns `markets`.
GET `/v3/locales?merchant={merchant}` returns `locales`. These routes require
only `merchant`. Separate lists do not establish every valid market/locale pair.
## Pagination, filters and sorting
Choose one pagination mode:
* Cursor mode: send `limit` from 1 to 250. Omit `cursor` initially. Send each returned cursor unchanged. Stop when no cursor remains.
* Page mode: send `page` from 1 and `hits_per_page` from 1 to 200. `hits_per_page` is required with `page`.
Do not mix the modes. Reset pagination when the listing, filters, sort,
market or locale changes. Keep the current storefront's page size and
navigation behavior. Do not treat approximate `n_hits` as proof of completeness.
Build controls from returned `filters` and `sorts`. Send the chosen filter's
`field`, `op` and selected `data`. Read `meta.type`, `meta.values`,
`meta.counts`, `meta.names`, range `min`/`max`, and optional `meta.currency`.
Use the documented selection format for each filter type. Keep its returned
operator. Send a returned sort's `field` and `order`.
## Metadata, breadcrumbs and quicklinks
Use `listing_id`, optional `external_id`, `listing_type`, `title`, optional
`slug` and `page_url`, `image_urls`, `show_in_breadcrumbs`,
`show_in_quicklinks`, `ancestors`, `children`, `siblings` and `content_blocks`.
Use `content_blocks` for the API's merchandising cards. Preserve any existing
CMS content placement required by the storefront.
The response supplies raw hierarchy arrays. It does not supply computed
`quick_links` or `breadcrumbs` arrays. To preserve SDK quicklink selection:
1. Select the unfiltered `children` array when it contains entries.
2. Otherwise, select `siblings`.
3. Keep entries with `show_in_quicklinks: true`.
4. Keep the returned order.
Build parent quicklinks independently from raw `ancestors`. Keep flagged
parents in their returned order. Exclude the current `listing_id` from the
parent group. Remove duplicate IDs. The current category need not occur in
child quicklinks. Sibling quicklinks can include the current category.
Build breadcrumbs from ordered ancestors with `show_in_breadcrumbs: true`.
Display the current category according to the existing page design.
Use a supplied `page_url` when available. Otherwise, use the storefront route
function with the complete ancestor slug chain. Add the current slug for a
child path. Use the current ancestors for a sibling path. Hidden navigation
labels must not remove URL segments. Resolve missing slugs through the CMS.
A listing with children can omit the current category from its quicklink
selection. Read parent links from metadata instead of requiring the current
category to occur in that selection.
## Product card data
Confirm your merchant's display mapping before assigning product types.
If your mapping uses `variant_displays` and `variant_index`, select
`display.variant_displays[display.variant_index]`. Keep
`product_listing_result_id` on the outer display.
Common selected-variant fields include `product_id`, `title`, `image_urls`,
`sale_price` and `original_price`. Use `in_stock` if your mapping supplies it.
Your cards need an availability state and a product URL. Confirm the complete
mapping for each market.
Use a returned product `page_url` when available. Create missing URLs with
your storefront's route function and its confirmed display fields.
Support a documented single `image_url` mapping when applicable. Provide a
placeholder for missing images. Disable purchase controls for unavailable
variants. Keep API product order and returned prices. Retain the store's
configured market currency and price formatter. No serving currency request
parameter exists.
## Card clicks and impressions
Reuse the browser's DPC instance. Set the same serving session through
`dpc.setSessionId(session_id)`. Update DPC when the active market changes.
Add `data-product-listing-result-id` to each card, using its exact outer
`product_listing_result_id`. DPC records card clicks from this attribute.
The response's `product_listing_request_id` cannot replace a card result ID.
Add visibility tracking separately. A custom sender posts a JSON array to
`POST https://api.depict.ai/create-events`. Each card impression carries
`tenant`, `market`, `session_id`, `type: "element_visible"`,
`product_listing_result_id` and the selected `product_id`. This event endpoint
uses `tenant`; serving requests use `merchant`. At least one identity field
is required. Send visibility events from the browser. Server rendering alone
is not an impression. Check existing senders to prevent duplicate events.
A custom click sender can use the same endpoint with `type: "click"` and the
card result ID. Use one click sender. Result IDs expire after 10 minutes.
Confirm event arrival and product matching in Tracking status.
## Caching, timeouts and errors
Cache listing metadata by merchant, market, locale and ID for at most
10 seconds, as its cache header permits. Chosen project policy: keep product
responses and SSR HTML with result IDs out of shared caches. Obtain fresh
result IDs from new product responses before their attribution lifetime expires.
Choose a request deadline within the storefront's SSR budget. A starting
project budget is 1,500 ms per serving request. This is not an API guarantee.
Check HTTP status before reading display fields. Handle invalid requests,
missing listings, malformed JSON and temporary failures with an empty
component. Keep the rest of the page usable. Log status and any Error ID.
Preserve the existing canonical URL and SEO metadata.
## Acceptance checks
For a migration, compare the existing integration and API with the same
listing, session, market, locale, filters, sort and page size. For a new
integration, compare the rendered view with its API response. For anonymous API comparisons, omit
`session_id` and use `track: false`. Do not send comparison impressions.
Verify actual tracking separately with attributable user journeys.
* Compare a listing with children. Verify its flagged parents and child links.
* Compare a leaf listing. Verify sibling links and the current listing's active state.
* Compare a root listing. Check navigation without ancestors and apply returned filters and sorts.
* Traverse pagination through its last page. Check order, termination, omissions and duplicate cards.
* Repeat for every configured market/locale pair. Check titles, URLs, prices, currency and availability.
* Check initial SSR HTML, hydration, client navigation, empty results and timeout handling.
* Verify card clicks and visibility events with the returned result IDs and the common session.
Equal means the same ordered products, selected variants, prices, stock
state, images, filter selections/counts and URL targets. Newly generated IDs
can differ. Parent links must remain available when child quicklinks omit
the current listing.
## Sources and open questions
Use these public guides with the [API overview](https://docs.depict.ai/api-reference/headless/overview#api-overview)
and `GET https://api.depict.ai/openapi.json`:
* [Listings](/api-guide/listings): endpoints, metadata, cache headers, hierarchy and navigation rules.
* [Search controls](/api-guide/search): pagination, filters, sorting and common card fields.
* [API introduction](/api-guide/introduction): discovery routes, market/locale combinations and currency behavior.
* [Card tracking](/api-guide/tracking/product-cards): click attributes and visibility events.
* [Tracking IDs](/api-guide/tracking/ids): identity, result ID lifetime and validation.
* [DPC reference](/reference/performance-client/performance-client): market and shared session configuration.
* [Display transformers](/reference/listings-search/display-transformers): product URLs and variant fields.
* [Published OpenAPI contract](https://api.depict.ai/openapi.json): machine-readable request and response schemas.
Confirm listing IDs and locale pairs, the display mapping, stock and pre-order
behavior, first SSR session handling, missing slugs, caching and retry policy.
Confirm rate limits and API migration dates with Depict. The timeout and SSR
cache policies above are implementation choices.
# Build an integration with an AI agent
Source: https://docs.depict.ai/api-reference/headless/build-with-ai-agent
A short agent prompt and reference instructions for a Platform API storefront integration.
> [!WARNING]
>
> **Legacy.** These pages describe the v2 and v3 endpoints. New integrations use the
> [Platform API](/api-v4/introduction). To move an existing integration, see
> [Upgrade from v3/v2](/api-v4/upgrade).
Copy the prompt below into your coding agent. Give the agent your store's
configuration when it asks. The reference sections apply to any merchant.
Use the [collections-only prompt](/api-reference/headless/build-collections-with-ai-agent)
for a migration limited to category and collection pages.
## Agent prompt
```text theme={null}
Integrate the Depict Platform API into our stack for search, listings, recommendations and tracking.
Follow https://docs.depict.ai/api-guide/introduction and https://docs.depict.ai/api-guide/search
Follow https://docs.depict.ai/api-guide/listings, https://docs.depict.ai/api-guide/recommendations/api and https://docs.depict.ai/api-guide/tracking/introduction
Use the endpoint reference: https://docs.depict.ai/api-reference/headless/overview#api-overview
Read the machine contract: GET https://api.depict.ai/openapi.json
Treat actual serving responses as the runtime authority. Verify event acceptance and attribution in the portal's Tracking status tab.
Ask me for our merchant id, our markets and locales, recommendation surfaces, and where catalog and tracking data live.
```
## Runtime authority
The published machine contract is `GET https://api.depict.ai/openapi.json`.
It describes request and response schemas. It does not define every
merchant-specific display field or establish tracking attribution.
Use actual serving responses for the requested merchant, market and locale.
Check HTTP status and response error fields. A successful tracking response
confirms batch validation. Confirm attribution in the portal's Tracking status
tab. Read the integration guides with the generated endpoint reference.
## Integration scope and SSR
Build your storefront with direct Platform API calls. Render the first search
and listing results with server-side rendering (SSR). Preserve API ranking,
filters, pagination, navigation, prices and availability. For a migration,
compare these results with the existing integration.
Use your merchant configuration and its valid market/locale pairs. Use `/v3`
serving endpoints at `https://api.depict.ai`. Keep DPC for browser tracking.
Confirm how your storefront supplies a common session during the first SSR
request and subsequent browser interactions.
## Endpoints and response fields
All serving routes in this table require `merchant`, `market` and `locale`.
GET routes use query parameters. POST routes use JSON bodies. Use the same
`session_id` in supported serving requests and tracking.
| Method and exact path | Other request fields | Fields to use |
| - | - | - |
| POST `/v3/search/results` | Optional `query`, `filters`, `sort`, pagination | `displays`, `n_hits`, `filters`, `sorts`, `search_request_id`, `cursor` or `page`, `content_search_links` |
| GET `/v3/search/suggestions` | Optional `query`, `limit` 1–10, default 3 | `suggestions_request_id`, `suggestions`; query suggestions use `type`, `query`, `suggestions_result_id`; listing suggestions use `listing_id`, `title`, `slug`, `ancestors`, `suggestions_result_id` |
| GET `/v3/listings/{listing_id}` or `/v3/listings/external_id/{external_id}` | Required path ID; optional `session_id` | `listing_id`, `external_id`, `listing_type`, `title`, optional `slug` and `page_url`, `image_urls`, navigation flags, `ancestors`, `children`, `siblings`, `content_blocks` |
| POST `/v3/listings/{listing_id}/products` or `/v3/listings/external_id/{external_id}/products` | Required path ID; optional `filters`, `sort`, pagination | `displays`, `n_hits`, `filters`, `sorts`, `product_listing_request_id`, `cursor` or `page`; metadata comes from GET |
| POST `/v3/recommend/products` | Required `type`; optional `product_ids`, `limit` 1–128 | `displays`, `error`; optional `variant`, `experiment_id` |
Discover IDs with GET `/v3/markets?merchant={merchant}` and GET
`/v3/locales?merchant={merchant}`. Their response fields are `markets` and
`locales`. These routes require only `merchant`. The lists do not establish
all valid market/locale combinations. GET `/v3/listings` requires `merchant`,
`market` and `locale`. It returns the navigation tree.
Use the recommendation `type` configured for each surface and market.
Common names include `after_basket` and `checkout`. Confirm their availability
with Depict. Preserve each surface's existing product context during a
migration. Empty `product_ids` selects general recommendations. One ID selects
product recommendations. Multiple IDs select recommendations for that set.
Use the API's `product_id` values for the product context.
Choose one pagination mode. Cursor mode uses `limit` from 1 to 250 and
optional `cursor`. Page mode uses `page` from 1 and required `hits_per_page`
from 1 to 200. Never mix the modes. Start without a cursor. Send each returned
cursor unchanged. Stop when no cursor remains. Reset pagination when the
query, listing, filters, sort, market or locale changes. `n_hits` can be
approximate.
Build facets from returned `filters` and sorting controls from `sorts`.
Send selected `field`, `op` and `data`. Read `meta.type`, `meta.values`,
`meta.counts`, `meta.names`, range bounds and optional `meta.currency`.
Preserve each filter's returned operator. Send a returned sort's `field`
and `order`.
For quicklinks, select the unfiltered `children` array when it contains
entries. Otherwise, select `siblings`. Then filter by `show_in_quicklinks`.
If your design includes parent quicklinks, read them independently from raw
`ancestors`. Exclude the current ID from the parent group. Remove duplicate
IDs. Preserve the returned order.
Build breadcrumbs from ancestors with `show_in_breadcrumbs: true`, root first.
Use a returned `page_url` when available. Otherwise, use your route function
with the full slug chain. Child paths include the current listing's slug.
Hidden navigation labels must not remove route segments. Preserve
`content_blocks` placement.
## Tracking
Initialize `new DPC(merchant, { market })` once in the browser. Call
`dpc.setSessionId(session_id)` with the serving session. Update DPC on market
changes.
Tag each card with its outer display result ID. Search uses
`data-search-result-id`. Listings use `data-product-listing-result-id`.
Recommendations use `data-recommendation-id`. DPC records card clicks.
Request IDs cannot replace card result IDs.
Implement card visibility events separately. POST `/create-events` accepts
a JSON array. Each impression uses `tenant`, `market`, `session_id`,
`type: "element_visible"`, selected `product_id` and the corresponding result
ID field. Set `tenant` to your merchant identifier. Send impressions when
cards become visible. Avoid duplicate senders. Result IDs expire after
10 minutes. Confirm attribution in Tracking status. HTTP 200 alone is
insufficient.
On every PDP visit, call `dpc.setProductId(product_id)`. After each successful
cart addition, call `dpc.sendAddToCartEvent({ product_id })` with the added
variant. Send all purchases once through `dpc.sendPurchaseEvent`.
Supply a stable `transaction_id`, `items` and the actual ISO `currency`.
Each item needs `item_id`, final per-unit `price` and integer `quantity` of
at least 1. Purchase `item_id` uses the ingested transaction product ID.
Confirm that mapping for your catalog. Missing events reduce recommendation
quality and ranking feedback.
## Rendering and operation
Confirm your merchant's display mapping before assigning product types.
If it uses `variant_displays` and `variant_index`, select
`display.variant_displays[display.variant_index]`. Preserve the outer result
ID. Your cards need a product identity, title, image, price, availability
state and product URL.
Common variant fields include `product_id`, `title`, `image_urls` or
`image_url`, `sale_price` and `original_price`. Use `in_stock` if your mapping
supplies it. Create missing product URLs with your route mapping and display
transformer. Confirm any URI field before using it. Disable purchase controls
for unavailable variants. Preserve API order. Use an image placeholder for
missing images.
Prices already reflect the requested market and locale. The serving API has
no currency request parameter. Retain your storefront's configured market
currency and price formatter.
Cache listing metadata and the tree by merchant, market, locale and ID for
at most 10 seconds. Suggestions have a one-hour cache header. Keep product
responses and SSR HTML containing result IDs out of shared caches. Obtain
fresh result IDs from new serving responses.
Choose a serving timeout within your storefront's page budget. A starting
budget is 1,500 ms per request. This is a project choice, not an API guarantee.
Handle failed HTTP status, malformed JSON and recommendation `error` with
an empty component. Keep the page usable. Log status and any Error ID.
Preserve your canonical URLs and SEO metadata.
## Acceptance checks
Use your catalog, routes, configured surfaces and market/locale pairs.
For a migration, compare the existing integration with the API implementation
under the same session, query, filters, sort and page size. For a new
integration, compare each rendered view with its API response.
* Test representative product queries, a query with no matches and selected filters.
* Test a listing with children, a listing with siblings and a root listing.
* Verify flagged parent links when the current listing is absent from child quicklinks.
* Traverse pagination through its last page. Check order, termination and duplicate cards.
* Compare each recommendation surface with the same product context.
* Repeat the checks for each configured market/locale pair.
* Check initial SSR HTML, hydration, navigation, empty states and timeouts.
* Verify card, PDP, add-to-cart and purchase events with the correct identities.
Equal means the same ordered products, variants, prices, availability,
images, filter selections/counts and URL targets. Generated tracking IDs can
differ. For read-only search and listing comparisons, use `track: false`.
Omit `session_id` for anonymous checks. Verify actual tracking separately
with attributable user journeys.
## Sources and open questions
Use these public guides with the [API overview](https://docs.depict.ai/api-reference/headless/overview#api-overview)
and `GET https://api.depict.ai/openapi.json`:
* [API introduction](/api-guide/introduction): request conventions, discovery routes, markets, locales and currency.
* [Search](/api-guide/search): results, suggestions, filters, sorting, pagination, product data and errors.
* [Listings](/api-guide/listings): metadata, products, cache headers, hierarchy and navigation rules.
* [Recommendations](/api-guide/recommendations/api): configured types, product context and response fields.
* [DPC setup](/api-guide/tracking/setup): browser initialization.
* [Card tracking](/api-guide/tracking/product-cards): click attributes and visibility events.
* [Tracking IDs](/api-guide/tracking/ids): result IDs, product IDs, transaction IDs and event validation.
* [PDP tracking](/api-guide/tracking/product-pages), [add-to-cart tracking](/api-guide/tracking/add-to-cart) and [purchase tracking](/api-guide/tracking/purchases): event requirements.
* [DPC reference](/reference/performance-client/performance-client): market and shared session configuration.
* [Display transformers](/reference/listings-search/display-transformers): product URLs and variant fields.
* [Published OpenAPI contract](https://api.depict.ai/openapi.json): machine-readable request and response schemas.
Ask Depict to confirm recommendation types and product context per market,
transaction IDs, initial SSR session handling, display/stock mapping and
missing slug handling. Confirm rate limits, retry guidance, cache invalidation
and migration dates. Obtain answers before enabling the affected features.
# Legacy v2/v3
Source: https://docs.depict.ai/api-reference/headless/legacy-v2-v3
Reference for the v2 and v3 Platform API endpoints, kept for existing integrations.
> [!WARNING]
>
> **Legacy.** These pages describe the v2 and v3 endpoints. New integrations use the
> [Platform API](/api-v4/introduction). To move an existing integration, see
> [Upgrade from v3/v2](/api-v4/upgrade).
This section keeps the reference for the v2 and v3 endpoints on `api.depict.ai`, for integrations that still call them. The endpoint pages are generated from the API's OpenAPI spec.
These endpoints keep working, with the same paths, requests and responses. Most responses mark the route as deprecated, with `Deprecation: true` and a `Link` to this page. No end date is set.
Search uses the same hybrid search as the Platform API: text matching combined with matching by meaning. See [Search](/api-v4/endpoints#search).
[Upgrade from v3/v2](/api-v4/upgrade) maps every route and field here to the current API and lists the behavior that differs.
# API Overview
Source: https://docs.depict.ai/api-reference/headless/overview
The APIs behind Depict for headless merchants: the Portal API used by the merchant portal, and the Platform API that serves search, listings and recommendations to your shop.
## API overview
Depict exposes two APIs, each with a different audience:
> [card] Portal API
>
> The REST API behind the merchant portal. Manage merchants, products,
> collections and curation, and read the metrics and analytics that power the
> portal dashboards: collection metrics, dead stock, pinned-vs-auto
> performance, merchant-wide analytics and search insights.
> [card] Platform API
>
> The public product-discovery API served from `api.depict.ai`. Fetch search
> results, query suggestions, product listings and recommendations, and send
> tracking events from your storefront.
## Authentication
**Portal API** endpoints require a bearer token issued by Depict's Auth0 tenant.
Requests are authorized per merchant: the authenticated user must have access to
the `merchant_id` in the path.
```bash theme={null}
curl https:///api/v1/merchants/{merchant_id}/collections \
-H "Authorization: Bearer $ACCESS_TOKEN"
```
**Platform API** endpoints identify your shop through the `merchant` and
`market` parameters that are part of each request body or query string. They are
designed to be called directly from the browser.
## Build a storefront integration
Use the Platform API at `https://api.depict.ai` for storefront requests.
Build new integrations with `/v3` serving endpoints. Send `merchant`, `market`
and `locale` as specified by each endpoint. The market and locale discovery
endpoints require only `merchant`.
Start with [Build an integration with an AI agent](/api-reference/headless/build-with-ai-agent)
for a prompt you can adapt to your store.
Use [Build collection pages with an AI agent](/api-reference/headless/build-collections-with-ai-agent)
when you only want to replace category and collection pages.
| Area | Endpoints | Integration guide |
| - | - | - |
| Search | `POST /v3/search/results`, `GET /v3/search/suggestions` | [Search](/api-guide/search) |
| Listing metadata | `GET /v3/listings`, `GET /v3/listings/{listing_id}`, `GET /v3/listings/external_id/{external_id}` | [Listings](/api-guide/listings) |
| Listing products | `POST /v3/listings/{listing_id}/products`, `POST /v3/listings/external_id/{external_id}/products` | [Listing products](/api-guide/listings#products-in-a-listing) |
| Recommendations | `POST /v3/recommend/products` | [Recommendations](/api-guide/recommendations/api) |
| Tracking | `POST /create-events` for card impressions and clicks; DPC for product page, add-to-cart and purchase events | [Tracking](/api-guide/tracking/introduction), [Card impressions](/api-guide/tracking/product-cards#product-card-impressions) |
| Markets and locales | `GET /v3/markets?merchant={merchant}`, `GET /v3/locales?merchant={merchant}` | [Markets, locales and currency](/api-guide/introduction#markets-locales-and-currency) |
Read each integration guide with the generated endpoint reference. The guides
explain filter selection, pagination, cache headers, tracking IDs and errors.
Product display fields and recommendation types depend on your merchant
configuration. The reference does not supply a complete product card schema
for every merchant.
## Conventions
* All endpoints accept and return JSON unless noted otherwise.
* Time ranges on metrics endpoints use Unix timestamps (`start_timestamp`,
`end_timestamp`). When omitted, most metrics endpoints default to the last
30 days compared against the previous 30 days.
* Metric values that compare against a previous period return a `value`
together with a `delta_pct` (relative change) or `delta_pts` (percentage-point
change for rates such as CTR).
# Hourly conversion of sessions that searched
Source: https://docs.depict.ai/api-reference/hourly-conversion-of-sessions-that-searched
/api-reference/openapi/lite.json get /search-reports/conversion
Sessions with a search, and how many of those purchased, per hour. Takes the current and previous windows (from_ts/to_ts, prev_from_ts/prev_to_ts) and answers both, for period-over-period comparison. Read-only.
# Hourly purchase rate of sessions that did not search
Source: https://docs.depict.ai/api-reference/hourly-purchase-rate-of-sessions-that-did-not-search
/api-reference/openapi/lite.json get /search-reports/non-search-baseline
The baseline to compare search conversion against. Takes the current and previous windows (from_ts/to_ts, prev_from_ts/prev_to_ts) and answers both, for period-over-period comparison. Read-only.
# Hourly search funnel: searches, clicks, carts, orders, revenue
Source: https://docs.depict.ai/api-reference/hourly-search-funnel:-searches-clicks-carts-orders-revenue
/api-reference/openapi/lite.json get /search-reports/funnel
The storefront search funnel per hour, plus exact per-window totals counted in searches. Revenue is attributed by the one Depict rule and converted to `currency`. Takes the current and previous windows (from_ts/to_ts, prev_from_ts/prev_to_ts) and answers both, for period-over-period comparison. Read-only.
# How far the merchant's automatic theme onboarding got
Source: https://docs.depict.ai/api-reference/how-far-the-merchants-automatic-theme-onboarding-got
/api-reference/openapi/lite.json get /onboarding/{merchant_id}/status
One word for the whole store, reduced over every theme Depict tried to onboard: `success` beats `warning` beats `failure`; `pending` when nothing has run yet. Returns a bare JSON string. Read-only.
# How far the merchant's first catalog import has come
Source: https://docs.depict.ai/api-reference/how-far-the-merchants-first-catalog-import-has-come
/api-reference/openapi/lite.json get /merchants/{merchant_id}/ingestion-status
Returns whether the first full Shopify catalog import has finished, its percentage, and the last sync time. Poll it after install until `has_run_at_least_one_ingestion` is true; for the index side use catalog-readiness. Read-only.
# How long an A/B test on this collection would need
Source: https://docs.depict.ai/api-reference/how-long-an-ab-test-on-this-collection-would-need
/api-reference/openapi/lite.json get /collections/{collection_id}/ab-test-duration-estimate
From the collection's visitors and click rate over the last 28 days: the days a test with the given split needs before a 10% relative difference in click rate becomes visible, with 80% power at a two-sided 5% level. Read-only.
# Index content pages for search
Source: https://docs.depict.ai/api-reference/index-content-pages-for-search
/api-reference/openapi/lite.json post /search-config/content-pages
Queues the pages for indexing and returns at once; the list shows each as PROCESSING until its scrape and index finish. A URL already listed is re-indexed, and one the merchant removed earlier stops being skipped by auto-index.
# Install or reinstall the app for the calling Shopify store
Source: https://docs.depict.ai/api-reference/install-or-reinstall-the-app-for-the-calling-shopify-store
/api-reference/openapi/lite.json post /merchant-create/
Creates the merchant for the Shopify store in the caller's session token, or marks an existing one reinstalled, then exchanges and stores a fresh offline Admin API token. Call it from the app's install flow only: it saves the store, its default market, default boost/bury rules and its Shopify settings. Needs a Shopify session token. Returns the merchant record.
# Link the group's collections that share a handle
Source: https://docs.depict.ai/api-reference/link-the-groups-collections-that-share-a-handle
/api-reference/openapi/lite.json post /multi-store/create-collection-mappings/{merchant_id}
Creates a cross-store link for every collection handle present in more than one store of `merchant_id`'s group (existing links are kept), then, if the group has auto-replicate on, stamps the new links to replicate from its source. Call it after connecting a store. Requires multi-store in the plan (402 otherwise). Answers null.
# List a collection's version A/B tests
Source: https://docs.depict.ai/api-reference/list-a-collections-version-ab-tests
/api-reference/openapi/lite.json get /collections/{collection_id}/ab-tests
Returns the collection's version A/B tests (every status unless `status` narrows it), read from their Shopify metaobjects. Read-only.
# List a collection's versions
Source: https://docs.depict.ai/api-reference/list-a-collections-versions
/api-reference/openapi/lite.json get /collections/{collection_id}/versions
Returns every saved version of the collection's Depict configuration (newest first): sort, pins, rules, which one is main, market targeting and schedule. Read-only.
# List every collection of the merchant
Source: https://docs.depict.ai/api-reference/list-every-collection-of-the-merchant
/api-reference/openapi/lite.json get /collections
Returns ALL of the merchant's Shopify collections (no paging; large stores have thousands), each with its Depict state: active or not, sort order, pin count, first product images. Read-only. Prefer GET /collections/paginated for search or large stores.
# List product tags hidden from search
Source: https://docs.depict.ai/api-reference/list-product-tags-hidden-from-search
/api-reference/openapi/lite.json get /search-config/excluded-tags
Shopify product tags whose products never appear in storefront search. Read-only.
# List products hidden from search
Source: https://docs.depict.ai/api-reference/list-products-hidden-from-search
/api-reference/openapi/lite.json get /search-config/excluded-products
Products the merchant excluded from storefront search results, with the title and image captured when they were picked. Read-only.
# List the content pages indexed for search
Source: https://docs.depict.ai/api-reference/list-the-content-pages-indexed-for-search
/api-reference/openapi/lite.json get /search-config/content-pages
Store pages, policies, blog posts and custom URLs the merchant asked search to index, each with its indexing status (PROCESSING while being scraped and indexed, then SUCCESS or FAILED), plus the auto-index switches and the paths auto-index skips. Read-only.
# List the Inspiration gallery of published collections
Source: https://docs.depict.ai/api-reference/list-the-inspiration-gallery-of-published-collections
/api-reference/openapi/lite.json get /published-collections/
Returns up to 150 collections that merchants published to the shared Inspiration gallery in the last 30 days, across ALL merchants (the list does not depend on `merchant_id`, which only authorizes the caller). Read-only. Use it to browse examples. The trailing slash in the path is required.
# List the merchant's boost/bury rules
Source: https://docs.depict.ai/api-reference/list-the-merchants-boostbury-rules
/api-reference/openapi/lite.json get /boost-bury
Returns every boost/bury rule the merchant has, ordered by id. These rules are merchant-wide: the collection sorter applies them to every automatically sorted collection (per-collection rules live on the collection version instead). Read-only. Call it before PUT /boost-bury/rules, which replaces the whole set, so you can send back the rules you want to keep.
# List the merchant's recommendation surfaces
Source: https://docs.depict.ai/api-reference/list-the-merchants-recommendation-surfaces
/api-reference/openapi/lite.json get /recommendations/surfaces
Returns every recommendation surface the merchant has configured, as an object keyed by surface name in creation order. Call it to discover which surfaces exist (and their ids) before reading, editing, previewing or pinning one. Read-only; a merchant with recommendations not set up gets `{}`.
# List the product tags a tag rule can match
Source: https://docs.depict.ai/api-reference/list-the-product-tags-a-tag-rule-can-match
/api-reference/openapi/lite.json get /boost-bury/tags
Returns every distinct Shopify product tag in the merchant's ingested catalog, sorted, for building `type: "tag"` rules. Read-only; reflects the last catalog sync, not live Shopify.
# List the stores in a merchant's multi-store group
Source: https://docs.depict.ai/api-reference/list-the-stores-in-a-merchants-multi-store-group
/api-reference/openapi/lite.json get /multi-store/stores/{merchant_id}
Every store (merchant) in the same multi-store group as `merchant_id`, the merchant itself included. Call it to find the group's other stores before reading or changing cross-store collection links. Empty when the merchant is in no group. Read-only.
# Get Listing
Source: https://docs.depict.ai/api-reference/listing-v3/get-listing
/api-reference/openapi/storefront.json get /v3/listings/{listing_id}
# Get Listing Via External Id
Source: https://docs.depict.ai/api-reference/listing-v3/get-listing-via-external-id
/api-reference/openapi/storefront.json get /v3/listings/external_id/{external_id}
# Get Listings
Source: https://docs.depict.ai/api-reference/listing-v3/get-listings
/api-reference/openapi/storefront.json get /v3/listings
# API Overview
Source: https://docs.depict.ai/api-reference/lite/overview
The Search & Merchandising API: the REST API behind the Depict: Search & Merchandising Shopify app.
Depict: Search & Merchandising is Depict's native Shopify product: it
merchandises your existing Shopify collections without any theme changes. The
Search & Merchandising API is the REST API behind the app's admin experience.
## Base URL
The Search & Merchandising API is served under the `/api/lite` prefix of the
Depict portal backend:
```
https:///api/lite
```
## Authentication
The Search & Merchandising API is called by the Depict: Search & Merchandising app itself, which runs embedded
in the Shopify admin. Every request carries the Shopify session token that
App Bridge issues to the app, sent as a bearer token:
```bash theme={null}
curl "https:///api/lite/collections?merchant_id=$MERCHANT_ID" \
-H "Authorization: Bearer $SHOPIFY_SESSION_TOKEN"
```
The shop is taken from the token. Where an endpoint takes a `merchant_id`
parameter, it must be the merchant of that shop; multi-store endpoints take
explicit `merchant_id` parameters for the connected stores. Session tokens are
short-lived and are only issued inside the Shopify admin, so there is no
standalone API key for this API.
## AI assistants and other outside callers
The session token above is the Depict: Search & Merchandising app's own path. Callers outside the
app, such as AI assistants, use Depict's MCP server instead. Each store has
its own endpoint:
```
https://platform.depict.ai/mcp?store_id=
```
It is protected with OAuth 2.1: clients register themselves (dynamic client
registration), sign in with PKCE, and ask for the scopes `depict:read` and
`depict:write`. A person with access to the store approves each connection in
the Shopify admin. The authorization server is described at
`https://platform.depict.ai/.well-known/oauth-authorization-server`, and each
store's endpoint at
`https://platform.depict.ai/.well-known/oauth-protected-resource?store_id=`.
Through the MCP server, an assistant calls the operations of this API that are
open to assistants, as the person who approved it.
Connecting an assistant, the approval screen and revoking are described on
the [AI assistants](/shopify-lite/ai-assistants) page.
## What you can do with it
* **Collections** — list, activate and configure merchandised collections,
including the ordering that Depict pushes back to Shopify.
* **Boost & bury** — manage per-collection and global boost/bury rules.
* **A/B testing** — estimate how long a collection test needs, configure tests
and read their results.
* **Recommendations** — create and edit recommendation surfaces, their pins
and hidden products, and read their performance.
* **Search** — read and change the search configuration, including search's
own boost & bury rules, the content pages indexed for search and which
product metafields are searchable.
* **Analytics** — read the performance numbers shown in the app, and counts
that describe your synced catalogue.
* **Multi-store** — connect several Shopify stores and replicate collection
configuration between them.
* **Onboarding & Shopify integration** — ingestion status, markets, theme
compatibility checks and setup state.
# Get Locales
Source: https://docs.depict.ai/api-reference/markets/get-locales
/api-reference/openapi/storefront.json get /v3/locales
# Get Markets
Source: https://docs.depict.ai/api-reference/markets/get-markets
/api-reference/openapi/storefront.json get /v3/markets
# Merchant-wide collection traffic totals for a window
Source: https://docs.depict.ai/api-reference/merchant-wide-collection-traffic-totals-for-a-window
/api-reference/openapi/lite.json get /collection-totals
Returns merchant-wide collection-page traffic (views, clicks, shoppers, click-through) summed over all collections for [from_date, to_date], and for the same-length window immediately before it so a caller can show a delta. Read-only; answers from Depict analytics, cached privately for 5 minutes. A null row means no collection traffic in that window.
# Get Merchant Endpoint
Source: https://docs.depict.ai/api-reference/merchants/get-merchant-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}
# List Merchants Endpoint
Source: https://docs.depict.ai/api-reference/merchants/list-merchants-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants
# One merchant record
Source: https://docs.depict.ai/api-reference/one-merchant-record
/api-reference/openapi/lite.json get /merchants/{merchant_id}
Returns one merchant's record: shop domain, currency, grid columns, onboarding and multi-store state. Read-only.
# One page of the connected Instagram account's posts
Source: https://docs.depict.ai/api-reference/one-page-of-the-connected-instagram-accounts-posts
/api-reference/openapi/lite.json get /instagram/{merchant_id}/media
Lists the connected account's posts (newest first) with captions, permalinks, counters and album items, for picking posts into content blocks. Media URLs are short-lived signed links. Page with `next_page` = the previous `paging.cursors.after`. Read-only; one Instagram Graph call per request.
# One product's sales and grid performance over a date range
Source: https://docs.depict.ai/api-reference/one-products-sales-and-grid-performance-over-a-date-range
/api-reference/openapi/lite.json get /products/{product_id}/analytics
Revenue, units, conversion, grid views/clicks, add-to-carts and the product score for [from_date, to_date], each with the previous period's value; daily series; the collections the product sits in with its position and clicks; and its revenue rank. Read-only. At most 365 days. Amounts are in the shop currency.
# One recommendation surface's performance totals
Source: https://docs.depict.ai/api-reference/one-recommendation-surfaces-performance-totals
/api-reference/openapi/lite.json get /recommendation-metrics/surfaces/{surface_id}
As the totals route, narrowed to one surface by id, with the surface's current name. An unknown or deleted surface answers 200 with its history (zeros if none) and a null name, never 404. Counts come from storefront events attributed to recommendation carousels; money figures use the shared Depict attribution rule. Read-only; answers from Depict analytics.
# Order counts per product in a collection
Source: https://docs.depict.ai/api-reference/order-counts-per-product-in-a-collection
/api-reference/openapi/lite.json get /collections/{collection_id}/product-orders
Returns `{product id: orders}` for the collection's products over [from_date, to_date], from Depict analytics. Products without orders are absent. Read-only.
# Per-product funnel: clicks, carts, orders, performance score
Source: https://docs.depict.ai/api-reference/per-product-funnel:-clicks-carts-orders-performance-score
/api-reference/openapi/lite.json get /product-funnel-metrics/metrics
A page of products ranked by `order_by` (the performance score by default), each with clicks, add-to-carts, orders, views, revenue and their previous-period values, the product itself, the collections it sits in and a Need attention verdict. The performance score is units ordered, shown 0–10 against the best product in the result; under the default order_by only products clicked in a collection grid in the window are scored. Need attention flags products that sell but sit low in a merchandised grid (bring up) and products near the top that barely sell (take action). Storewide, or one collection's products with `collection_id`. Page with offset/page_size while has_more. Full rows are large; `view=summary` drops the product and collection details for ranking a whole catalogue (title, the numbers, the verdict and the grids it names), and is what the assistant connector uses by default. For full details on a few products use `view=full` with a small page_size, or productSearch with `query` = the product id. Read-only.
# Per-query table: what shoppers searched and how it went
Source: https://docs.depict.ai/api-reference/per-query-table:-what-shoppers-searched-and-how-it-went
/api-reference/openapi/lite.json get /search-reports/query-performance
One row per search query in the current window, sorted by `order_by` and paged with offset/page_size: searches, no-results, clicks, no-click rate, median click position. Use it to find queries that return nothing or get no clicks. Read-only.
# Preview a collection's products under a sort
Source: https://docs.depict.ai/api-reference/preview-a-collections-products-under-a-sort
/api-reference/openapi/lite.json post /collections/{collection_id}/products
Returns the collection's products ordered as `sort_order` (and the given version's pins and rules) would order them on the storefront. The body previews unsaved rules, pins, groupings or a metafield sort; send `{}` (or null fields) to use the saved ones. Read-only despite POST.
# Preview a saved surface
Source: https://docs.depict.ai/api-reference/preview-a-saved-surface
/api-reference/openapi/lite.json get /recommendations/surfaces/{surface_name}/preview
Composes a saved surface right now from the current candidate pools, exactly as the storefront would for the given anchor and market, and returns the product ids per slot (pins included). A `product` or `category` surface needs `anchor_id`; an `any` surface must omit it. Read-only: nothing is written or recomputed.
# Preview an unsaved draft of a surface
Source: https://docs.depict.ai/api-reference/preview-an-unsaved-draft-of-a-surface
/api-reference/openapi/lite.json post /recommendations/surfaces/{surface_name}/preview
As the GET preview, but composes the unsaved `surface` in the body (the upsert's shape) in place of the saved one, keyed to the saved surface's id and directives. Use it to show the effect of edits before saving. Read-only: nothing is written.
# Update Collection Product Images Endpoint
Source: https://docs.depict.ai/api-reference/product-images/update-collection-product-images-endpoint
/api-reference/openapi/portal.json put /api/v1/merchants/{merchant_id}/collections/{collection_id}/products/{main_product_id}/images
# Update Product Media Urls Endpoint
Source: https://docs.depict.ai/api-reference/product-images/update-product-media-urls-endpoint
/api-reference/openapi/portal.json put /api/v1/merchants/{merchant_id}/products/{main_product_id}/images
# Get Products In Listing
Source: https://docs.depict.ai/api-reference/product-listing/get-products-in-listing
/api-reference/openapi/storefront.json post /v3/listings/{listing_id}/products
# Get Products In Listing, Via External Id
Source: https://docs.depict.ai/api-reference/product-listing/get-products-in-listing-via-external-id
/api-reference/openapi/storefront.json post /v3/listings/external_id/{external_id}/products
# Product Listing Endpoint V2
Source: https://docs.depict.ai/api-reference/product-listing/product-listing-endpoint-v2
/api-reference/openapi/storefront.json post /v2/product-listing
# Get Product Basic Metrics Endpoint
Source: https://docs.depict.ai/api-reference/product-metrics/get-product-basic-metrics-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/products/{main_product_id}/metrics/basic
# Get Product Overview Chart Endpoint
Source: https://docs.depict.ai/api-reference/product-metrics/get-product-overview-chart-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/products/{main_product_id}/metrics/overview/chart
# Get Product Toplist Endpoint
Source: https://docs.depict.ai/api-reference/product-metrics/get-product-toplist-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/products/{main_product_id}/metrics/toplist
# Get Product Weekly Stats Endpoint
Source: https://docs.depict.ai/api-reference/product-metrics/get-product-weekly-stats-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/products/{main_product_id}/metrics/weekly
# Get Dead Stock Products Endpoint
Source: https://docs.depict.ai/api-reference/products/get-dead-stock-products-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/products/dead-stock
Merchant-wide dead stock: products with stock on hand but zero sales in
the metrics period. Scope matches the merchant overview's ``dead_stock``
tile (Tinybird-scoped); per-collection ``CollectionMetricsSummary.dead_stock``
additionally counts stocked products Tinybird hasn't seen. When the
inventory scope resolves to unknown (blanked), the overview tile renders
None while this filter finds nothing — 0 here means "none identifiable",
not a measurement.
Backed by the cached whole-catalog ``fetch_collection_metrics``, so on a
warm cache this is an in-memory filter. Items are sorted by inventory
(worst offenders first) and capped at ``DEAD_STOCK_MAX_ITEMS``; ``total``
is the uncapped count. Products no longer in the catalog are dropped.
# Get Product Endpoint
Source: https://docs.depict.ai/api-reference/products/get-product-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/products/{main_product_id}
# Get Product Visibility Endpoint
Source: https://docs.depict.ai/api-reference/products/get-product-visibility-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/products/visibility
# Get Products Metrics Endpoint
Source: https://docs.depict.ai/api-reference/products/get-products-metrics-endpoint
/api-reference/openapi/portal.json post /api/v1/merchants/{merchant_id}/products/metrics
Per-product metrics for an explicit set of products.
Lets the collection grid paint immediately (products are fetched without
metrics) and then overlay the numbers. The expensive whole-catalog fetch is
shared via the cached, single-flighted ``fetch_collection_metrics``, so on a
warm cache this endpoint is just an in-memory slice keyed by the requested
ids. Missing ids resolve to zeroed metrics, mirroring the inline
``include_metrics`` path.
# List Product Filters Endpoint
Source: https://docs.depict.ai/api-reference/products/list-product-filters-endpoint
/api-reference/openapi/portal.json post /api/v1/merchants/{merchant_id}/products/filters
# List Products Post Endpoint
Source: https://docs.depict.ai/api-reference/products/list-products-post-endpoint
/api-reference/openapi/portal.json post /api/v1/merchants/{merchant_id}/products
# Patch Product Visibility Endpoint
Source: https://docs.depict.ai/api-reference/products/patch-product-visibility-endpoint
/api-reference/openapi/portal.json patch /api/v1/merchants/{merchant_id}/products/visibility
# Publish a collection to the Inspiration gallery
Source: https://docs.depict.ai/api-reference/publish-a-collection-to-the-inspiration-gallery
/api-reference/openapi/lite.json post /published-collections/{collection_id}
Renders a PNG preview of the merchant's live collection page (with the given theme template) and adds or refreshes its entry in the shared Inspiration gallery, where every merchant can see it; re-publishing resets the entry's likes to 0. Then queues a Shopify order sync-back for the collection. If the storefront is password-protected nothing is rendered or written and the call still answers 200 null. Slow: the render can take several seconds. Returns null.
# Publish a collection version to the storefront
Source: https://docs.depict.ai/api-reference/publish-a-collection-version-to-the-storefront
/api-reference/openapi/lite.json put /collections/{collection_id}/publish_version/{version}
Makes `body.version` live: as the collection's main version, or for its market / market group (retiring that market's previously live version). Writes the version's content blocks, product duplicates and image settings to Shopify metafields/metaobjects, then triggers the order sync-back. The path's {version} must equal `body.version`. An unknown version is a 404 and writes nothing. Requires collection versions in the plan (402 otherwise). Returns null.
# Read a collection version's content cards
Source: https://docs.depict.ai/api-reference/read-a-collection-versions-content-cards
/api-reference/openapi/lite.json get /brand-features/{collection_id}
Returns the content cards (image, video and text tiles placed in the collection's product grid) of one collection version, in stored order, read from Shopify. Each card is in the shape `PATCH /brand-features/{collection_id}` accepts, plus read-only fields PATCH ignores (`metaobject_id`, `clicks_id`, `image_url`, `hover_image_url`, `link.name`). Read the cards before changing them: PATCH replaces a card's settings with the card it is sent. Version ids come from `GET /collections/{collection_id}/versions`. Read-only.
# Read a collection's products in Shopify's own order
Source: https://docs.depict.ai/api-reference/read-a-collections-products-in-shopifys-own-order
/api-reference/openapi/lite.json post /collections/{collection_id}/shopify/shopify-ordering
Returns the collection's products in the order Shopify itself holds (the manual order before Depict sorts). Read-only despite POST.
# Read a collection's products in their current order
Source: https://docs.depict.ai/api-reference/read-a-collections-products-in-their-current-order
/api-reference/openapi/lite.json get /collections/{collection_id}/initial-products
Returns the collection's products in the order the storefront shows now (the main version's sort, pins and rules). Read-only.
# Read a surface's pin sets
Source: https://docs.depict.ai/api-reference/read-a-surfaces-pin-sets
/api-reference/openapi/lite.json get /recommendations/surfaces/{surface_name}/pins
Returns every pin set of a surface: one entry per (anchor_type, anchor_id, market_id), each listing the pinned products by slot position. Call it before saving pins, since a save replaces a whole set. Read-only.
# Read one collection version A/B test with its results
Source: https://docs.depict.ai/api-reference/read-one-collection-version-ab-test-with-its-results
/api-reference/openapi/lite.json get /collections/{collection_id}/ab-tests/{test_id}
Returns the test plus its results so far: per-variant and per-market KPIs, B-over-A lift, significance and a daily series. Results are null before the start date or when analytics are unavailable. Read-only.
# Read one collection's Depict configuration
Source: https://docs.depict.ai/api-reference/read-one-collections-depict-configuration
/api-reference/openapi/lite.json get /collections/{collection_id}
Returns the collection's configuration for a version: sort order, pinned products (for MANUAL sort, the full manual order), boost/bury rules, badges, metafield sort and product attachments. Without `version` it is the published (main) version. Read-only. 404 when the collection or the version has no Depict configuration (never opened, deleted, or not ingested).
# Read one recommendation surface
Source: https://docs.depict.ai/api-reference/read-one-recommendation-surface
/api-reference/openapi/lite.json get /recommendations/surfaces/{surface_name}
Returns one saved surface by name: its id, context, steps, filters, limit, exclusions and the read-only serving directives. Call it to inspect a surface before changing it with the PUT on the same path. Read-only.
# Read search's own boost/bury rules
Source: https://docs.depict.ai/api-reference/read-searchs-own-boostbury-rules
/api-reference/openapi/lite.json get /search-config/boost-bury
Returns the rule set that ranks storefront search results, when search has one of its own. `boost_bury_rules: null` means it has none and search ranks with the merchant-wide rules (GET /boost-bury), so an edit there reaches search too. Read-only.
# Read the merchant's award notification state
Source: https://docs.depict.ai/api-reference/read-the-merchants-award-notification-state
/api-reference/openapi/lite.json get /collections/award-status
Returns which collection-milestone awards the merchant has achieved (with when) and which notifications were dismissed. Read-only; an empty state when none is saved.
# Read the merchant's search relevance settings
Source: https://docs.depict.ai/api-reference/read-the-merchants-search-relevance-settings
/api-reference/openapi/lite.json get /search-config/configuration
Returns how storefront search ranks and filters for the merchant: keyword/meaning blend, searchable fields with weights, filter facets, sold-out handling and synonym groups. Unset values come back resolved to the serving defaults. Read-only. A 404 means the merchant has no Search section yet; the portal uses this read to decide whether to show it.
# Read the multi-store group's settings
Source: https://docs.depict.ai/api-reference/read-the-multi-store-groups-settings
/api-reference/openapi/lite.json get /multi-store/group-settings/{merchant_id}
The replication and publish-sync toggles of `merchant_id`'s group. A group that never changed a toggle answers the defaults (auto-replicate off, publish-sync on, recommendations off), and those are the values in effect, not a guess: fan-out and replication read the same defaults. A merchant in no group gets 400 NOT_IN_GROUP rather than defaults. Read-only.
# Read the product metafield definitions and selection
Source: https://docs.depict.ai/api-reference/read-the-product-metafield-definitions-and-selection
/api-reference/openapi/lite.json get /search-config/searchable-metafields
# Read the search empty-state configuration
Source: https://docs.depict.ai/api-reference/read-the-search-empty-state-configuration
/api-reference/openapi/lite.json get /search-config/states
What the search overlay shows before the shopper types: product sort, pinned products, suggestion chips per locale, blocked suggestion terms, generator instructions and UI string overrides. Read-only; change it with the search-config PATCH. The product preview itself is not here (the storefront search API's `/empty-state-products` serves it).
# Recommendation performance per day
Source: https://docs.depict.ai/api-reference/recommendation-performance-per-day
/api-reference/openapi/lite.json get /recommendation-metrics/timeseries
Returns the same figures as the totals route, one point per day of [from_date, to_date], optionally narrowed to one surface. Call it for trends and sparklines. Counts come from storefront events attributed to recommendation carousels; money figures use the shared Depict attribution rule. Read-only; answers from Depict analytics.
# Recommendation performance totals for a window
Source: https://docs.depict.ai/api-reference/recommendation-performance-totals-for-a-window
/api-reference/openapi/lite.json get /recommendation-metrics/totals
Returns the merchant's recommendation performance over [from_date, to_date]: impressions, clicks, CTR, attributed add-to-carts, orders and revenue, and the derived rates, plus when the merchant's recommendation data starts. Call it for headline numbers or to compare two windows (call twice). Counts come from storefront events attributed to recommendation carousels; money figures use the shared Depict attribution rule. Read-only; answers from Depict analytics.
# Get Displays Endpoint V3
Source: https://docs.depict.ai/api-reference/recommendations/get-displays-endpoint-v3
/api-reference/openapi/storefront.json post /v3/get-displays
# Recommend For Category And User
Source: https://docs.depict.ai/api-reference/recommendations/recommend-for-category-and-user
/api-reference/openapi/storefront.json post /v2/recommend/products/category
# Recommend For Product And User
Source: https://docs.depict.ai/api-reference/recommendations/recommend-for-product-and-user
/api-reference/openapi/storefront.json post /v2/recommend/products/product
# Recommend For Products And User
Source: https://docs.depict.ai/api-reference/recommendations/recommend-for-products-and-user
/api-reference/openapi/storefront.json post /v2/recommend/products/products
# Recommend For User
Source: https://docs.depict.ai/api-reference/recommendations/recommend-for-user
/api-reference/openapi/storefront.json post /v2/recommend/products/general
# Recommendations
Source: https://docs.depict.ai/api-reference/recommendations/recommendations
/api-reference/openapi/storefront.json post /v3/recommend/products
# Remove a store from its multi-store group
Source: https://docs.depict.ai/api-reference/remove-a-store-from-its-multi-store-group
/api-reference/openapi/lite.json post /multi-store/disconnect/{merchant_id}
Clears `merchant_id`'s multi-store group. Refused while the store still has collection mappings in the group or other stores replicate from it; unlink those first (POST unlink-collections). Side effect: writes the merchant's group. A no-op for a merchant in no group.
# Rename a market group or replace its markets
Source: https://docs.depict.ai/api-reference/rename-a-market-group-or-replace-its-markets
/api-reference/openapi/lite.json put /{merchant_id}/market-groups/{group_id}
Renames the group when `name` is non-empty, and when `market_ids` is given replaces its markets with exactly those (removed markets go back to `global`; `[]` empties it). The `global` group cannot be modified. Returns the group.
# Replace or clear search's own boost/bury rules
Source: https://docs.depict.ai/api-reference/replace-or-clear-searchs-own-boostbury-rules
/api-reference/openapi/lite.json patch /search-config/boost-bury
Whole-replaces the rule set search ranks with (send the full list). A list, including `[]`, takes search off the merchant-wide rules: collections keep them, search uses only this list. `null` clears it, and search follows the merchant-wide rules again. Storefront search picks the change up within about two minutes (its config cache); collections are never affected. Strengths written here hold until the merchant next saves in the portal, whose editor derives every strength from list position (n..1, -1..-n) and keeps the order.
# Replace the merchant's boost/bury rules
Source: https://docs.depict.ai/api-reference/replace-the-merchants-boostbury-rules
/api-reference/openapi/lite.json put /boost-bury/rules
Replaces ALL of the merchant's boost/bury rules with `rules` in one atomic write; any rule not sent is deleted, and an empty list clears them. To add or edit one rule, GET /boost-bury first and send the full list back. Side effects: the new rules take effect the next time collections are sorted (no immediate re-sort is triggered), and an `updated_boost_bury` analytics event is recorded. Returns null.
# Replace the product tags hidden from search
Source: https://docs.depict.ai/api-reference/replace-the-product-tags-hidden-from-search
/api-reference/openapi/lite.json patch /search-config/excluded-tags
Whole-replaces the excluded-tags list (`[]` clears it); tags are trimmed and deduplicated. Live search stops returning products carrying any of them.
# Replace the products hidden from search
Source: https://docs.depict.ai/api-reference/replace-the-products-hidden-from-search
/api-reference/openapi/lite.json patch /search-config/excluded-products
Whole-replaces the excluded-products list (send the full list; `[]` clears it). Duplicate ids are dropped, first wins. Live search stops returning these products.
# Replace the selected searchable metafields
Source: https://docs.depict.ai/api-reference/replace-the-selected-searchable-metafields
/api-reference/openapi/lite.json post /search-config/searchable-metafields
# Revenue and orders Depict drove, per feature
Source: https://docs.depict.ai/api-reference/revenue-and-orders-depict-drove-per-feature
/api-reference/openapi/lite.json get /depict-attribution
Under the one attribution rule (a purchased line belongs to the feature the shopper last clicked that product on within window_hours before buying): lines, orders, revenue and touches for collections, recommendations and search, plus unattributed, Depict total and the whole store, for the window and the one before, with a daily revenue series. Read-only.
# Revenue and sell-through per product in a collection
Source: https://docs.depict.ai/api-reference/revenue-and-sell-through-per-product-in-a-collection
/api-reference/openapi/lite.json get /collections/{collection_id}/product-metrics
Returns, for every product in the collection (0 revenue when it sold nothing), revenue over [from_date, to_date] converted to the merchant's base currency (ECB rates at to_date; an unconvertible currency adds 0), and the sell-through rate. Read-only; answers from Depict analytics.
# Run an allow-listed Shopify Admin GraphQL operation for the merchant
Source: https://docs.depict.ai/api-reference/run-an-allow-listed-shopify-admin-graphql-operation-for-the-merchant
/api-reference/openapi/lite.json post /shopify/proxy/{merchant_id}/admin-api/graphql.json
Forwards a GraphQL request to the merchant's Shopify Admin API with the app's stored access token. Only the portal's own allow-listed operations pass (the name and document must both match); everything else is refused. Allow-listed mutations write to the live store. Returns Shopify's GraphQL body verbatim, including GraphQL-level `errors`.
# Save a collection's Depict configuration
Source: https://docs.depict.ai/api-reference/save-a-collections-depict-configuration
/api-reference/openapi/lite.json put /collections/{collection_id}
The collection editor's save: writes the body as a version (a new one when `version` is null) and, with `main`, makes it the published version. Side effects: a Shopify order sync-back, replication of a main save to linked multi-store collections, and tracked events. 402 when the installation is frozen. Returns the saved version's UUID.
# Save one pin set of a surface
Source: https://docs.depict.ai/api-reference/save-one-pin-set-of-a-surface
/api-reference/openapi/lite.json put /recommendations/surfaces/{surface_name}/pins
Saves one pin set of a surface: the body is the complete set for one (anchor_type, anchor_id, market_id), and the stored pins for that set are reconciled to it (added, moved, removed); an empty `pins` clears the set. Other sets are untouched. Side effect: queues a background recompute of the surface. Returns the saved set.
# Save the merchant's award notification state
Source: https://docs.depict.ai/api-reference/save-the-merchants-award-notification-state
/api-reference/openapi/lite.json put /collections/award-status
Replaces the award state with the body (send the full state from GET /collections/award-status, modified). Side effect: appends a new config row authored by the caller. Returns null.
# Save the thresholds behind the computed product badges
Source: https://docs.depict.ai/api-reference/save-the-thresholds-behind-the-computed-product-badges
/api-reference/openapi/lite.json put /settings/dynamic-status
Replaces the merchant's badge thresholds (all six counts are required; `new_in_date_source` defaults to published_at). Side effects: a new settings version is stored with the caller as author, and every collection that syncs back to Shopify is re-ordered there with the new badges (best effort: a failed re-order is logged, the save still succeeds). Answers null.
# Schedule a collection version to publish later
Source: https://docs.depict.ai/api-reference/schedule-a-collection-version-to-publish-later
/api-reference/openapi/lite.json put /collections/{collection_id}/schedule_version/{version}
Sets when the version is published automatically (by a cron, within minutes of the time); replaces any earlier schedule. Records the caller as the scheduler. Nothing is published now. Scheduling the main version is the normal way to time a publish of the live configuration; it is valid even when that version is already the one the storefront shows. Requires scheduled publishing in the plan (402 otherwise); schedules already set still publish.
# Search and page the merchant's collections
Source: https://docs.depict.ai/api-reference/search-and-page-the-merchants-collections
/api-reference/openapi/lite.json get /collections/paginated
Returns one page of the merchant's collections ordered by title, optionally filtered by a title search. Read-only. To page, pass the response's `offset` back while `has_next` is true.
# Get Search Query Stats Endpoint
Source: https://docs.depict.ai/api-reference/search-metrics/get-search-query-stats-endpoint
/api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/search/metrics/queries
# Search or page through a merchant's products
Source: https://docs.depict.ai/api-reference/search-or-page-through-a-merchants-products
/api-reference/openapi/lite.json get /products
Finds products whose title, any variant SKU, product id or any tag contains `query` (case-insensitive); an exact product-id match sorts first. A blank `query` pages the whole catalogue, or one collection with `collection_id` (in the collection's order unless `sort` is given), and also returns the scope's `total`. Read-only. Use it to look up products by name/SKU/id before calling the per-product routes.
# Search totals for the window
Source: https://docs.depict.ai/api-reference/search-totals-for-the-window
/api-reference/openapi/lite.json get /search-reports/summary
One row per window: searches, users, clicks and the rates. Takes the current and previous windows (from_ts/to_ts, prev_from_ts/prev_to_ts) and answers both, for period-over-period comparison. Read-only.
# Get Related Recommendations
Source: https://docs.depict.ai/api-reference/search/get-related-recommendations
/api-reference/openapi/storefront.json post /v2/search/related
# Get Related Recommendations
Source: https://docs.depict.ai/api-reference/search/get-related-recommendations-1
/api-reference/openapi/storefront.json post /v3/search/related
# Get Results
Source: https://docs.depict.ai/api-reference/search/get-results
/api-reference/openapi/storefront.json post /v2/search/results
# Get Results
Source: https://docs.depict.ai/api-reference/search/get-results-1
/api-reference/openapi/storefront.json post /v3/search/results
# Get Suggestions
Source: https://docs.depict.ai/api-reference/search/get-suggestions
/api-reference/openapi/storefront.json get /v2/search/suggestions
# Get Suggestions
Source: https://docs.depict.ai/api-reference/search/get-suggestions-1
/api-reference/openapi/storefront.json get /v3/search/suggestions
# Search Through Text Content
Source: https://docs.depict.ai/api-reference/search/search-through-text-content
/api-reference/openapi/storefront.json get /v2/search/content
# Searches by where the shopper started them
Source: https://docs.depict.ai/api-reference/searches-by-where-the-shopper-started-them
/api-reference/openapi/lite.json get /search-reports/entry-points
Searches, sessions and clicks per entry point (e.g. header search, search page). Takes the current and previous windows (from_ts/to_ts, prev_from_ts/prev_to_ts) and answers both, for period-over-period comparison. Read-only.
# Set how many products per row Depict's collection grid shows
Source: https://docs.depict.ai/api-reference/set-how-many-products-per-row-depicts-collection-grid-shows
/api-reference/openapi/lite.json put /shopify-collection-template/{merchant_id}/columns-settings
Writes `[desktop_columns, mobile_columns]` to the shop metafield `$app:column-settings.column_settings` (creating its definition on first use), which Depict's theme templates read on the storefront. Side effects: a Shopify write that is live on the storefront at once, and a `colums_settings_updated` analytics event. Returns JSON `null`.
# Set the option name the collection grid groups variants by
Source: https://docs.depict.ai/api-reference/set-the-option-name-the-collection-grid-groups-variants-by
/api-reference/openapi/lite.json put /merchants/{merchant_id}/variant_group_by_name
Sets which product option (e.g. Color) groups variants into one card in the collection grid; omit the parameter to clear it. Returns null.
# Set which store each collection copy replicates from
Source: https://docs.depict.ai/api-reference/set-which-store-each-collection-copy-replicates-from
/api-reference/openapi/lite.json post /multi-store/collection-replication
Sets `replication_merchant_id` on the given collection copies (null stops replicating); copies left out are unchanged. A merchant may only name stores of its own group; through an AI assistant, only the connected store itself or null. Side effect: writes mapping rows; the next publish of a source collection copies its setup to its replicas. Naming a source a copy does not already have requires multi-store in the caller's plan (402 otherwise); an entry that keeps its current source, and null, never do. Answers null; an empty list is a no-op.
# Get Auto Hide Settings Endpoint
Source: https://docs.depict.ai/api-reference/settings/get-auto-hide-settings-endpoint
/api-reference/openapi/portal.json get /api/v1/settings/{merchant_id}/auto-hide
# Update Auto Hide Exclude Products Endpoint
Source: https://docs.depict.ai/api-reference/settings/update-auto-hide-exclude-products-endpoint
/api-reference/openapi/portal.json put /api/v1/settings/{merchant_id}/auto-hide/exclude-products
# Update Auto Hide Settings Endpoint
Source: https://docs.depict.ai/api-reference/settings/update-auto-hide-settings-endpoint
/api-reference/openapi/portal.json put /api/v1/settings/{merchant_id}/auto-hide
# Start a collection version A/B test
Source: https://docs.depict.ai/api-reference/start-a-collection-version-ab-test
/api-reference/openapi/lite.json post /collections/{collection_id}/ab-tests
Splits the collection's storefront traffic between two saved versions for 7–30 days, in every market or in the given market groups. Creates the test and per-variant orderings as Shopify metaobjects; a failure rolls them back. Needs the launch flag (403) and a Custom Merchandising plan (402); a scope that overlaps a running test on the collection is a 409. Returns the created test (201).
# Start a legacy basic subscription
Source: https://docs.depict.ai/api-reference/start-a-legacy-basic-subscription
/api-reference/openapi/lite.json post /settings/subscription/basic
Creates a pending Shopify app subscription on the legacy basic plan and returns the confirmation URL the merchant must open to approve it; nothing is billed until they do. Side effect: a pending AppSubscription in Shopify. New subscriptions should use POST /settings/subscription (products + size).
# Start a legacy essentials subscription
Source: https://docs.depict.ai/api-reference/start-a-legacy-essentials-subscription
/api-reference/openapi/lite.json post /settings/subscription/essentials
Creates a pending Shopify app subscription on the legacy essentials plan and returns the confirmation URL the merchant must open to approve it; nothing is billed until they do. Side effect: a pending AppSubscription in Shopify. New subscriptions should use POST /settings/subscription (products + size).
# Start a legacy pro subscription
Source: https://docs.depict.ai/api-reference/start-a-legacy-pro-subscription
/api-reference/openapi/lite.json post /settings/subscription/pro
Creates a pending Shopify app subscription on the legacy pro plan and returns the confirmation URL the merchant must open to approve it; nothing is billed until they do. Side effect: a pending AppSubscription in Shopify. New subscriptions should use POST /settings/subscription (products + size).
# Start preparing the search header on the merchant's theme
Source: https://docs.depict.ai/api-reference/start-preparing-the-search-header-on-the-merchants-theme
/api-reference/openapi/lite.json post /search-onboarding/enable
Queues the background job that prepares Depict's search header for the merchant's live theme (nothing is published; the result is stashed). Call once; then poll searchOnboardingStatus until `stashed`, and continue with searchOnboardingGoLive. Needs a plan that includes Search.
# Stop indexing content pages
Source: https://docs.depict.ai/api-reference/stop-indexing-content-pages
/api-reference/openapi/lite.json delete /search-config/content-pages
Removes the pages from search, then from the list. A removed store page is skipped by auto-index until it is indexed again by hand.
# Store-wide clicks, add-to-carts and orders for a window
Source: https://docs.depict.ai/api-reference/store-wide-clicks-add-to-carts-and-orders-for-a-window
/api-reference/openapi/lite.json get /funnel-totals
The Analytics funnel's totals for from_date..to_date and the period before it, with attributed revenue and distinct store orders. Read-only.
# Storefront sessions per day
Source: https://docs.depict.ai/api-reference/storefront-sessions-per-day
/api-reference/openapi/lite.json get /dashboard/traffic-daily
Daily storefront sessions over from_date..to_date for the dashboard's traffic trend. Read-only.
# Subscribe to, upgrade or downgrade to a plan (products + size)
Source: https://docs.depict.ai/api-reference/subscribe-to-upgrade-or-downgrade-to-a-plan-products-+-size
/api-reference/openapi/lite.json post /settings/subscription
Resolves the selection to a catalogue plan and creates a pending Shopify app subscription replacing the current one; returns the confirmation URL the merchant must open to approve it. Nothing is billed or changed until they approve, except that a downgrade to a plan without Merchandising deactivates the collections not in `keep_collection_ids`. Upgrades and lateral moves apply immediately (prorated), downgrades at the next billing cycle. See GET /settings/subscription/plans for what can be bought.
# Switch a collection to another theme template
Source: https://docs.depict.ai/api-reference/switch-a-collection-to-another-theme-template
/api-reference/openapi/lite.json post /shopify-collection-template/{collection_id}/activate
Sets the collection's `templateSuffix` on Shopify, which changes the live storefront page at once. Activating a Depict template (suffix starting `depict`) also marks the theme approved. Side effects: the Shopify write, a theme re-onboarding request, and a `template_activated` analytics event. Returns the template now in use.
# Switch auto-index for one store content type
Source: https://docs.depict.ai/api-reference/switch-auto-index-for-one-store-content-type
/api-reference/openapi/lite.json patch /search-config/content-pages
On: the type's published items are indexed now and every night new ones are added and deleted ones removed. Off: nothing new is added; pages already indexed stay.
# The AI assistants connected to a store
Source: https://docs.depict.ai/api-reference/the-ai-assistants-connected-to-a-store
/api-reference/openapi/lite.json get /mcp/grants
Lists the store's OAuth grants to MCP clients (AI assistants such as Claude Code), newest first: one per connected assistant, with its name, scopes and approval time. Never carries tokens. Read-only; the Settings page shows it under Connections, and a `grant_id` from it disconnects that assistant through DELETE /mcp/grants/{grant_id}.
# The badges a product currently earns
Source: https://docs.depict.ai/api-reference/the-badges-a-product-currently-earns
/api-reference/openapi/lite.json get /products/{product_id}/badges
Computed merchandising badges for one product (on sale, stock state, bestseller, trending, new in, tag/collection badges, ...), store-wide scope. Read-only. Returns [] when the product earns none, and also when the badge service cannot answer (badges are decoration, so a failure is logged, not surfaced).
# The collection templates a collection can switch between
Source: https://docs.depict.ai/api-reference/the-collection-templates-a-collection-can-switch-between
/api-reference/openapi/lite.json get /shopify-collection-template/{merchant_id}/{collection_id}/templates
Lists the collection templates in the store's published theme, marks the one this collection uses, and flags which render Depict's grid. When the Depict variant of the active template does not exist yet, a `written: false` placeholder is appended and `theme_onboarding_status` says whether Depict is still writing it (the portal polls while it is `pending`). Read-only; several Shopify calls per request.
# The collections dashboard: a sorted, filtered page with traffic
Source: https://docs.depict.ai/api-reference/the-collections-dashboard:-a-sorted-filtered-page-with-traffic
/api-reference/openapi/lite.json post /collections/data-sorted-by
Returns one page of the merchant's collections with their traffic over [from_date, to_date] (views, clicks, CTR), ordered by traffic (`top_views`, `top_ctr`, `top_clicks`) or metadata (`updated_at`, `name_a_z`, `number_of_products`), optionally filtered by status and title. Read-only; POST because the filters and date window travel as a JSON body. To page, pass the response's `offset` back while `has_next` is true.
# The countries mapped to one market
Source: https://docs.depict.ai/api-reference/the-countries-mapped-to-one-market
/api-reference/openapi/lite.json get /merchants/{merchant_id}/markets/{market_id}/mappings
Returns the ISO country codes mapped to one market, sorted. Read-only.
# The Instagram account connected to the merchant, if any
Source: https://docs.depict.ai/api-reference/the-instagram-account-connected-to-the-merchant-if-any
/api-reference/openapi/lite.json get /instagram/{merchant_id}/account
Reads the stored Instagram login and asks Instagram for the account's id, name and profile picture. Returns JSON `null` when no account is connected. Read-only; one Instagram Graph call per request.
# The merchant's market groups
Source: https://docs.depict.ai/api-reference/the-merchants-market-groups
/api-reference/openapi/lite.json get /{merchant_id}/market-groups
Lists the market groups (global first) with their markets and whether each group is enabled. Call it to pick the market group a collection version targets. For a Shopify caller with no groups yet, it first creates the default `global` group.
# The merchant's plan, usage and entitlements
Source: https://docs.depict.ai/api-reference/the-merchants-plan-usage-and-entitlements
/api-reference/openapi/lite.json get /settings/subscription/status
Everything the portal gates on: active collections vs the cap, this month's sessions (and a projection) vs the quota, trial state, whether the store is frozen or erroring, the active Shopify subscription, and the plan-derived entitlements. Read-only; computed fresh on every call.
# The merchant's public Storefront API token and store domain
Source: https://docs.depict.ai/api-reference/the-merchants-public-storefront-api-token-and-store-domain
/api-reference/openapi/lite.json get /shopify/storefront_api_credentials
What a client needs to call the store's Storefront GraphQL API directly (e.g. to read published products and shop metafields as shoppers see them). Read-only; one config read, no Shopify call.
# The merchant's published Shopify theme and Depict's footprint in it
Source: https://docs.depict.ai/api-reference/the-merchants-published-shopify-theme-and-depicts-footprint-in-it
/api-reference/openapi/lite.json get /onboarding/{merchant_id}/themes/main
Reads the store's themes from the Shopify Admin API, picks the published (`main`) one and reports whether Depict's inline script and a Depict collection template are installed in it. Call it to decide whether the theme setup steps are done. Read-only; two Shopify calls per request.
# The merchant's Shopify markets and their countries
Source: https://docs.depict.ai/api-reference/the-merchants-shopify-markets-and-their-countries
/api-reference/openapi/lite.json get /merchants/{merchant_id}/markets
Returns every Shopify market of a multi-market store with its countries and whether Depict serves it. A single-market store returns []. Read-only.
# The merchant's Shopify markets with their countries and currency
Source: https://docs.depict.ai/api-reference/the-merchants-shopify-markets-with-their-countries-and-currency
/api-reference/openapi/lite.json get /{merchant_id}/available-regions
Lists every Shopify market of the merchant, grouped or not, with its mapped countries and currency, ordered by country. Call it to offer markets when building a market group. Read-only.
# The merchants the caller may act for
Source: https://docs.depict.ai/api-reference/the-merchants-the-caller-may-act-for
/api-reference/openapi/lite.json get /merchants/
Returns the merchant record of the caller's own store, in a list. Call it first to discover merchant ids and each store's settings. Read-only.
# The multi-store group's cross-store collection links
Source: https://docs.depict.ai/api-reference/the-multi-store-groups-cross-store-collection-links
/api-reference/openapi/lite.json get /multi-store/collection-mappings/{group_id}
Every collection linked across two or more stores of the group, plus every live collection of every store (to label them). The caller must belong to the group. Read-only.
# The plans the merchant can buy
Source: https://docs.depict.ai/api-reference/the-plans-the-merchant-can-buy
/api-reference/openapi/lite.json get /settings/subscription/plans
Every sellable catalogue plan (products + size) with its monthly and annual price, trial days and session quota, in catalogue order. Read-only. Subscribe to one with POST /settings/subscription using the same products and size.
# The recommender catalog a surface step can use
Source: https://docs.depict.ai/api-reference/the-recommender-catalog-a-surface-step-can-use
/api-reference/openapi/lite.json get /recommendations/recommenders
Returns the recommender catalog: every step `kind` a surface may use, its display name, and whether it needs a product anchor (`bucket: per_product`). Call it before building or editing a surface's `steps`. Read-only.
# The store's Shopify name and brand logo
Source: https://docs.depict.ai/api-reference/the-stores-shopify-name-and-brand-logo
/api-reference/openapi/lite.json get /shop-brand
Returns the store's name and Shopify brand logo (Settings > Brand), read live from the Shopify Storefront API. Call it to render the merchant's brand, e.g. in a search preview. Read-only.
# The thresholds behind the computed product badges
Source: https://docs.depict.ai/api-reference/the-thresholds-behind-the-computed-product-badges
/api-reference/openapi/lite.json get /settings/dynamic-status
How the dynamic badges are computed for this merchant: the New in window, how many products count as bestsellers, slow movers and trending, the low-stock percentage and the order window. Read-only; a merchant that never saved settings gets the defaults.
# This store's replica collections that are unpublished while their source is live
Source: https://docs.depict.ai/api-reference/this-stores-replica-collections-that-are-unpublished-while-their-source-is-live
/api-reference/openapi/lite.json get /multi-store/replica-publish-divergence/{merchant_id}
Collections of `merchant_id` that replicate a live collection of another store in the group but are themselves unpublished. An empty list also answers a merchant in no group and a group with publish-sync off, where drift is expected rather than a fault; call GET group-settings (400 NOT_IN_GROUP / `sync_publish_status: false`) to tell those apart from a checked group with nothing diverged. Read-only.
# Turn Depict on or off for many collections
Source: https://docs.depict.ai/api-reference/turn-depict-on-or-off-for-many-collections
/api-reference/openapi/lite.json put /collections/bulk-activation
The bulk form of PUT /collections/activation for up to 100 collections. The plan limit is checked for the whole batch (402). A collection that fails (unknown, a Shopify error) is reported in `errors` and the others still apply. Returns the rollup.
# Turn Depict on or off for one collection
Source: https://docs.depict.ai/api-reference/turn-depict-on-or-off-for-one-collection
/api-reference/openapi/lite.json put /collections/activation
Activating makes Depict manage the collection (its saved sort, pins and rules are written back to Shopify); deactivating hands the order back to Shopify and restores the collection's template. Activating is capped by the plan's active-collection limit (402). Side effects: Shopify writes, a sync-back, linked multi-store collections follow, and a tracked event. Returns null.
# Unpublish a collection version
Source: https://docs.depict.ai/api-reference/unpublish-a-collection-version
/api-reference/openapi/lite.json put /collections/{collection_id}/unpublish_version/{version}
Takes a published version off the storefront: the main version (clears its Shopify metafields and the main pointer) or a market version (retires it for its markets); then triggers the order sync-back. The version itself is kept.
# Update one legacy A/B test metaobject
Source: https://docs.depict.ai/api-reference/update-one-legacy-ab-test-metaobject
/api-reference/openapi/lite.json put /brand-features/metaobject/{metaobject_id}
Upserts the A/B test metaobject named by the body's `handle`, creating its definitions on first use; when the body carries its `id`, it must be the path's metaobject. Used to edit a running legacy whole-collection A/B test (dates, name, notify email, generated conclusion). Side effect: a Shopify metaobject write. Returns JSON `null`.
# Upload an image or video file to the merchant's Shopify Files
Source: https://docs.depict.ai/api-reference/upload-an-image-or-video-file-to-the-merchants-shopify-files
/api-reference/openapi/lite.json post /media/{merchant_id}/upload
Streams one multipart `file` into Shopify Files (staged upload, fileCreate), waits until Shopify has processed it, and returns the file node, whose `id` a content block then references. Side effects: creates a Shopify file in this store, and in every multi-store sibling linked through `collection_id`; nothing is rolled back if one store fails. Images and videos only; Shopify's size caps apply. Can take tens of seconds for a video.
# What the merchant's synced catalogue contains, in counts
Source: https://docs.depict.ai/api-reference/what-the-merchants-synced-catalogue-contains-in-counts
/api-reference/openapi/lite.json get /catalogue-facts
Returns counts over the merchant's synced catalogue: products, collections, how many are out of stock or have no image, how many carry a description or tags, and how many share a tag with another product. Call it to describe a store to itself before any shopper data exists — the onboarding Home shows these instead of invented sales figures. Read-only.
# Where a merchant's catalog is between Shopify and the search index
Source: https://docs.depict.ai/api-reference/where-a-merchants-catalog-is-between-shopify-and-the-search-index
/api-reference/openapi/lite.json get /merchants/{merchant_id}/catalog-readiness
Returns where the merchant's catalog is between Shopify and the search/recommendations index: the pipeline `stage`, whether search is `serving`, and document counts. Call it to tell whether search and recommendations can work yet, or how far an import has come; the portal polls it every few seconds while a store activates. Read-only.
# Where the merchant's search onboarding stands
Source: https://docs.depict.ai/api-reference/where-the-merchants-search-onboarding-stands
/api-reference/openapi/lite.json get /search-onboarding/status
The state of adding Depict search to the merchant's storefront theme: a background job prepares a search header on an unpublished copy of the live theme, then builds that copy for the merchant to preview and publish. Poll it after searchOnboardingEnable or searchOnboardingGoLive. Read-only.
# Whether the merchant's recommendations are computed yet
Source: https://docs.depict.ai/api-reference/whether-the-merchants-recommendations-are-computed-yet
/api-reference/openapi/lite.json get /recommendations/precompute-status
Reports whether the merchant's recommendations have been computed: the run in flight (if any), the last finished run, and `ready` (the last run completed with at least one market). Poll it after enabling recommendations or changing surfaces to know when storefront recommendations are live. Read-only.
# Whether the storefront is behind Shopify's password page
Source: https://docs.depict.ai/api-reference/whether-the-storefront-is-behind-shopifys-password-page
/api-reference/openapi/lite.json get /merchants/{merchant_id}/storefront-password-protected
Returns a bare boolean: true when the online store is password-protected, so shopper-facing previews cannot load. Asks Shopify live; a 502 means Shopify could not be asked (dead token, frozen shop, no config), so the answer is unknown, not false. Read-only.
# Whether the store's catalog is indexed for search yet
Source: https://docs.depict.ai/api-reference/whether-the-stores-catalog-is-indexed-for-search-yet
/api-reference/openapi/lite.json get /search-reports/ingestion-status
How far catalog indexing has come (0–100) with a display line, and when the shop's search data starts. Poll until has_run_at_least_one_ingestion. Read-only.
# Whether the store's stored Shopify token still works
Source: https://docs.depict.ai/api-reference/whether-the-stores-stored-shopify-token-still-works
/api-reference/openapi/lite.json get /merchant-create/check-token-health/
Probes the stored offline Admin API token of the store in the caller's session token. Returns `needs_reinstall: true` when the store is unknown, has no usable config, or Shopify answers 401 for the token (then marks the app uninstalled); the app then re-runs the install flow. Any other Shopify answer, 403 included, is `false`. Needs a Shopify session token.
# Which brand features the merchant's plan allows
Source: https://docs.depict.ai/api-reference/which-brand-features-the-merchants-plan-allows
/api-reference/openapi/lite.json get /brand-features/eligibility
One entry per brand feature (content blocks, image settings, product duplicates, the legacy A/B test, collection-version A/B tests) saying whether the merchant's plan allows it and, if not, the upgrade reason to show. Derived from the merchant's entitlements. Read-only; cacheable for 5 minutes.
# Which pinned products replication would skip, per replica
Source: https://docs.depict.ai/api-reference/which-pinned-products-replication-would-skip-per-replica
/api-reference/openapi/lite.json get /multi-store/replication-report/{merchant_id}
For every replication link in `merchant_id`'s group, the source collection's pinned products that would NOT reach the replica (no SKU, SKU missing in the target store, or gone from the source). Call it to explain why a replica differs from its source. Read-only; `{edges: []}` for a store in no group.
# Write the plain-language conclusion of an A/B test
Source: https://docs.depict.ai/api-reference/write-the-plain-language-conclusion-of-an-ab-test
/api-reference/openapi/lite.json put /ab-test/generate_conclusion
Asks the model to explain the test's result from its metrics (abTestMetrics) and stores the text on the test's Shopify metaobject. If `metaobject.generated_conclusion` is already non-empty it is returned unchanged: no model call, no write. Otherwise it costs a model call and writes to Shopify.
# Merchant attributes
Source: https://docs.depict.ai/api-v4/attributes
Fields on the product card that only your store defines, such as an add-to-cart id, and the display attributes you can add with include=attributes.
Some stores need fields on the product card that only they define. A common case is an add-to-cart id: your cart takes an id other than the variant's `product_id`, and Depict computes it from your product data. If a card went out without it, your storefront couldn't add the product to the cart. Merchant attributes make such fields part of your store's contract.
The card carries two kinds of attribute. Declared attributes are computed when Depict imports your product data, and come on every card. [Display attributes](#display-attributes) are the fields your display settings list, and come only when you ask with `include=attributes`.
## Declared attributes
Depict computes each declared attribute when it imports your product data, and stores the result. The API reads the stored value. It returns declared attributes on `browse`, `products` and `recommendations`, with or without `include`.
On the card, an attribute appears under its `key`, on each variant:
```json theme={null}
{
"product_id": "V-1001-M",
"attributes": { "add_to_cart_id": "1001-M-SE" }
}
```
You can filter on the same `key`, as in `filter_by=add_to_cart_id:=1001-M-SE`. See [Fields you can filter on](/api-v4/filters#fields-you-can-filter-on).
Each attribute has a type:
| Type | Example key |
| - | - |
| string | `add_to_cart_id` |
| number | `weight_kg` |
| boolean | `in_sweden` |
| string list | `occasions` |
* A key is lowercase snake case, matching `^[a-z][a-z0-9_]*$`.
* A variant without a value for an attribute doesn't carry it, unless the attribute is [required](#required-attributes).
* Changing an attribute's type is a breaking change for your store's card. To change what an attribute means with the same type, say from color names to hex codes, use a new key.
* If one key ends up stored with two types, neither is served. Use a new key instead.
* An empty string counts as no value.
## Required attributes
Depict can mark an attribute as required for your store, with an optional pattern its values must match, such as your cart's id format. One attribute can be marked as the add-to-cart id. The add-to-cart id is always required.
* Every variant on a card carries a valid value for each required attribute.
* A variant without a valid value is left out of the card. A card with no variants left is left out of the page. The rest of the page is still served.
* On `products`, the id of a card left out this way is in `missing`.
Talk to your Depict contact to set up declared or required attributes.
## Display attributes
Send `include=attributes` on `browse`, `products` or `recommendations` to get the fields your store's display settings list, named by their id in those settings:
```http theme={null}
GET /v4/acme/browse?market=se&query=jacket&include=attributes
```
* `variants[i].attributes.` is that variant's value.
* `attributes.` on the card is the value when every variant agrees. Otherwise it is a list of the distinct values, with numbers and booleans as strings. On a style card, a value that differs between colorways is on each variant, not on the card.
* A value with translations comes in the request's language.
* A display attribute that lives on your price list, such as a `show_as_sale` flag, takes its value from the request's market.
* Ids that are already card fields, such as the title, SKU, prices and images, are not repeated.
* On a variant, a declared attribute wins over a display attribute with the same name.
* The ids your store groups cards by, such as `item_group_id`, are display attributes too, even when your display settings don't list them.
* Color comes without `include`. The color name `color_name` and the hex code `color_hex` or `color_hex_code` are served as the card's [`color`](/api-v4/contract#color) and each colorway's, not in `attributes`. With `include=attributes` they are in `attributes` too. A color attribute you declare is always in `attributes`.
* Image details such as alt text are not part of the card.
These built-in ids are filled when your display settings list them:
| Id | Type | Value |
| - | - | - |
| `currency` | string | The price's currency |
| `description` | string | The product description |
| `handle` | string | The slug |
| `inactive` | boolean | Always `false`: inactive products are never returned |
| `item_group_id` | string | Your id for the product |
| `transaction_product_id` | string | The SKU, or a bundle's own id |
| `quantity` | number | Stock you can sell in the request's market, summed over locations. Absent when stock isn't tracked |
| `category_ids` | string list | Category ids. `[]` when none |
| `tags` | string list | `[]` when none |
| `barcode` | string | The GTIN |
| `pim_variant_index` | number | The variant's position |
| `product_type` | string | The product type |
| `published_at` | string | When the product was created, as an ISO 8601 time |
| `variant_title` | string | The size name |
If your store has its own attribute with one of these ids, you get your value instead. On Shopify stores you always get the built-in, and `tags`, `barcode`, `pim_variant_index`, `product_type`, `published_at` and `variant_title` come from Shopify's product fields.
# Response contract
Source: https://docs.depict.ai/api-v4/contract
The typed response contract. The product card, variants, colorways, prices, card extras, enums, versioning and error codes.
Every response follows one typed contract. This page describes the product card, how the contract is versioned, and the errors you can get.
## Principles
1. `browse`, `products` and `recommendations` return the same product card, and take the same [`include`](#card-extras) to add to it.
2. A card always has what you need to sell the product. That is its title, slug, images, price, stock, at least one variant, and each variant's `product_id`, plus the [merchant attributes](/api-v4/attributes) your store requires. `images` is `[]` when a product has no images.
3. The card is small by default. It holds what a product grid needs, and [`include`](#card-extras) adds the rest.
4. Ids are strings from your catalog. Numeric ids, such as Shopify's or Centra's, are decimal strings, never JSON numbers.
5. New fields can appear. Ignore fields you don't know, and accept new values in open enums.
## Example
A rain jacket that comes in black and yellow. The card shows the black colorway with its sizes, and lists both colorways for a color picker.
```json theme={null}
{
"request_id": "...",
"currency": "SEK",
"products": [
{
"group_id": "G-1001-BLK",
"title": "Rain Jacket Black",
"slug": "rain-jacket-black",
"images": ["https://cdn.acme.example/rain-black-1.jpg", "https://cdn.acme.example/rain-black-2.jpg"],
"color": {"name": "Black", "hex": "#000000"},
"price": {"amount": 1999},
"in_stock": true,
"badges": [],
"variants": [
{"product_id": "V-1001-BLK-S", "size": "S", "in_stock": false},
{"product_id": "V-1001-BLK-M", "size": "M", "in_stock": true},
{"product_id": "V-1001-BLK-XL", "size": "XL", "in_stock": true, "price": {"amount": 2199}}
],
"selected": 1,
"colorways": [
{"group_id": "G-1001-BLK", "product_id": "V-1001-BLK-M", "color": {"name": "Black", "hex": "#000000"},
"image": "https://cdn.acme.example/rain-black-1.jpg", "in_stock": true},
{"group_id": "G-1001-YEL", "product_id": "V-1001-YEL-M", "color": {"name": "Yellow", "hex": "#ffd400"},
"image": "https://cdn.acme.example/rain-yellow-1.jpg", "price": {"amount": 1499, "compare_at": 1999},
"in_stock": true, "title": "Rain Jacket Yellow", "slug": "rain-jacket-yellow"}
],
"tracking_id": "..."
}
]
}
```
* `currency` is stated once for the whole response. Every price in it is in that currency.
* The XL variant costs more than the card's price, so it carries its own `price`. The other variants don't.
* The yellow colorway is on sale and has its own title and page, so it carries its own `price`, `title` and `slug`. To show its sizes, send [`include=variants`](#card-extras), or ask [`products`](/api-v4/endpoints#products) for `V-1001-YEL-M`.
## Product
| Field | Always there | Notes |
| - | - | - |
| `group_id` | yes | The product's id. Where your store groups cards by style, the id of the colorway the card shows |
| `title` | yes | The selected variant's title |
| `brand` | no | |
| `slug` | yes | The product's path on your site. `""` when it has none in the locale |
| `images` | yes | The shown colorway's image URLs in order. By convention `[0]` is the main image and `[1]` the hover image |
| `video` | no | `{url, poster_url?}` |
| `color` | no | The shown colorway's [color](#color), when your store has color names |
| `price` | yes | The selected variant's [price](#price) |
| `in_stock` | yes | Whether any variant, in any colorway, is in stock in the request's market |
| `badges` | yes | Labels for the card. The one badge is `sale`, set when the selected variant's price is reduced. Can be `[]`. More values may be added |
| `variants` | yes | The shown colorway's variants, which are its sizes. At least one. See [Variant order](#variant-order) |
| `selected` | yes | The index in `variants` of the variant to show first. It is the variant that best matches the request. When that one is out of stock, an in-stock variant of the same colorway is selected instead |
| `colorways` | no | Every [colorway](#colorway) of a style card, the shown one included, in the card's order. Absent on a card with one colorway |
| `attributes` | no | With `include=attributes`, your [display attributes](/api-v4/attributes#display-attributes). Each is one value when every variant agrees, else a list of the distinct values. On a style card, a value that differs between colorways is on each variant instead |
| `tracking_id` | yes | An id for this card in this response. Don't parse it |
## Variant
| Field | Always there | Notes |
| - | - | - |
| `product_id` | yes | The variant's id. Use it for your cart and tracking |
| `size` | no | The size name |
| `in_stock` | yes | Whether it is in stock in the request's market. Untracked stock counts as out of stock |
| `price` | no | The variant's [price](#price), only when it differs from the card's `price` |
| `image` | no | The variant's own main image, only when it differs from the card's `images[0]` |
| `sku` | no | With `include=attributes` only |
| `attributes` | for some stores | Your declared [merchant attributes](/api-v4/attributes), such as an add-to-cart id. With `include=attributes`, also the variant's display attribute values |
| `group_id` | no | On another colorway's variants, that colorway's `group_id`. A variant without it belongs to the shown colorway |
| `color` | no | The variant's [color](#color), only when it differs from the card's, as on another colorway's variants |
| `title` | no | Only when it differs from the card's title, as on another colorway's variants |
| `slug` | no | Only when it differs from the card's slug, as on another colorway's variants. Link the variant here |
### Variant order
When your store shows sizes, variants are sorted by size. Letter sizes come first, from smallest to largest, then numeric and half sizes, then one size, then other size names, and last the variants without a size. Otherwise variants are sorted by `product_id`. Some stores keep their catalog's order.
## Colorway
A style card can hold several colorways of one product. `colorways` has one entry for each, with enough to draw a color picker.
| Field | Always there | Notes |
| - | - | - |
| `group_id` | yes | The colorway's id |
| `product_id` | yes | The variant to show for the colorway, one in stock when it has any. Ask [`products`](/api-v4/endpoints#products) for it to get the colorway's card |
| `color` | no | The colorway's [color](#color), when your store has color names |
| `image` | no | The colorway's main image |
| `price` | no | The price of the colorway's `product_id`, only when it differs from the card's `price` |
| `in_stock` | yes | Whether any of its variants is in stock in the request's market |
| `title`, `slug` | no | Only when they differ from the card's |
## Color
| Field | Notes |
| - | - |
| `name` | The color name from your display settings, `color_name` |
| `hex` | A CSS color such as `#ffd400`, when your display settings have one as `color_hex` or `color_hex_code` |
## Price
| Field | Notes |
| - | - |
| `amount` | The price to pay, in major units. `1999` is 1,999 SEK |
| `compare_at` | The original price. Only there when it is higher than `amount` |
A price has no currency of its own. The response's `currency`, an ISO 4217 code such as `SEK`, applies to every price in it. `currency` is absent when the response has no products.
## Card extras
`include` adds to the card on `browse`, `products` and `recommendations`. Send one or both, comma-separated in a GET or as an array in a POST.
| Value | Adds |
| - | - |
| `variants` | Every colorway's variants, not just the shown one's. Another colorway's variants carry its `group_id` and, when they differ, its `color`, `image`, `price`, `title` and `slug` |
| `attributes` | Your [display attributes](/api-v4/attributes#display-attributes) on the card and each variant, and each variant's `sku` |
```http theme={null}
GET /v4/acme/products?market=se&ids=V-1001-BLK-M&include=variants,attributes
```
* With `include=variants`, the variants are sorted across the whole card, so colorways are interleaved. Group them by `group_id`.
* A recommendation surface's card is narrower. With `include=variants` it has the recommended colorway's sizes and one variant for each other colorway. See [Surfaces](/api-v4/recommendations#surfaces).
* Without `include`, each variant still has your declared attributes, such as an add-to-cart id.
* Both extras make the response bigger, so ask only for what the page shows.
* On `browse`, card extras don't change which [sections](/api-v4/endpoints#browse) you get.
## Open and closed enums
An open enum can get new values, so handle values you don't know. A closed enum can't, so you can handle every value.
| Kind | Enums |
| - | - |
| Open | `badges`, listing `type`, content block `type`, `position` and `visibility`, error `code`, recommendation `inputs` |
| Closed | Facet `type`, sort `order`, suggestion `type`, anchor `type` |
## Versioning
Every `/v4` response sends the header `x-depict-contract: 6.0`, and so do most errors. An unexpected `500` may not.
A minor version only adds things, such as a new optional field, a new value in an open enum, a new error code or a new endpoint. Your code keeps working.
A major version may break things, such as a removed or renamed field, a new required field, a changed type or a new value in a closed enum. A major version gets a new path, `/v5`, and the old one keeps running alongside it.
## Errors
Errors have this shape:
```json theme={null}
{
"error": {
"code": "bad_request",
"message": "limit: Too big: expected number to be <=100",
"request_id": "...",
"path": ["limit"]
}
}
```
* `path` points to the parameter or body field that is wrong, when the error is about one. Every filter error has `["filter_by"]`.
* `allowed` lists the accepted names on `unknown_filter_field` and `unknown_sort_field`.
* Handle codes you don't know by their status.
| Code | Status | When |
| - | - | - |
| `bad_request` | 400 | The request is malformed. Examples are an unknown or repeated parameter, a wrong type, a value out of range, an empty list item, broken percent-encoding, a body that isn't a JSON object or is over 64 KiB, a POST with a query string, a `cursor` that didn't come from a response, a missing or malformed `anchor`, and a `filter_by` over 4,096 characters |
| `invalid_filter` | 400 | See [Filter errors](/api-v4/filters#errors) |
| `unknown_filter_field` | 400 | See [Filter errors](/api-v4/filters#errors) |
| `unknown_sort_field` | 400 | See [Sorts](/api-v4/filters#sorts) |
| `unsupported_input` | 400 | `/recommendations` got an input its type doesn't read. See [Recommendation errors](/api-v4/recommendations#errors) |
| `not_found` | 404 | No such path, or your store can't be searched in this locale |
| `unknown_merchant` | 404 | No store with that name |
| `unknown_market` | 404 | No market matches, or it has no price list |
| `unknown_locale` | 404 | No locale matches |
| `unknown_recommendation_type` | 404 | `/recommendations` got a `type` your store doesn't have |
| `unknown_listing` | 404 | No listing with that id or external id, or the listing has no text in the locale's language |
| `method_not_allowed` | 405 | The path doesn't take this method. The `allow` header lists the ones it takes |
| `search_not_enabled` | 422 | `browse` got a `query`, but search isn't turned on for your store |
| `internal` | 500 | Something failed on Depict's side |
| `not_implemented` | 501 | Your store's setup needs something the API doesn't serve, such as some curated recommendation types. Talk to your Depict contact |
| `upstream_unavailable` | 503 | Search, recommendations or Depict's product data didn't answer in time, or failed. Try again |
| `listing_rule_input_invalid` | 503 | A listing's rules can't be applied right now. Depict is alerted. Try again later |
A 5xx always means a problem on Depict's side, never in your request. Quote the `request_id` when you report one.
# Endpoints
Source: https://docs.depict.ai/api-v4/endpoints
Every Platform API endpoint, with its parameters and response. Covers browse, products, context, recommendations, suggest and listings.
Every path starts with `/v4/{merchant}`. [Making requests](/api-v4/introduction#making-requests) explains how to send parameters, markets and locales. [Response contract](/api-v4/contract#product) describes the product card that several endpoints return.
## browse
`GET /v4/{merchant}/browse` returns a search page or a listing page. Send a `query` for search, a `listing` for a listing page, or both to search within a listing.
| Parameter (GET) | POST field | Notes |
| - | - | - |
| `market` | `market` | Required |
| `locale` | `locale` | Optional |
| `query` | `query` | The shopper's search text, at most 512 characters. Leave it out, or send it blank, for a listing page |
| `listing` | `listing: {"id": ...}` | The listing's `id` from [listings](#listings) |
| `listing_external_id` | `listing: {"external_id": ...}` | Your own id for the listing, at most 500 characters. Send `listing` or `listing_external_id`, not both |
| `filter_by` | `filter_by` | Narrows the results. See [Filters and sorts](/api-v4/filters) |
| `sort=.` | `sort: {"field", "order"}` | `relevance`, `price`, `newest`, `title`, `discount` or one of your custom sorts. Leave it out for the default order. See [Sorts](/api-v4/filters#sorts) |
| `include` | `include` | What to return besides the cards. See [Sections](#sections) |
| `cursor` | `cursor` | The `cursor` from the previous page |
| `limit` | `limit` | Products per page, 1 to 100. Default 24 |
### Sections
`include` names the sections you want besides the cards. The sections are `facets`, `sorts`, `content` and `listing`.
* Without `include` you get `facets` and `sorts`.
* Naming a section replaces that default, so send `facets,sorts,listing` to get all three.
* Send an empty `include=` for no sections.
* The [card extras](/api-v4/contract#card-extras) `attributes` and `variants` add to the cards and keep the default sections. `include=variants` returns facets and sorts too.
### Example
A listing page, filtered to red or blue products from 100 to 500, cheapest first:
```http theme={null}
GET /v4/acme/browse?market=se&locale=sv-SE&listing=4f1c0000-0000-0000-0000-000000000000&filter_by=color%3A%3D%5Bred%2Cblue%5D%20%26%26%20price%3A%5B100..500%5D&sort=price.asc&limit=24
```
The same request as a POST:
```http theme={null}
POST /v4/acme/browse
{"market": "se", "locale": "sv-SE", "listing": {"id": "4f1c0000-0000-0000-0000-000000000000"},
"filter_by": "color:=[red,blue] && price:[100..500]", "sort": {"field": "price", "order": "asc"}}
```
### Response
| Field | Notes |
| - | - |
| `request_id` | The request's id |
| `currency` | The currency of every price in `products`, such as `SEK`. Absent when there are no products |
| `products` | [Product cards](/api-v4/contract#product) in result order, at most `limit` |
| `total` | How many products match. Absent when the total can't be counted. On some searches it grows on a later page, as more related products follow the first matches |
| `cursor` | Pass it back to get the next page. Absent on the last page |
| `facets` | In the `facets` section. Your store's filters, with values and counts. See [Facets](/api-v4/filters#facets) |
| `sorts` | In the `sorts` section. Your store's sorts, with the one in use marked `selected` |
| `content` | In the `content` section. Your store's content pages, such as articles, that match the `query`. Each has a `title`, a site-relative `url` and `highlights`, which can be `[]`, and may have a `description` and `snippet`. At most `limit`, paged with the same `cursor` as the products. `[]` when there is no query, nothing matches, or your store has no content search |
| `listing` | In the `listing` section, on a listing page. The [listing header](#listing-header) |
### Which products browse returns
* `browse` returns products a shopper can buy. It leaves out inactive products, products without a price, and products not sold in the request's market.
* If your store hides out-of-stock products, a product shows while any of its sizes is in stock in the market, or when it is exempt from auto-hide. On search, your search's own hide-out-of-stock setting applies. A search inside a listing follows the listing's stock rule. A filter on a size shows only products in stock in that size.
* Products you hide from search are left out of every request without a listing. Products you hide in a listing, or from listing pages, are left out of listing pages. A search inside a listing follows the listing's hides, not the search hides.
* A listing holds the products assigned to it and the products its rules match. A listing with neither serves an empty page, unless it has pins or hides. Then it serves your whole catalog with those applied.
* A listing that doesn't exist, or has no text in the locale's language, gets `404 unknown_listing`.
* A listing's pins and hides are read for the request's market. A market without its own uses its market group's, then your global ones. A boost or bury rule applies in the markets it names, or in every market when it names none.
* You get one card per product, as your store groups products for display. You don't get one card per variant.
### Order
This is the order when you send no `sort`.
* A listing page follows the listing's merchandising. Pins keep their slots, then come boost and bury rules, then the market's boost and bury score, then newest first.
* Search orders products by relevance to the query, using text matches and closeness in meaning. Your search boost and bury rules contribute to that score.
* Inside a listing, search rules don't apply. Pins don't apply to any search, even within a listing.
* A request with no query and no listing returns your whole catalog in merchandising order.
A sort replaces the pins and rules. On a listing page, the boost and bury score breaks its ties.
### Search
Depict's hybrid search combines keyword-based text matching with vector-based matching by meaning.
* Search uses the fields and weights in your store's **Searchable fields** setting in the portal.
* Text matching allows one typo per word, tried only when the exact words find nothing. Product codes get no typos.
* Product names support prefix matching, so the beginning of a word can match. Added searchable attributes use whole-word matching.
* Search uses only the first 100 characters of the query.
* Matching by meaning adds relevant products that may not contain the query's words.
* When nothing matches, search returns no results. Your storefront shows the no-results state you configured in the portal.
* A shopper sort changes the result order. The request remains a search.
A typed query always runs as a search. These rules follow your search settings.
* A color word filters by color. If your store has no products in that color, search returns no results.
* A query that looks like a product code, such as an SKU or article number, also searches your product code fields, and the matching products lead the page. A hyphenated code also finds a code stored without hyphens.
* Query rules apply searchandising choices per query and are configured in the portal.
* A product added by a query rule joins the results and is ranked like the other products. It is not pinned.
* Products a rule hides stay hidden when the query is the rule's term, in the request's language.
#### Text matching
Text matches the way your catalog writes it, so `t-shirt` matches "T-Shirt", and case doesn't matter. A leading `-` is a space, not an exclusion.
## products
`GET /v4/{merchant}/products` returns product cards by id, for example for a wishlist or a cart.
| Parameter | Notes |
| - | - |
| `market`, `locale` | As on every endpoint |
| `ids` | 1 to 50 ids, comma-separated, each at most 500 characters. Each is a variant's `product_id` or SKU, or a card's or colorway's `group_id` |
| `include` | [Card extras](/api-v4/contract#card-extras): `attributes`, `variants` or both |
```http theme={null}
GET /v4/acme/products?market=se&ids=V-1001-M,V-9999
```
```json theme={null}
{"request_id": "...", "currency": "SEK", "products": [{"group_id": "G-1001", "...": "..."}], "missing": ["V-9999"]}
```
* `products` follow the order of `ids`. If two ids belong to the same colorway, its card appears once, for the first id. Ids from different colorways each get a card.
* For a variant id, the card shows that variant's colorway, with that variant `selected`. For a colorway's `group_id`, the card shows that colorway, with its first variant in stock selected.
* Variant ids come back in the kind you sent, so ask by SKU and you get SKUs. If one request mixes SKUs with other ids, every card uses SKUs. When every id is a group id, variant ids come back as your storefront's ids.
* `missing` lists the ids that have no card in this market. The product is unknown, inactive, not priced there, or has no title in the locale. It is absent when every id has a card.
* `currency` is absent when `products` is empty.
## context
`GET /v4/{merchant}/context` describes your store. It takes no parameters. Call it once when your storefront builds or starts.
```json theme={null}
{
"request_id": "...",
"markets": [
{
"key": "se",
"name": "Sweden",
"currency": "SEK",
"locales": ["sv-SE", "en-SE"],
"default_locale": "sv-SE"
}
],
"recommendation_types": [
{"type": "similar", "inputs": ["anchor"]}
]
}
```
* `markets` lists the markets that have a price list. Send a market's `key` as `market` on the other endpoints.
* `locales` are the locales your store can be searched in. Every market lists the same locales. `default_locale` is the market's own default.
* `recommendation_types` lists the types [`/recommendations`](/api-v4/recommendations) takes for your store, each with the inputs it reads. It is absent when your store has none.
## recommendations
`GET /v4/{merchant}/recommendations` returns recommended products, such as similar products on a product page. See [Recommendations](/api-v4/recommendations).
## suggest
`GET /v4/{merchant}/suggest` returns suggestions while the shopper types. Matching listings come first, then up to 4 popular searches. Popular searches leave out the shopper's own query and near-duplicates.
| Parameter | Notes |
| - | - |
| `market`, `locale` | As on every endpoint |
| `query` | Required, at most 512 characters. Send an empty `query=` before the shopper types. See [The start view](#the-start-view) |
| `limit` | How many listings to suggest, 1 to 100. Default 3 |
```http theme={null}
GET /v4/acme/suggest?market=se&locale=sv-SE&query=jack
```
```json theme={null}
{
"request_id": "...",
"suggestions": [
{
"type": "listing",
"listing": {"id": "4f1c0000-0000-0000-0000-000000000001", "external_id": "women-jackets", "title": "Jackets", "slug": "women/jackets", "type": "category", "images": []},
"path": ["Women"]
},
{"type": "query", "query": "rain jacket"}
]
}
```
* A listing suggestion has the listing and its `path`, the titles of its parent listings from the top level down.
* A query suggestion has a popular search to run.
* Your store gets listing suggestions, popular searches or both, as Depict has set it up. If one kind can't be loaded, you get the other, not an error.
### The start view
An empty `query=` returns what to show before the shopper types.
* Your pinned suggestion listings come first.
* A store with a saved start view gets its start-view phrases instead of popular searches, and there can be more than 4.
* If you turned suggested searches off for the start view, an empty query returns listings only.
## listings
Two endpoints share the `/listings` path: your listing tree, and one listing's header.
| Parameter (GET) | POST field | Notes |
| - | - | - |
| `market` | `market` | Required |
| `locale` | `locale` | Optional |
| Not in a GET | `types` | Tree only, and only in a POST. Returns only listings of these types, as an array such as `["category", "brand"]`. A type your store doesn't have returns an empty tree. A GET with `types` gets `400 bad_request` |
| `external_id` | `external_id` | Header only. One listing by your own id for it, at most 500 characters |
Breadcrumbs, quick links and tree nodes use a listing reference:
| Field | Notes |
| - | - |
| `id` | Depict's id for the listing. Pass it to `browse` as `listing` |
| `external_id` | Your own id for the listing. Absent when it has none |
| `title` | In the request's language. `""` when the listing has no title |
| `slug` | The listing's path on your site in the locale. Absent when it has none |
### Listing tree
`GET /v4/{merchant}/listings?market=` returns your listings in the locale, as a tree. Use it to build menus. When a listing has no text in the request's locale, v4 uses another locale of the same language. This holds for the tree and for the listing header.
Only categories, as a POST:
```http theme={null}
POST /v4/acme/listings
{"market": "se", "locale": "sv-SE", "types": ["category"]}
```
```json theme={null}
{
"request_id": "...",
"listings": [
{
"id": "4f1c0000-0000-0000-0000-000000000000",
"external_id": "women",
"title": "Women",
"slug": "women",
"type": "category",
"children": [
{
"id": "4f1c0000-0000-0000-0000-000000000001",
"external_id": "women-jackets",
"title": "Jackets",
"slug": "women/jackets",
"type": "category",
"children": []
}
]
}
]
}
```
* `listings` holds the top-level listings. Each node is a listing reference with `type` and `children`, to any depth.
* Children are sorted in the order you pinned them on the parent, then by title. Top-level listings are sorted by title.
* A listing is left out when it has no text in the locale's language, or when `types` doesn't name its type. Its children are left out too.
* Disabled listings are included.
### Listing header
`GET /v4/{merchant}/listings/{id}?market=`, or `GET /v4/{merchant}/listings?market=&external_id=`, returns what a listing page shows around its products. Browse returns the same header with `include=listing`.
```http theme={null}
GET /v4/acme/listings/4f1c0000-0000-0000-0000-000000000001?market=se&locale=sv-SE
```
```json theme={null}
{
"request_id": "...",
"listing": {
"id": "4f1c0000-0000-0000-0000-000000000001",
"external_id": "women-jackets",
"title": "Jackets",
"slug": "women/jackets",
"type": "category",
"show_in_breadcrumbs": true,
"breadcrumbs": [
{"id": "4f1c0000-0000-0000-0000-000000000000", "external_id": "women", "title": "Women", "slug": "women"}
],
"quick_links": [
{"id": "4f1c0000-0000-0000-0000-000000000002", "external_id": "women-rain-jackets", "title": "Rain jackets", "slug": "women/jackets/rain"}
],
"images": [],
"content_blocks": []
}
}
```
| Field | Notes |
| - | - |
| `id`, `external_id`, `title`, `slug` | As in a listing reference |
| `type` | `category`, `campaign`, `brand`, `style` or `look`. More types may be added |
| `show_in_breadcrumbs` | Whether to show the listing itself as the last breadcrumb |
| `breadcrumbs` | The parent listings set to show in breadcrumbs, top level first, up to 8 levels. Add the listing itself last when `show_in_breadcrumbs` is `true` |
| `quick_links` | The listings set to show as quick links. They are the listing's children. When it has no children, they are its siblings of the same type, the listing itself included |
| `images` | Image URLs. `[]` when none |
| `content_blocks` | Merchandising tiles in the listing's product grid. See below |
Breadcrumbs and quick links come ready to render. Quick links follow the order you pinned them in, then title. Parents, siblings and children without text in the locale's language are left out.
A listing that doesn't exist, or has no text in the locale's language, gets `404 unknown_listing`. Sending both an id and an `external_id` gets `400 bad_request`. Disabled listings are served.
A content block:
| Field | Notes |
| - | - |
| `row` | The grid row it starts on |
| `position` | `left`, `right` or `center` |
| `span_columns`, `span_rows` | How many columns and rows it covers |
| `aspect_ratio` | `1.5` on a landscape block that keeps its own 3:2 shape. Absent on a block sized by the grid |
| `visibility` | `desktop` or `mobile` when the block shows on that kind of device only. Absent when it shows on every device. Treat a value you don't know as absent |
| `content.type` | `image` or `video` |
| `content.url` | The image or video |
| `content.link` | Where the block links to. Absent when it has no link |
| `content.text` | Overlay text, one line, at most 140 characters. Absent when none |
| `content.text_position` | `top`, `middle` or `bottom`, then `left`, `center` or `right`, joined by a hyphen, such as `top-left`. Default `bottom-center` |
| `content.cta` | Call-to-action text, one line, at most 60 characters. Absent when none |
# Events
Source: https://docs.depict.ai/api-v4/events
Send impressions, clicks, add-to-carts, product views and purchases to Depict. The request format, the fields of each event type, the response and the limits.
Depict learns from what shoppers see, click and buy. Your storefront reports those actions to one endpoint, `POST /v4/{merchant}/events`. Search ranking, recommendations and the analytics in your Depict account all depend on these events, so send them from the first day.
## Request
The body is NDJSON, which is one JSON object on each line. Each line is one event. Send it with `Content-Type: application/x-ndjson`.
```bash theme={null}
curl -s -X POST "https://api.depict.ai/v4/acme/events" \
-H "Content-Type: application/x-ndjson" \
--data-binary @events.ndjson
```
A body with an impression, a click and an add-to-cart looks like this:
```json theme={null}
{"event_id": "e-1", "type": "impression", "market": "se", "session_id": "b7c1e2", "ts": "2026-11-17T15:04:05Z", "tracking_id": "..."}
{"event_id": "e-2", "type": "click", "market": "se", "session_id": "b7c1e2", "ts": "2026-11-17T15:04:09Z", "tracking_id": "..."}
{"event_id": "e-3", "type": "add_to_cart", "market": "se", "session_id": "b7c1e2", "ts": "2026-11-17T15:04:30Z", "tracking_id": "...", "product_id": "V-1001-BLK-XL"}
```
You can send one event in a request or many. The endpoint takes only POST, and blank lines are skipped.
## Event types
| `type` | Send it when |
| - | - |
| `impression` | A product card becomes visible to the shopper |
| `click` | The shopper clicks a product card |
| `add_to_cart` | The shopper adds a product to the cart |
| `product_view` | The shopper opens a product page |
| `purchase` | The shopper completes an order |
## Fields
Every event has these fields.
| Field | Required | Notes |
| - | - | - |
| `event_id` | yes | An id you create for the event, at most 128 characters. It is for your own use. Depict does not remove duplicates by it |
| `type` | yes | One of the [event types](#event-types) |
| `market` | yes | The shopper's market, as you send it on other requests |
| `session_id` | yes | The shopper's device id, at most 256 characters. See [Session id](#session-id) |
| `ts` | yes | When the action happened, as an ISO 8601 time with an offset, such as `2026-11-17T15:04:05Z`. Depict records the time the event is received |
| `locale` | no | The shopper's locale, such as `sv-SE` |
| `tracking_id` | on `impression` and `click` | The card's `tracking_id`, unchanged. See [Tracking id](#tracking-id) |
| `product_id` | no | On `add_to_cart` and `product_view`, the variant the shopper acted on. See [Product id](#product-id) |
| `query` | no | The search text the card was served for, at most 512 characters |
| `ab_variant` | no | The name of your own A/B test group for the shopper, at most 64 characters |
| `url` | no | The page's URL |
| `referrer` | no | The page's referrer. Used on `product_view` |
| `purchase` | on `purchase` only | The order. See [Purchases](#purchases) |
### Tracking id
Every product card in a search, listing or recommendations response has a `tracking_id`. Send it back unchanged on the card's `impression` and `click` events. It ties the event to the response the card came from and to the card's position in it, so you send no other result id.
Send it on `add_to_cart` and `product_view` too when the shopper came from a card.
Cards from [`products`](/api-v4/endpoints#products) also have a `tracking_id`, but impressions and clicks on them are not recorded.
### Product id
On `add_to_cart` and `product_view`, an event with a `tracking_id` counts for the card's selected variant. Send `product_id` only when the shopper acted on another variant, such as another size. Without a `tracking_id`, send `product_id`.
On `impression` and `click`, the product always comes from the `tracking_id`.
### Session id
`session_id` is a stable id for the shopper's device that stays the same across visits. It is not an id for one visit. Create it once, store it on the device, and send the same value on every event.
Depict uses it to connect a cart or a purchase to the clicks that came before it. If the id changes between visits, those connections are lost.
### Purchases
A `purchase` event has a `purchase` object. Send one event for each order, for every order in your store, including orders that never touched a Depict result.
```json theme={null}
{"event_id": "e-9", "type": "purchase", "market": "se", "session_id": "b7c1e2", "ts": "2026-11-17T15:20:00Z", "purchase": {"transaction_id": "ORDER-5512", "currency": "SEK", "items": [{"sku": "1001-BLK-XL", "price": 2199, "quantity": 1}]}}
```
| Field | Required | Notes |
| - | - | - |
| `transaction_id` | yes | The order's id in your system |
| `currency` | yes | The ISO 4217 code of the prices, such as `SEK` |
| `items` | yes | One entry for each order line |
| `items[].sku` | yes | The product's transaction product id in your product data. By default that is its SKU. It can't be empty |
| `items[].price` | yes | The price of one unit |
| `items[].quantity` | yes | A whole number, at least 1 |
| `items[].product_id` | no | The variant's `product_id` |
## Response
```json theme={null}
{
"request_id": "...",
"accepted": 3,
"rejected": 0
}
```
* `accepted` is the number of lines that were valid events. A valid event is not always stored. Depict filters out some traffic, such as known crawlers.
* `rejected` is the number of lines that were not valid, such as broken JSON, a missing required field or a line that is too long. Rejected lines are not stored. The valid lines in the same body still count.
The status is `200` even when lines are rejected, so check `rejected` while you build your integration.
## Limits
* A body can be at most 1 MiB. A larger body gets `400 bad_request` and none of its events are stored. Split it into smaller bodies and send them again.
* A line can be at most 64 KiB. A longer line is rejected.
## Send each action once
If your storefront already sends events to Depict's older tracking endpoints, or through a Depict tracking script, don't send the same actions here as well. They would be counted twice. See [Upgrade from v3/v2](/api-v4/upgrade#tracking).
## Requests no shopper sees
The `track: false` header belongs on requests for product data, as [Tracking](/api-v4/introduction#tracking) describes. For tests and server-side checks, don't send events at all.
# Filters and sorts
Source: https://docs.depict.ai/api-v4/filters
The filter_by syntax, the fields you can filter on, limits and errors, and the facets and sorts on `browse`.
`browse` narrows a search or a listing page with `filter_by`, a filter expression over your store's field names. This page has the whole syntax.
## Sending a filter
In a GET, percent-encode the whole value. A raw `&` ends the parameter, so `&&` must be `%26%26`, and a literal `+` must be `%2B`.
```http theme={null}
GET /v4/acme/browse?market=se&filter_by=color%3A%3D%5Bred%2Cblue%5D%20%26%26%20price%3A%5B100..500%5D
```
In a POST, send the same string as `filter_by`:
```json theme={null}
{ "market": "se", "filter_by": "color:=[red,blue] && price:[100..500]" }
```
In JavaScript, `URLSearchParams` does the encoding for you:
```js theme={null}
const params = new URLSearchParams({
market: "se",
filter_by: "color:=[red,blue] && price:[100..500]",
});
const res = await fetch(`https://api.depict.ai/v4/acme/browse?${params}`);
```
## Syntax
```text theme={null}
expression := and ("||" and)*
and := primary ("&&" primary)*
primary := "(" expression ")" | clause
clause := field ":" ("" | "=" | "!=" | ">" | ">=" | "<" | "<=") (item | "[" item ("," item)* "]")
item := value | number ".." number a range: only in a list after a bare ":"
value := bare | "`" text "`" no backtick inside a value
```
* A bare value ends at whitespace or any of `` , ( ) [ ] & | ` ``. Put any value with spaces or those characters in backticks: `` brand:=`Acme Outdoor` ``.
* A bare value is a number, `true` or `false`, or else a string. A number is digits with an optional leading `-` and decimal part, so `1e3` is a string.
* A value in backticks is always a string. `` price:=`100` `` gets `400 invalid_filter`.
* After a bare `:`, a bare value with `..` in it is read as a range. Put it in backticks to match it as text.
* `&&` binds tighter than `||`. Use parentheses to group, up to 32 levels deep.
* An empty `filter_by` means no filter.
* Joins such as `$collection(...)`, geo filters, `!` negation and `exists` are not supported. Each gets a 400.
## Operators
| Operator | Meaning |
| - | - |
| `:=` | Exact match. `:=[a,b]` matches any of them |
| `:!=` | Matches none of them. A product without the field matches |
| `:` | Word match on strings, equality on numbers and booleans. `field:[min..max]` is a range, both ends included |
| `:>` `:>=` `:<` `:<=` | Compares with one number. A product without the field never matches |
## Fields you can filter on
When two fields share a name, the one higher in this table wins. The exception is a facet named `brand` or `category`, which replaces the built-in one.
| Field | Filters on | Kind |
| - | - | - |
| `price` | The price in the request's market | number |
| `in_stock` | Stock in the request's market | boolean |
| `brand` | The brand | string |
| `category` | Category ids | string |
| each of your facets | The facet's values | the field's type |
| each of your other filters | Its values, including filters you don't show shoppers | the field's type |
| each [merchant attribute](/api-v4/attributes) | The attribute's value | its type |
| each other product attribute in your search index | That attribute | its type |
* `price` and `in_stock` always mean the above.
* Catalogue fields such as `title`, `description`, `tags`, `product_type`, `gender`, `material` and `colors` can be filtered on only when they are one of your facets or filters.
* A field name is letters, digits, `_` and `-`, at most 128 characters. A facet on a nested attribute uses dots, as in `var_color.value`.
* Any other name gets `400 unknown_filter_field`, and `allowed` lists the names you can use.
* A new field becomes filterable a few minutes after Depict indexes it.
## Values per kind
| Kind | Operators | Values |
| - | - | - |
| number | All, and ranges in a list | Numbers only |
| boolean | `:`, `:=`, `:!=` | `true`, `false` |
| string | `:`, `:=`, `:!=` | Any |
Anything else gets `400 invalid_filter`. That covers a comparison or range on a field that isn't a number, a list after a comparison, a value of the wrong kind, and a range whose min is greater than its max.
## Limits
| Limit | Value | Over it |
| - | - | - |
| Operations | 80. Each clause counts as one, and so does each `&&` and `\|\|`. A value list counts as one at any length. Parentheses don't count. On a listing with many rules, the listing's own filters count too | `400 invalid_filter` |
| Length | 4,096 characters, in GET and POST | `400 bad_request` |
| Nesting | 32 levels of parentheses | `400 invalid_filter` |
## Errors
Every filter error is a 400 with `path: ["filter_by"]`. A syntax error names the character position.
```json theme={null}
{ "error": { "code": "invalid_filter", "message": "filter_by: expected \":\" after \"size\" at character 19",
"request_id": "...", "path": ["filter_by"] } }
```
```json theme={null}
{ "error": { "code": "unknown_filter_field", "message": "unknown filter field \"color\"",
"request_id": "...", "path": ["filter_by"], "allowed": ["brand", "category", "color", "in_stock", "price", "size"] } }
```
| Code | When |
| - | - |
| `invalid_filter` | The filter can't be read, is over a limit, or uses an operator or value the field's kind doesn't take |
| `unknown_filter_field` | The filter names a field you can't filter on |
| `bad_request` | The filter is over 4,096 characters |
Sometimes a field is allowed but your search index can't filter on it, such as a facet that isn't indexed. The API then drops the parts of your filter that use it and still serves the page. A dropped part is the whole `&&` term that holds the field, so a group like `(a || b)` goes as one.
## How your filter combines with Depict's
The API applies your filter together with its own conditions, as `(your filter) && (Depict's conditions)`. An `||` in your filter can't bring back a product the API leaves out. Those are inactive products, products without a price or not sold in the market, hidden products, and products outside the listing.
## Facets
Facets are the filters a shopper sees next to the results. `browse` returns them by default and with `include=facets`, in the order you set them up. A facet your search index can't count is left out, and the others are still served.
```json theme={null}
{
"field": "color",
"title": "Color",
"type": "swatch",
"expanded": true,
"values": [
{"value": "Black;#000000", "label": "Black", "count": 42, "selected": true, "swatch": "#000000"},
{"value": "Yellow;#ffd400", "label": "Yellow", "count": 7, "selected": false, "swatch": "#ffd400"}
]
}
```
### Facet fields
| Field | Notes |
| - | - |
| `field` | The name to use in `filter_by` |
| `title` | The facet's title in the request's language |
| `type` | `checkbox`, `radio`, `swatch`, `hierarchy`, `grid` or `range` |
| `expanded` | Whether to show the facet open |
| `values` | Up to 150 values. A `range` facet has `min`, `max` and, when the filter sets one, the `selected` range instead |
Each value has the `value` to send back in a filter, a `label` to show in the request's language, a `count` and `selected`. A `swatch` value also has `swatch`, a CSS color, where you set one. Checkbox, radio and swatch values come most frequent first unless you set another order.
Values you group in your settings come back as one value. Its `value` is `g_`, its label is the group name, and its count covers every member. Send that value back to filter on the whole group.
### Built-in facets
* Price is a `range`, or a `checkbox` of prices if you set it up that way. `min` is rounded down and `max` up. They ignore the request's own price filter.
* Size is a `grid`, in size order. On listing pages its counts are products in stock in that size, and without a filter, sizes out of stock show with count 0. On search its counts are all matching products with that size, unless your store hides out-of-stock products or the filter names the size.
* Discount is a `radio` from "20% or more" to "50% or more", with values `0.2`, `0.3`, `0.4` and `0.5`. Send `discount:>=0.3` to select 30% or more. Only options with products are listed.
* Sale and stock are a `checkbox` with the one value `true`.
* A category tree is a `hierarchy`. Its labels are shown as stored.
### Counts and selection
* Counts are products, meaning cards, not variants. They cover every product that matches, not just the page.
* When the filter selects values on a facet's field alone, the facet's other values show the counts they would have without that selection. A shopper can see what each extra value adds. This holds for every facet except a `radio` facet you set up yourself, which counts with every filter applied.
* `selected` is `true` for a value your filter selects with `:=` or `:` on that field alone. On the discount facet, `:>=` or `:>` with exactly one of its four values selects that option.
* A value the shopper selected stays listed, at count 0 if needed, so the shopper can clear it. A category tree doesn't re-add such values.
### Facets that are left out
* A facet with no values is left out.
* On listing pages, so is a facet with one value and none selected. A category tree is kept.
* On search, so are a facet of only yes or no values and an unselected discount facet.
The search rules apply to any request with a `query`, including a search inside a listing.
## Sorts
Send `sort=.` in a GET, or `{"field", "order"}` in a POST. Both parts are required. Leave `sort` out for the default order.
| Field | Sorts by |
| - | - |
| `relevance` | On a search, how well products match the query. On a listing page, the listing's merchandising. See [Order](/api-v4/endpoints#order) |
| `price` | The price in the request's market |
| `newest` | When the product was created |
| `title` | The title, alphabetically |
| `discount` | The discount in the request's market. If your search index can't sort on it, you get the default order, not an error |
| a custom sort's field | That field |
Any other field gets `400 unknown_sort_field`, at `path: ["sort", "field"]`, and `allowed` lists your sort fields. Pins keep their slots only with the default order or `relevance`, on a listing page without a query.
The `sorts` section of a browse response lists the sorts your store offers shoppers, which can be fewer than the fields above.
# Introduction
Source: https://docs.depict.ai/api-v4/introduction
The Depict Platform API serves search, listing pages, product cards and recommendations for your storefront. How to get access, make requests and read responses.
The Platform API serves the product data your storefront shows. You send a request for a search page, a listing page, a set of products or a row of recommendations. You get back product cards in the order to show them, with prices and stock for the shopper's market.
* One endpoint, `browse`, serves both search pages and listing pages.
* Every endpoint returns the same small product card. You ask for more fields only where a page needs them.
* Every response follows a typed contract with a version number.
The current version is v4, and every path starts with `/v4`.
| Page | What it covers |
| - | - |
| This page | The base URL, endpoints, how to make requests, response headers |
| [Endpoints](/api-v4/endpoints) | Parameters and responses for each endpoint |
| [Filters and sorts](/api-v4/filters) | The `filter_by` syntax, facets and sorts |
| [Response contract](/api-v4/contract) | The product card, colorways, card extras, versioning and error codes |
| [Merchant attributes](/api-v4/attributes) | Fields on the card that only your store defines |
| [Recommendations](/api-v4/recommendations) | Recommendation types, inputs and errors |
| [Events](/api-v4/events) | How to report impressions, clicks, carts and purchases |
| [Upgrade from v3/v2](/api-v4/upgrade) | What to change in an integration built on the v3 or v2 endpoints |
## Base URL
The base URL is `https://api.depict.ai`, and every path starts with `/v4`. Requests need no key and no authentication header.
```bash theme={null}
curl -s "https://api.depict.ai/v4/acme/context"
```
## Quickstart
Three requests cover a first integration. Replace `acme` with your store's name.
1. Read your markets and locales once, when your storefront builds or starts.
```bash theme={null}
curl -s "https://api.depict.ai/v4/acme/context"
```
2. Fetch a search page for a market from that response.
```bash theme={null}
curl -s "https://api.depict.ai/v4/acme/browse?market=se&locale=sv-SE&query=jacket"
```
3. Render the `products` in the response. Each one is a [product card](/api-v4/contract#product) with a title, images, a price and its sizes. Pass the response's `cursor` back to get the next page.
## Endpoints
| Endpoint | What it returns |
| - | - |
| [`GET /v4/{merchant}/browse`](/api-v4/endpoints#browse) | A search page or a listing page, with products, facets and sorts |
| [`GET /v4/{merchant}/products`](/api-v4/endpoints#products) | Product cards by id |
| [`GET /v4/{merchant}/context`](/api-v4/endpoints#context) | Your markets, locales and recommendation types |
| [`GET /v4/{merchant}/recommendations`](/api-v4/recommendations) | Recommended products |
| [`GET /v4/{merchant}/suggest`](/api-v4/endpoints#suggest) | Suggestions while the shopper types a search |
| [`GET /v4/{merchant}/listings`](/api-v4/endpoints#listings), [`GET /v4/{merchant}/listings/{id}`](/api-v4/endpoints#listing-header) | Your listing tree, or one listing's header |
| [`POST /v4/{merchant}/events`](/api-v4/events) | Takes the events your storefront reports. POST only |
## Making requests
### Path
Every path is `/v4/{merchant}/{endpoint}`. `merchant` is your store's name in Depict, in lowercase, such as `acme`. An unknown name gets `404 unknown_merchant`.
### GET or POST
Every endpoint that returns data takes a GET with a query string. You can also send a POST with the same parameters as one JSON object in the body. Both give the same answer, so use POST when a request is too long for a URL.
In a POST body, lists are JSON arrays, and `sort`, `listing`, `anchor` and each entry of `recent_views` are objects. Each endpoint shows its POST fields. A few rules apply to every such POST. [`events`](/api-v4/events) has its own body format.
* The body is a JSON object of at most 64 KiB. An endpoint without parameters still needs `{}`.
* An unknown field gets `400 bad_request`.
* A POST can't also have a query string.
* Any content type works.
### Query strings
* Separate list values with commas. The lists are `ids`, `cart`, `exclude`, `include`, `types` and `recent_views`. Send a comma inside an id as `%2C`.
* `+` means a space. Send a literal plus as `%2B`.
* An unknown parameter, a parameter sent twice, or an empty item in a list such as `ids=a,,b` gets `400 bad_request`.
### Market and locale
Every endpoint that returns data, except `/context`, needs a `market`. Use the market's `key` from [`/context`](/api-v4/endpoints#context). The API also accepts the market's name, and a two-letter country code when a market is named after that country.
`locale` is optional. It is a language tag such as `sv-SE`, and `sv_SE` works too. Without a locale, the market's `default_locale` from `/context` applies. If your store has more than one language, send the locale on every request so the language never depends on a default.
If no locale matches exactly, the API uses one with the same language, so `sv-FI` gets a Swedish locale. The Norwegian tags `no` and `nn` fall back to your `nb` locale.
* A market that matches nothing, or has no prices, gets `404 unknown_market`.
* A locale that matches no language of your store gets `404 unknown_locale`.
* A locale that isn't a language tag gets `400 bad_request`.
### Ids
Ids are strings from your own catalog. In a POST body, send every id as a JSON string, numeric ids too. If your storefront writes a variant id as `-`, such as `14356-9065`, send that form and the API answers in it. Apart from `request_id` and each card's `tracking_id`, the only Depict ids you see are listing ids.
### Pages
`browse` returns one page at a time. Pass the `cursor` from a response to get the next page. `limit` sets the page size, from 1 to 100, and defaults to 24. A cursor that didn't come from a response gets `400 bad_request`.
## Tracking
Depict learns from what shoppers click and buy, so report those actions to the [`events`](/api-v4/events) endpoint. Every product card has a `tracking_id`. Send it back on the card's impression and click events.
Send the header `track: false` on requests no shopper sees, such as tests and server-side checks. Depict then records no clicks or views for the cards in that response. Requests from known crawlers are never tracked.
## Response headers
| Header | What it holds |
| - | - |
| `x-depict-request-id` | The request's id. The body has it too, as `request_id`, or `error.request_id` on an error. Include it when you report a problem |
| `x-depict-contract` | The contract version the body follows, `6.0`. See [Versioning](/api-v4/contract#versioning). Can be missing on an unexpected `500` |
| `allow` | On a `405`, the methods the path takes |
| `cache-control` | `no-store` |
Responses expose `x-depict-request-id` and `x-depict-contract` to your code. Other `x-depict-*` headers are for Depict's diagnostics. Don't rely on them.
# Recommendations
Source: https://docs.depict.ai/api-v4/recommendations
The recommendations endpoint. Recommendation types, the anchor, cart, recent views and exclude inputs, used_inputs and errors.
`GET /v4/{merchant}/recommendations` returns recommended products. You can also send a `POST` with the same fields as a JSON body.
Each request names a recommendation type, such as similar products on a product page. A type decides which inputs it reads. [`/context`](/api-v4/endpoints#context) lists your store's types under `recommendation_types`.
## Types
| Your store has | Types | Each type reads |
| - | - | - |
| No recommendation setup with Depict | `similar`: products similar to one product, for a product page | `anchor` (a product) |
| Recommendation surfaces set up with Depict | One type per surface, such as similar products, up-sell, cart, checkout or landing page, named by the surface's key | `cart` and `recent_views`, plus an `anchor` when the surface is for a product or category page |
* A surface's type also answers to the surface's name or id.
* A store with surfaces gets its surfaces instead of `similar`. `/context` always lists what your store has.
* A store with no types has no `recommendation_types` in `/context`, and every `type` gets `404 unknown_recommendation_type`.
## Request
| Parameter (GET) | POST field | Notes |
| - | - | - |
| `market` | `market` | Required |
| `locale` | `locale` | Optional |
| `type` | `type` | Required. One of your store's types |
| `anchor=product:` | `anchor: {"type", "id"}` | The product or category the recommendations are for. `type` is `product` or `category`. A product's `id` is a `product_id`, SKU or `group_id` |
| `cart` | `cart` | The products in the cart, as 1 to 100 `product_id`s, SKUs or `group_id`s |
| `recent_views=@