Passio-Nutrition-AI
  • Introduction
  • Mobile Application SDK
    • Nutrition AI SDK Guide
  • REST API Guides
    • API Authorization & Setup
    • Token Usage & Response Headers
    • Food Database (REST API) Guide
    • AI & Nutrition Advisor REST API
  • Customized Meal Plan AI
Powered by GitBook
On this page
  • Overview
  • Authentication
  • Full Meal Plan Generation
  • Meal Plan Preview
  • Notes
  • Tips for Best Results
Export as PDF

Customized Meal Plan AI

a page dedicated to information on using the Meal Plan Generation routes

PreviousAI & Nutrition Advisor REST API

Last updated 11 days ago

Overview

  • Flexible input: Accepts free-form text, structured JSON (stringified), or both.

  • Macro flexibility: You may provide specific macro targets, or the API can calculate reasonable targets based on user profile data.

  • Intelligent memory: Optionally include a list of previous meal names to avoid or prioritize.

  • Two-step process: Use the fast preview endpoint to iterate quickly, then promote an approved preview into a fully calculated meal plan.

Authentication

All requests must include a valid Bearer token in the Authorization header.

Refer to the for how to obtain and manage your tokens.

Full Meal Plan Generation

POST /v2/products/sdk/tools/generateMealPlan

Input

{
  "content": "Generate a 3 day meal plan with high protein and optimized for muscle gain for a 33 year old average to athletic male"
}
  • content may contain natural language, structured data, or both. Include as much detail as you can.

  • Optionally include previous meal log info (names, preferences, etc).

Optional Query Params

  • model: the model used to generate meal ideas (default recommended model)

  • model2: the model used to refine and finalize individual days

Note: Using gemini-2-5-pro for both will improve results but increase cost.

Example: Python

import requests
import json

url = "https://api.passiolife.com/v2/products/sdk/tools/generateMealPlan"
payload = json.dumps({
  "content": "Generate a 3 day meal plan with high protein and optimized for muscle gain for a 33 year old average to athletic male"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_API_TOKEN_HERE'
}

response = requests.post(url, headers=headers, data=payload)
print(response.text)

As with all our API endpoints - if you have any further instructions or prompts you want to add as a system, you are free to add these in plain-language at the start, or and of your users input (preferably at the start). This can help guide us to tailore what we produce to your needs.

Meal Plan Preview

POST /v2/products/sdk/tools/generateMealPlanPreview

A faster endpoint (4–20 seconds typical) that returns only the daily meal names and a rejected: false status. Useful for user-driven feedback loops.

Sample Output

[
  {
    "day": 1,
    "meals": [
      {"mealName": "Protein Pancakes", "rejected": false},
      {"mealName": "Tuna Wrap", "rejected": false},
      {"mealName": "Chicken Stir Fry", "rejected": false}
    ]
  },
  ...
]

Users can reject individual meals (rejected: true) and resend the updated JSON to the same endpoint to regenerate only those items.

Once the preview is approved, send the entire preview JSON to the full generation endpoint to receive a fully calculated version.

Example: Python

import requests
import json

url = "https://api.passiolife.com/v2/products/sdk/tools/generateMealPlanPreveiw"
payload = json.dumps({
  "content": "Generate a 3 day meal plan with high protein and optimized for muscle gain for a 33 year old average to athletic male"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_API_TOKEN_HERE'
}

response = requests.post(url, headers=headers, data=payload)
print(response.text)

Notes

  • Average generation time (full): 1.5–6 minutes, depending on prompt complexity and model

  • Average preview time: 4–20 seconds

  • You can prepend instructions (e.g., internal app logic or strict constraints) to the user prompt if needed — these will be incorporated into processing


Tips for Best Results

  • Be specific about goals, diet types, allergies, meal preferences, and number of days

  • Include known liked/disliked recipes

  • Use preview route to rapidly iterate with users

  • Upgrade to advanced models only when necessary


Authorization Token Guide