Shop the Look
Shop the Look allows you to search for products using multiple detection IDs from object detection in a single request. This is useful when you want to find products that match multiple objects detected in an image.
Shop the Look consumes 1 lens credit per detection_id. For example, searching with 3 detection IDs will consume 3 lens credits.
Overview
The Shop the Look API enables you to:
- Search for products using multiple detection IDs at once
- Get results grouped by each detection ID
- Control the number of products returned per detection
- Find matching products for complete room or scene setups
Workflow
A typical workflow for using Shop the Look:
- Upload an image to the Object Detection API to detect objects
- Get detection IDs from the response for each detected object
- Call Shop the Look with those detection IDs to find matching products
- Display results grouped by each detected object
Use Cases
- Room Shopping: Upload a room photo, detect all furniture, and find similar products for each piece
- Outfit Shopping: Upload a fashion photo, detect clothing items, and find similar products
- Interior Design: Detect objects in a reference image and source matching products
Authentication
You can authenticate using either:
Option 1: Authorization: Bearer YOUR_TOKEN header (obtain from /api/v1/token)
Option 2: x-client-secret: YOUR_CLIENT_SECRET header
API
Search Products by Detection IDs
Endpoint: POST /api/v1/lens/shop-the-look
Search for products using multiple detection IDs from object detection. Returns products grouped by each detection ID.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit |
integer | 1 | Maximum number of products to return per detection |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
detectionIds |
array of strings | Yes | Array of detection IDs from object detection |
curl -X POST "https://platform.youzu.ai/api/v1/lens/shop-the-look?limit=1" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"detectionIds": ["det_abc123", "det_def456", "det_ghi789"]
}'
curl -X POST "https://platform.youzu.ai/api/v1/lens/shop-the-look?limit=1" \
-H "x-client-secret: YOUR_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"detectionIds": ["det_abc123", "det_def456", "det_ghi789"]
}'
// Search for products using detection IDs
fetch('https://platform.youzu.ai/api/v1/lens/shop-the-look?limit=1', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
detectionIds: ['det_abc123', 'det_def456', 'det_ghi789']
})
})
.then(response => response.json())
.then(data => {
console.log('Search results:', data);
// Access products for each detection
Object.keys(data).forEach(detectionId => {
console.log(`${detectionId}:`, data[detectionId].label, data[detectionId].products);
});
})
.catch(error => {
console.error('Error:', error);
});
// Search for products using detection IDs
fetch('https://platform.youzu.ai/api/v1/lens/shop-the-look?limit=1', {
method: 'POST',
headers: {
'x-client-secret': 'YOUR_CLIENT_SECRET',
'Content-Type': 'application/json'
},
body: JSON.stringify({
detectionIds: ['det_abc123', 'det_def456', 'det_ghi789']
})
})
.then(response => response.json())
.then(data => {
console.log('Search results:', data);
// Access products for each detection
Object.keys(data).forEach(detectionId => {
console.log(`${detectionId}:`, data[detectionId].label, data[detectionId].products);
});
})
.catch(error => {
console.error('Error:', error);
});
import requests
# Search for products using detection IDs
url = 'https://platform.youzu.ai/api/v1/lens/shop-the-look?limit=1'
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
data = {
'detectionIds': ['det_abc123', 'det_def456', 'det_ghi789']
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
results = response.json()
# Access products for each detection
for detection_id, result in results.items():
print(f"{detection_id}: {result['label']}")
for product in result['products']:
print(f" - {product['name']['en']}")
else:
print('Error:', response.status_code, response.text)
import requests
# Search for products using detection IDs
url = 'https://platform.youzu.ai/api/v1/lens/shop-the-look?limit=1'
headers = {
'x-client-secret': 'YOUR_CLIENT_SECRET',
'Content-Type': 'application/json'
}
data = {
'detectionIds': ['det_abc123', 'det_def456', 'det_ghi789']
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
results = response.json()
# Access products for each detection
for detection_id, result in results.items():
print(f"{detection_id}: {result['label']}")
for product in result['products']:
print(f" - {product['name']['en']}")
else:
print('Error:', response.status_code, response.text)
Response
The response is an object keyed by detection ID, where each value contains:
| Field | Type | Description |
|---|---|---|
label |
string | The detected object label (e.g., "chair", "table") |
products |
array | Array of matching products for this detection |
Example response:
{
"det_abc123": {
"label": "chair",
"products": [
{
"id": "prod_xyz789",
"name": {
"en": "Modern Office Chair"
},
"price": {
"USD": 299.99
},
"images": ["https://example.com/chair.jpg"]
}
]
},
"det_def456": {
"label": "table",
"products": [
{
"id": "prod_uvw321",
"name": {
"en": "Dining Table"
},
"price": {
"USD": 599.99
},
"images": ["https://example.com/table.jpg"]
}
]
}
}