Thrive X DNA Fitness & Nutrition API Documentation

Complete documentation for the Thrive X DNA Fitness & Nutrition API, including all endpoints, request parameters, and response formats.

Introduction

The Thrive X DNA Fitness & Nutrition API is designed to empower developers, fitness enthusiasts, and health professionals with cutting-edge tools for personalized fitness and nutrition management. Powered by advanced AI through Anthropic and OpenAI integration, this API offers a suite of endpoints to generate tailored workout plans, detailed exercise information, comprehensive nutrition advice, custom meal plans, food plate analysis, food ingredient details, and natural remedies. Whether you're building a fitness app, optimizing your own training, or exploring dietary options, our API provides flexible, data-driven solutions. Key features include support for diverse fitness goals, dietary preferences (e.g., carnivore, vegan), real-time nutritional analysis, ingredient breakdowns, and natural health solutions, all accessible via a RESTful interface returning JSON data.

Authentication

To access the Thrive X DNA Fitness & Nutrition API, every request must include an API key in the header. This key is provided upon subscription and ensures secure access to our services. For certain administrative routes (e.g., `/admin` endpoints), additional authentication via Supabase tokens is required, which is handled server-side for authorized users only.

X-API-Key: your_api_key_here

To obtain an API key, subscribe to one of our plans (see Rate Limits below) or contact support@thrivexdna.com for assistance.

Rate Limits

The Thrive X DNA Fitness & Nutrition API enforces rate limits based on your subscription tier to ensure fair usage and optimal performance. Exceeding these limits results in a 429 Too Many Requests response. Below are the available subscription tiers with their monthly request quotas, additional per-request costs, and rate limits:

Tier Cost Requests/Month Additional Cost Rate Limit
Core $14.99/mo 500 $0.04/request 1 request/second
Elite $49.00/mo 15,000 $0.025/request 3 requests/second
$129.00/mo 75,000 $0.015/request 20 requests/second

Notes: Higher tiers (Core, Elite, Ultimate) allow additional requests beyond the monthly quota at the specified rates. Rate limits are enforced per API key. For custom plans or Ultimate solutions, contact support@thrivexdna.com.

POST /api/fitness/workout

Create a personalized workout plan based on your goals, fitness level, and preferences. This endpoint uses Anthropic's AI models for generating workout plans.

Request Parameters

Parameter Type Required Description
goals string Yes Fitness goals (e.g., "endurance", "strength", "weight_loss")
fitnessLevel string Yes Fitness level (e.g., "beginner", "intermediate", "advanced")
preferences array No Exercise preferences (e.g., ["weight_training", "cardio", "yoga"])
bodyFocus string No Body focus area (e.g., "upper_body", "lower_body", "full_body")
muscleGroups array No Target muscle groups (e.g., ["chest", "legs"])
includeWarmupCooldown boolean No Include warmup and cooldown (default: false)
daysPerWeek integer Yes Days per week (1-7)
sessionDuration integer Yes Session duration in minutes (e.g., 90)
planDurationWeeks integer Yes Plan duration in weeks (e.g., 3)

Example Request

{ "goals": "endurance", "fitnessLevel": "intermediate", "preferences": ["weight_training", "cardio", "hiit", "bodyweight", "yoga"], "bodyFocus": "full_body", "muscleGroups": ["legs", "core"], "includeWarmupCooldown": true, "daysPerWeek": 5, "sessionDuration": 90, "planDurationWeeks": 3 }

Example Response

