Recommendation APIAPI ReferenceRecommendations

Search Recommendations

Return a paginated recommendation result set for product listing and search pages.

POST
/v2/recommendations/search

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.

Authorization

X-PSYKHE-API-KEY<token>

Required public API key (pk_...). Send it in this request header.

In: header

Query Parameters

psykhe_api_client*string

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

Search or product listing 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/search?psykhe_api_client=acme-production" \  -H "Content-Type: application/json" \  -d '{    "user": {      "device_id": "device-uuid-1",      "user_id": null    },    "query": null,    "limit": 24,    "sort": [      "featured"    ],    "filters": {      "collection": "dresses"    },    "facets": {      "keys": [        "*"      ],      "max_values": 20    },    "projection": [      "name",      "handle",      "images",      "price",      "variant_identifier"    ]  }'

{
  "recommendation_id": "reco_01J1P7VJYQJ8J9E9AT2X1WW8KQ",
  "expires_in": 3600,
  "pagination": {
    "page": 1,
    "has_more": true,
    "last_page": 6
  },
  "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",
      "price": 10500
    },
    {
      "type": "product",
      "product_identifier": "gid://shopify/Product/2002",
      "variant_identifier": "gid://shopify/ProductVariant/3002",
      "name": "Vega Solitaire Ring",
      "handle": "vega-solitaire-ring",
      "price": 12500
    }
  ],
  "count": 2,
  "total": 286,
  "facets": [
    {
      "key": "color",
      "label": "Color",
      "type": "list",
      "selection_mode": "multi",
      "collapsed": false,
      "values": [
        {
          "value": "gold",
          "label": "Gold",
          "count": 34,
          "selected": false
        }
      ]
    }
  ],
  "applied_filters": {
    "filters": {
      "collection": "dresses"
    },
    "facet_filters": []
  },
  "meta": {}
}

{
  "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
}