Endpoints
Customer Recommendations
Get personalized recommendations for a specific customer based on their preferences and behavior.
Customer Recommendations
curl --request GET \
--url https://api.example.com/v1/recommendations/customers/{customer_id} \
--header 'customer_id: <customer_id>'import requests
url = "https://api.example.com/v1/recommendations/customers/{customer_id}"
headers = {"customer_id": "<customer_id>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {customer_id: '<customer_id>'}};
fetch('https://api.example.com/v1/recommendations/customers/{customer_id}', 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/v1/recommendations/customers/{customer_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"customer_id: <customer_id>"
],
]);
$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/v1/recommendations/customers/{customer_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("customer_id", "<customer_id>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/recommendations/customers/{customer_id}")
.header("customer_id", "<customer_id>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/recommendations/customers/{customer_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["customer_id"] = '<customer_id>'
response = http.request(request)
puts response.read_bodyAuthentication Required
This endpoint requires API key authentication via Bearer token in the Authorization header.Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Path Parameters
string (UUID)
required
Unique identifier for the customer to get recommendations for
Query Parameters
boolean
Whether to include segment-based recommendations in the response. Defaults to
false.
string
Filter recommendations by region (e.g., “BH” for Bahrain). Comma-separated
values for multiple regions.
Response
The API returns a JSON array of recommendation objects:[
{
"recommendation_id": "00000000-1234-5678-9abc-def012345678",
"name": "Recommended For you",
"student_id": "00000000-9779-438e-ae0d-b52099f6be51",
"offers": [
"00000000-e9c5-4b43-9d46-4cd02baabc6a",
"00000002-c1f0-44d4-af13-32028f522f31",
"00000001-4d21-4206-8ced-ff2a11162bf0"
],
"type": "SELF"
}
]
| Field | Type | Description |
|---|---|---|
recommendation_id | string | Unique identifier for the recommendation |
name | string | Human-readable name for the recommendation set |
student_id | string | UUID of the customer (matches the path parameter) |
offers | array | Array of offer UUIDs that are recommended |
type | string | Type of recommendation (SELF or SEGMENT) |
Error Codes
| Status Code | Description |
|---|---|
| 200 | Recommendations retrieved successfully |
| 400 | Invalid customer_id format |
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Customer not found |
| 500 | Internal server error |
Example
curl -X GET "https://api.hellocobi.com/v1/recommendations/customers/00000000-9779-438e-ae0d-b52099f6be51?includeSegments=false®ions=BH" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
Best Practices
- Caching: Cache recommendations for frequently requested customers to improve performance
- Error Handling: Implement proper error handling for cases where no recommendations are available
- Rate Limiting: Be mindful of API rate limits (1000 requests per minute)
- Validation: Validate the customer_id format before making the request
Was this page helpful?