{ "success": true, "data": { "name": "Endurance Hybrid Plan", "goals": "endurance", "fitnessLevel": "intermediate", "daysPerWeek": 5, "planDurationWeeks": 3, "days": [ { "name": "Week 1 - Monday - Cardio & Weight Training", "sessionDuration": "90 minutes", "exercises": [ {"name": "Treadmill Running (Moderate Pace)", "sets": 1, "reps": "30 min", "restSeconds": 0, "muscleGroup": "legs"}, {"name": "Dumbbell Lunges", "sets": 3, "reps": 12, "restSeconds": 60, "muscleGroup": "legs"}, {"name": "Kettlebell Swings", "sets": 3, "reps": 15, "restSeconds": 60, "muscleGroup": "core"}, {"name": "Cool-Down Jog", "sets": 1, "reps": "15 min", "restSeconds": 0, "muscleGroup": "legs"} ] }, { "name": "Week 1 - Tuesday - HIIT & Bodyweight", "sessionDuration": "90 minutes", "exercises": [ {"name": "Sprint Intervals (30s sprint, 90s walk)", "sets": 10, "reps": "2 min cycle", "restSeconds": 0, "muscleGroup": "legs"}, {"name": "Burpees", "sets": 4, "reps": 15, "restSeconds": 45, "muscleGroup": "full_body"}, {"name": "Mountain Climbers", "sets": 4, "reps": "45s", "restSeconds": 45, "muscleGroup": "core"}, {"name": "Bodyweight Squats", "sets": 3, "reps": 20, "restSeconds": 60, "muscleGroup": "legs"} ] } ] } }
POST /api/fitness/exercise

Get detailed information about a specific exercise, including proper form and target muscles. This endpoint uses Anthropic's AI models for providing exercise details.

Request Parameters

Parameter Type Required Description
exerciseId string Yes Name of the exercise (e.g., "Squat")
includeVariations boolean No Include exercise variations (default: false)

Example Request

{ "exerciseId": "Squat", "includeVariations": true }

Example Response

{ "success": true, "data": { "name": "Squat", "muscleGroups": ["Quadriceps", "Glutes", "Hamstrings"], "equipment": "Barbell or Bodyweight", "instructions": "Stand with feet shoulder-width apart, lower your hips...", "difficulty": "Intermediate", "tips": ["Keep back straight", "Knees over toes", "Engage core"], "variations": ["Front Squat", "Goblet Squat"] } }
POST /api/fitness/meal-plan

Get personalized nutrition advice and a custom meal plan tailored to your goals, preferences, and needs. This endpoint uses Anthropic's AI models for generating nutrition and meal plans.

Request Parameters

Parameter Type Required Description
goals string Yes Nutrition goals (e.g., "muscle_gain", "weight_loss")
dietType string Yes Diet type (e.g., "vegetarian", "carnivore", "vegan")
gender string Yes Gender (e.g., "male", "female")
age integer Yes Age in years
weight number Yes Weight in kg
heightCm number Yes Height in cm
activityLevel string Yes Activity level (e.g., "sedentary", "lightly", "active")
allergies array No Allergies (e.g., ["peanuts", "gluten"])
religiousPreferences string No Religious dietary preferences (e.g., "halal", "kosher", "none")
calorieTarget integer Yes Daily calorie target (e.g., 3500)
mealsPerDay integer Yes Meals per day (e.g., 6)
numberOfDays integer Yes Number of days for the plan (e.g., 7)

Example Request

{ "goals": "muscle_gain", "dietType": "vegetarian", "gender": "male", "age": 32, "weight": 112.49, "heightCm": 193.04, "activityLevel": "lightly", "allergies": ["peanuts", "dairy", "gluten", "shellfish", "soy", "tree nuts"], "religiousPreferences": "halal", "calorieTarget": 3500, "mealsPerDay": 6, "numberOfDays": 7 }

Example Response

{ "success": true, "data": { "macros": {"protein": 245, "fat": 117, "carbs": 377, "totalCalories": 3500}, "recommendations": { "general": "To support muscle gain on a vegetarian, halal diet, focus on high-protein plant-based sources...", "keyPoints": [ "Prioritize halal-certified legumes, quinoa, and seeds for protein.", "Use gluten-free grains like rice and oats for carbs.", "Incorporate olive oil and avocado for allergen-free fats." ], "mealPlan": [ { "day": "Day 1", "meals": [ {"mealName": "Breakfast", "foods": [ {"name": "Oatmeal (Gluten-Free) with Chia Seeds", "calories": 600, "protein": 20, "fat": 20, "carbs": 90} ]}, {"mealName": "Dinner", "foods": [ {"name": "Lentil Curry with Brown Rice", "calories": 750, "protein": 30, "fat": 20, "carbs": 105} ]} ] } ] } } }
POST /api/fitness/analyzeFoodPlate

Upload an image of your food plate to analyze its nutritional content. This endpoint uses OpenAI's AI models for food image analysis.

