Recommendations
curl --request POST \
--url https://api.example.com/api/v1/recommendimport requests
url = "https://api.example.com/api/v1/recommend"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/recommend', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/recommend",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/recommend"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/recommend")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/recommend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyRecommendations
Get product recommendations using 8 different models
POST
/
api
/
v1
/
recommend
Recommendations
curl --request POST \
--url https://api.example.com/api/v1/recommendimport requests
url = "https://api.example.com/api/v1/recommend"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/recommend', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/recommend",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/recommend"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/recommend")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/recommend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyAuthentication
All requests must include an API key via thex-api-key header or key query parameter.
The workspace is resolved automatically from the API key — do not pass workspaceId in the request body.
curl -X POST https://alana.shopping/api/v1/recommend \
-H "Content-Type: application/json" \
-H "x-api-key: ak_your_api_key" \
-d '{
"model": "similar",
"productId": "550e8400-e29b-41d4-a716-446655440000",
"limit": 10
}'
Recommendation Models
| Model | Type | Required Params | Description |
|---|---|---|---|
similar | Catalog | productId | Products semantically similar to the given product |
complementary | Catalog | productId | Products that complement (go well with) the given product |
alternatives | Catalog | productId | Alternative products in the same category at similar price |
match_profile | Catalog | productId | Products matching the same style/attribute profile |
trending | Catalog | — | Top trending products in the workspace catalog |
frequently_bought_together | Event-based | productId | Products commonly purchased alongside the given product |
recommended_for_you | Event-based | userId | Personalized recommendations based on user behavior history |
buy_it_again | Event-based | userId | Products the user has purchased before and may want again |
Graceful Degradation
Event-based models (frequently_bought_together, recommended_for_you, buy_it_again) require sufficient
event volume. When event data is insufficient, these models automatically fall back to a catalog-based model.
The response includes fallback: true and fallbackModel indicating which model was used instead.
Request Format
{
"model": "similar",
"productId": "550e8400-e29b-41d4-a716-446655440000",
"limit": 10
}
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | One of the 8 model names listed above |
productId | string | Conditional | Required for product-based models |
userId | string | Conditional | Required for user-based models |
limit | integer | No | Max results to return (1–50, default 10) |
Response Format
{
"model": "similar",
"hits": [
{
"objectID": "550e8400-e29b-41d4-a716-446655440000",
"title": "Tênis Running Pro",
"price": 299.9,
"currency": "BRL",
"availability": "in_stock"
}
],
"nbHits": 8,
"fallback": false,
"processingTimeMs": 45
}
| Field | Type | Description |
|---|---|---|
model | string | The model used to generate results |
hits | array | Array of SearchHit objects (Algolia-compatible) |
nbHits | integer | Total number of results |
fallback | boolean | True when an event-based model fell back to a catalog model |
fallbackModel | string | The fallback model used (only when fallback=true) |
processingTimeMs | integer | Processing time in milliseconds |
Última modificação em 12 de março de 2026
⌘I