Skip to main content
POST
/
api
/
public
/
targeting
/
evaluate
Evaluate Strategy
curl --request POST \
  --url https://start.aftersell.app/api/public/targeting/evaluate \
  --header 'Content-Type: application/json' \
  --header 'X-Targeting-Api-Key: <api-key>' \
  --data '
{
  "shopDomain": "<string>",
  "rulesetId": "<array>",
  "context": {
    "products": [
      {
        "productId": "<string>",
        "variantId": "<string>",
        "quantity": 1,
        "price": 1,
        "handle": "<string>",
        "title": "<string>",
        "vendor": "<string>",
        "productType": "<string>",
        "tags": [
          "<string>"
        ],
        "collections": [
          "<string>"
        ],
        "sellingPlan": "subscription",
        "metafields": [
          {
            "namespace": "<string>",
            "key": "<string>",
            "value": "<string>"
          }
        ]
      }
    ],
    "cartToken": "<string>",
    "checkoutToken": "<string>",
    "sessionId": "<string>",
    "cart": {
      "subtotal": 1,
      "itemCount": 1,
      "lineCount": 1,
      "attributes": {},
      "notes": "<string>"
    },
    "customer": {
      "customerId": "<string>",
      "tags": [
        "<string>"
      ],
      "countryCode": "<string>",
      "provinceCode": "<string>",
      "locale": "<string>",
      "orderCount": 1,
      "totalSpent": 1,
      "acceptsMarketing": true
    },
    "session": {
      "utmSource": "<string>",
      "utmMedium": "<string>",
      "utmCampaign": "<string>",
      "utmContent": "<string>",
      "utmTerm": "<string>",
      "currencyCode": "<string>",
      "shippingCountryCode": "<string>",
      "shippingProvinceCode": "<string>",
      "shippingMethod": "<string>"
    }
  }
}
'
{ "success": true, "products": [ { "productId": "<string>", "handle": "<string>", "title": "<string>", "vendor": "<string>", "productType": "<string>", "price": "<string>", "compareAtPrice": "<string>", "availableForSale": true, "description": "<string>", "url": "<string>", "tags": [ "<string>" ], "collectionIds": [ "<string>" ], "images": [ { "src": "<string>", "altText": "<string>", "position": 123 } ], "variants": [ { "variantId": "<string>", "title": "<string>", "price": "<string>", "compareAtPrice": "<string>", "availableForSale": true, "sku": "<string>", "selectedOptions": [ { "name": "<string>", "value": "<string>" } ] } ] } ], "resolution": { "rulesetId": "<string>", "matchedRuleIds": [ "<string>" ], "selectionMethod": "<string>", "fallbackUsed": true }, "meta": { "servedFromCache": true, "processingTimeMs": 123, "data": {}, "explanation": "<string>" }, "errors": [ { "code": "<string>", "message": "<string>" } ] }

Authorizations

X-Targeting-Api-Key
string
header
required

Body

application/json
shopDomain
string
required

Your store's permanent domain

rulesetId
array
required

One or more ruleset IDs (24-char hex MongoDB ObjectIds)

context
object
required

Response

Evaluation successful

success
boolean

Whether the evaluation succeeded

products
object[]

Fully enriched recommended products

resolution
object
meta
object
errors
object[]

Present only when errors occur