Query Recommendations
Return one bounded recommendation result set for a configured recommendation slot.
Return one bounded recommendation result set for a configured recommendation slot.
Recommendation queries are for page-slot recommendations such as similar products. They return a single result set with no pagination, facets, totals, or redirects. Each request returns the current recommendation result for that slot.
Required public API key (pk_...). Send it in this request header.
In: header
Query Parameters
Required client identifier issued in the PSYKHE AI Dashboard (e.g. acme-production). Send it with each request alongside the API key.
Request Body
application/json
Single recommendation query request.
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.psykhe.dev/v2/recommendations/query?psykhe_api_client=acme-production" \ -H "Content-Type: application/json" \ -d '{ "user": { "device_id": "device-or-session-token", "user_id": null }, "profile": "similar", "limit": 12, "group_by_product": true, "seed": { "product_identifiers": [ "gid://shopify/Product/123" ] }, "filters": { "collection": "black-friday", "availability": { "$eq": "in_stock" } }, "projection": [ "name", "handle", "images", "variant_identifier" ], "context": { "category_diversification": false }, "metadata": { "session_index": "4" } }'{
"recommendation_id": "reco_01J1P7VJYQJ8J9E9AT2X1WW8KQ",
"items": [
{
"type": "product",
"product_identifier": "gid://shopify/Product/2001",
"variant_identifier": "gid://shopify/ProductVariant/3001",
"name": "Regulus Cut Engagement Ring",
"handle": "regulus-cut-engagement-ring"
}
],
"count": 1,
"applied_filters": {
"filters": null,
"facet_filters": []
},
"metadata": {
"profile": "similar",
"seed_state": "provided"
}
}{
"errors": [
{
"code": "validation_error",
"message": "Invalid request",
"context": null,
"extra": null
}
],
"meta": null,
"data": null
}{
"errors": [
{
"code": "unauthorized",
"message": "Unauthorized",
"context": null,
"extra": null
}
],
"meta": null,
"data": null
}{
"errors": [
{
"code": "forbidden",
"message": "Forbidden",
"context": null,
"extra": null
}
],
"meta": null,
"data": null
}{
"errors": [
{
"code": "payload_too_large",
"message": "Payload too large",
"context": null,
"extra": null
}
],
"meta": null,
"data": null
}{
"errors": [
{
"code": "internal_error",
"message": "Internal server error",
"context": null,
"extra": null
}
],
"meta": null,
"data": null
}Search Recommendations POST
Return a paginated recommendation result set for product listing and search pages. This is the unified retrieval endpoint for category or collection PLPs, facets-only listing requests, and shopper-entered text search. Use it for storefront surfaces that need sorting, pagination, optional facets, totals, and optional redirect metadata. Send `query` for shopper-entered search text; omit `query` or send `null` for category or collection retrieval without a search term. Use `limit: 0` when you only need facet data.
Getting Started
Minimum setup for the PSYKHE AI Tracking API using Snowplow.