Request Parameters (FormData)

Parameter Type Required Description
food_image file Yes Image file of the food plate
cooking_oil string No Optional cooking oil type (e.g., "olive_oil")

Example Request

Content-Type: multipart/form-data X-API-Key: your_api_key_here Body: - food_image: [file] - cooking_oil: "olive_oil"

Example Response

{ "success": true, "data": { "title": "Food Plate Analysis", "foods": [ {"name": "Grilled Chicken", "calories": 200, "protein": 30, "fat": 5, "carbs": 0}, {"name": "Steamed Broccoli", "calories": 50, "protein": 3, "fat": 0, "carbs": 10} ] } }
POST /api/fitness/food-ingredient

Explore detailed information about food ingredients, chemicals, and label items, including definitions, layman's terms, production methods, and usage examples. This endpoint uses Anthropic's AI models for generating food ingredient information.

Request Parameters

Parameter Type Required Description
ingredient string Yes Name of the ingredient to search (e.g., "Ascorbic Acid")

Example Request

{ "ingredient": "Ascorbic Acid" }

Example Response

{ "success": true, "data": { "name": "Ascorbic Acid", "category": "Vitamin", "origin": "Synthetic or natural (e.g., citrus fruits)", "safety_rating": "Generally Recognized as Safe (GRAS)", "definition": "A water-soluble vitamin (C6H8O6) essential for collagen synthesis and antioxidant activity.", "layman_term": "Vitamin C - keeps your skin healthy and fights off colds.", "production_process": "Synthesized from glucose via fermentation or chemical processes.", "example_use": "Added to orange juice to boost vitamin content." } }
POST /api/fitness/natural-remedies

Get natural remedy variations for a specific symptom, including efficacy ratings, ingredients, and preparation steps. This endpoint uses Anthropic's AI models for generating natural remedy information.

Important Medical Disclaimer: These remedies and approaches are provided for informational purposes only and are not intended to diagnose, treat, cure, or prevent any disease. They represent traditional or alternative perspectives that have not been evaluated by the FDA.

Always consult qualified healthcare professionals for medical conditions, especially for serious conditions like cancer, diabetes, heart disease, and other chronic or acute medical concerns. Never delay seeking or disregard professional medical advice because of something you read through our Services.

See our full Medical Disclaimer for more information.

Request Parameters

Parameter Type Required Description
symptom string Yes Symptom to find remedies for (e.g., "Headache")
approach string No Specific approach type (e.g., "comprehensive", "dietary", "herbs")

Example Request

{ "symptom": "Headache", "approach": "comprehensive" }

Example Response

{ "success": true, "data": { "symptom": "Headache", "remedies": [ { "name": "Peppermint Oil Massage", "source": "Herbal", "ingredients": [ {"name": "Peppermint Oil", "amount": "2-3 drops"} ], "preparation": ["Dilute with a carrier oil", "Massage onto temples"], "usage": "Apply every 4-6 hours", "warnings": ["Avoid eye contact", "Test for skin sensitivity"] } ], "dietary_approach": { "overview": "Dietary adjustments can help prevent headaches by stabilizing blood sugar and reducing inflammation.", "recommendations": [ "Stay hydrated with at least 2-3 liters of water daily", "Reduce refined sugar and processed foods" ] } } }

Code Examples

JavaScript / Node.js

const fetch = require('node-fetch'); const apiKey = 'your_api_key_here'; const url = 'https://yourdomain.com/api/fitness/food-ingredient'; const requestData = { "ingredient": "Sugar" }; fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': apiKey }, body: JSON.stringify(requestData) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));

Python

import requests api_key = 'your_api_key_here' url = 'https://yourdomain.com/api/fitness/food-ingredient' headers = { 'Content-Type': 'application/json', 'X-API-Key': api_key } request_data = { 'ingredient': 'Sugar' } response = requests.post(url, headers=headers, json=request_data) data = response.json() print(data)

Sample Nutritional Breakdown Visualization

Below is an example of how the API's nutritional data (e.g., from /api/fitness/analyzeFoodPlate) could be visualized:

Sample Meal Nutrition Breakdown

Support

For additional help, contact support at support@thrivexdna.com.