curl --request POST \
--url https://api.example.com/api/ml/swap-recipe{
"id": 123,
"recipe_id": 123,
"name": "<string>",
"calories": 123,
"protein": 123,
"carbs": 123,
"fat": 123,
"image_url": "<string>",
"recipe_url": "<string>",
"ingredients": "<string>",
"meal_types": [
{
"id": 123,
"name": "<string>"
}
],
"diet_types": [
{
"id": 123,
"name": "<string>"
}
],
"assigned_meal_type": "<string>",
"distance": 123
}curl --request POST \
--url https://api.example.com/api/ml/swap-recipe{
"id": 123,
"recipe_id": 123,
"name": "<string>",
"calories": 123,
"protein": 123,
"carbs": 123,
"fat": 123,
"image_url": "<string>",
"recipe_url": "<string>",
"ingredients": "<string>",
"meal_types": [
{
"id": 123,
"name": "<string>"
}
],
"diet_types": [
{
"id": 123,
"name": "<string>"
}
],
"assigned_meal_type": "<string>",
"distance": 123
}Swap a recipe in your meal plan with a similar alternative that matches your dietary preferences and nutritional goals.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/SmartEatAI/smart-eat-ai/llms.txt
Use this file to discover all available pages before exploring further.
Authorization: Bearer <your_access_token>
recipe_id field from the recipe object, not the database id.breakfastlunchdinnersnack"Mediterranean Chicken Bowl"480354518"https://example.com/recipes/mediterranean-bowl.jpg""https://example.com/recipes/mediterranean-bowl""chicken breast, quinoa, cherry tomatoes, cucumber, feta cheese, olive oil, lemon""dinner"0.234curl -X POST 'https://api.smarteat.ai/api/ml/swap-recipe?recipe_id=12345&meal_label=dinner&n_search=550' \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
import requests
url = "https://api.smarteat.ai/api/ml/swap-recipe"
headers = {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
params = {
"recipe_id": 12345,
"meal_label": "dinner",
"n_search": 550
}
response = requests.post(url, headers=headers, params=params)
print(response.json())
const params = new URLSearchParams({
recipe_id: '12345',
meal_label: 'dinner',
n_search: '550'
});
const response = await fetch(`https://api.smarteat.ai/api/ml/swap-recipe?${params}`, {
method: 'POST',
headers: {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
}
});
const data = await response.json();
console.log(data);
{
"id": 847,
"recipe_id": 67890,
"name": "Mediterranean Chicken Bowl",
"calories": 480,
"protein": 35,
"carbs": 45,
"fat": 18,
"image_url": "https://example.com/recipes/mediterranean-bowl.jpg",
"recipe_url": "https://example.com/recipes/mediterranean-bowl",
"ingredients": "chicken breast, quinoa, cherry tomatoes, cucumber, feta cheese, olive oil, lemon, red onion, kalamata olives",
"meal_types": [
{
"id": 2,
"name": "lunch"
},
{
"id": 3,
"name": "dinner"
}
],
"diet_types": [
{
"id": 1,
"name": "high_protein"
},
{
"id": 5,
"name": "low_calorie"
}
],
"assigned_meal_type": "dinner",
"distance": 0.187
}
{
"detail": "No similar recipe found for this meal type"
}
{
"detail": "Invalid token payload"
}
n_search neighbors (default 550)distance values indicate closer nutritional similarityn_search values (700-1000) if you have strict dietary restrictionsn_search values (300-400) for faster responses when flexibility is acceptabledistance metric helps you understand how similar the swap is nutritionally