POST
/predictions/predict/Predict
You can return a list of recommended products based on a specified set of "seed" products (e.g., "products related to what's in the cart" or "contacts who viewed X also viewed Y"). This endpoint can also serve as a fallback for general recommendations.
NO AUTHORIZATION REQUIRED
This API endpoint does not require an API authorization key, to allow direct querying from the contact's browser.
| Attributes | Type | Required | Description |
|---|---|---|---|
| custom_ids | array | no | Array of strings representing your unique product identifiers (seed products). |
| product_ids | array | no | Array of integers representing User.com system product IDs (seed products). |
| limit | number | no | Maximum number of products to return (max 25). |
| segment_id | number | no | ID of a product segment to filter recommendations (e.g., "Available Products"). |
| categories | array | no | Array of category names to filter by. |
| tags | array | no | Array of tag names to filter by. |
| extra_data | number | no | Controls behavior when filters result in fewer products than limit. 0 (Strict) returns only matching products. 1 (Default) fills remaining slots with general recommendations. |
Request
- CURL
- JavaScript
- PHP
- Python
curl -X POST "https://<your_app_subdomain>.user.com/predictions/predict/" \
-H "Content-Type: application/json" \
-d '{
"custom_ids": ["SKU123", "SKU456"],
"limit": 5,
"segment_id": 101,
"extra_data": 0
}'
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://<your_app_subdomain>.user.com/predictions/predict/");
xhr.setRequestHeader("Content-Type", "application/json");
var data = JSON.stringify({
"custom_ids": ["SKU123", "SKU456"],
"limit": 5,
"segment_id": 101,
"extra_data": 0
});
xhr.send(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://<your_app_subdomain>.user.com/predictions/predict/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode(array(
"custom_ids" => array("SKU123", "SKU456"),
"limit" => 5,
"segment_id" => 101,
"extra_data" => 0
)),
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
import http.client
import json
conn = http.client.HTTPSConnection("<your_app_subdomain>.user.com")
payload = json.dumps({
"custom_ids": ["SKU123", "SKU456"],
"limit": 5,
"segment_id": 101,
"extra_data": 0
})
headers = { 'Content-Type': "application/json" }
conn.request("POST", "/predictions/predict/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Response
{
"recommended_products": [
{
"id": 85,
"name": "Faux Patent Sneakers",
"custom_id": "1820",
"description": "Step into style with these glossy pastel pink sneakers, designed to make a bold yet elegant statement. Perfectly blending fashion and function, these sneakers feature a shiny finish that adds a touch of sophistication to any outfit. Lightweight and comfortable, they’re ideal for day-long wear. Whether paired with casual denim or a sleek skirt, these sneakers are a versatile addition to your wardrobe, perfect for adding a pop of color to your look.",
"product_url": "https://ecommerce.demouser.eu/product/faux-patent-sneakers/",
"image_url": "https://ecommerce.demouser.eu/wp-content/uploads/2018/02/5408231050_1_1_1.jpg",
"qty": 1,
"created_at": "2024-11-22T09:35:49.802241Z",
"updated_at": "2025-12-12T13:59:13.299549Z",
"attributes": [
{
"name": "condition",
"name_std": "condition",
"value": "New",
"description": "",
"value_type": 4
},
{
"name": "identifier_exists",
"name_std": "identifier_exists",
"value": "no",
"description": "",
"value_type": 4
},
{
"name": "item_id",
"name_std": "item_id",
"value": 1820,
"description": "",
"value_type": 2
},
{
"name": "sale_start_date",
"name_std": "sale_start_date",
"value": "2025-12-12",
"description": "",
"value_type": 3
},
{
"name": "brand",
"name_std": "brand",
"value": "Shop",
"description": "",
"value_type": 4
},
{
"name": "item_name",
"name_std": "item_name",
"value": "Faux Patent Sneakers",
"description": "",
"value_type": 4
},
{
"name": "price",
"name_std": "price",
"value": 45.0,
"description": "",
"value_type": 7
},
{
"name": "sku",
"name_std": "sku",
"value": 1820,
"description": "",
"value_type": 2
},
{
"name": "stockstatus",
"name_std": "stockstatus",
"value": "instock",
"description": "",
"value_type": 4
},
{
"name": "google_business_vertical",
"name_std": "google_business_vertical",
"value": "retail",
"description": "",
"value_type": 4
},
{
"name": "availability",
"name_std": "availability",
"value": [
"in_stock"
],
"description": "",
"value_type": 6
},
{
"name": "item_category",
"name_std": "item_category",
"value": "Shoes",
"description": "",
"value_type": 4
},
{
"name": "sale_price",
"name_std": "sale_price",
"value": 38.25,
"description": "",
"value_type": 7
},
{
"name": "sale_end_date",
"name_std": "sale_end_date",
"value": "2025-12-12",
"description": "",
"value_type": 3
}
],
"categories": [
{
"id": 83,
"name": "Women, Limited time offer, Shoes",
"description": "",
"custom_id": null
}
]
}
]
}