{
  "openapi": "3.1.0",
  "info": {
    "title": "FitPulse API",
    "description": "Global fitness intelligence API. Evidence-based workout programming, nutrition science, supplement efficacy analysis, injury recovery protocols, race training plans, sleep optimization, plateau-breaking strategies, and physical rehabilitation. All content grounded in current sports science research. Serves athletes and fitness enthusiasts worldwide \u2014 supports any language via ?lang=. Pricing: $0.08\u2013$0.15 USDC/call via x402 micropayment on Base mainnet.",
    "version": "1.2.0",
    "contact": {
      "url": "https://fitpulse-vert.vercel.app"
    }
  },
  "servers": [
    {
      "url": "https://fitpulse-vert.vercel.app"
    }
  ],
  "components": {
    "securitySchemes": {
      "x402": {
        "type": "apiKey",
        "in": "header",
        "name": "PAYMENT-SIGNATURE",
        "description": "x402 payment signature. Omit to receive a 402 with payment requirements."
      }
    }
  },
  "paths": {
    "/api/fit/workout": {
      "get": {
        "summary": "Custom workout plan",
        "description": "Full weekly workout plan with exercises, sets, reps, rest, progression strategy, and Amazon gear links. Tailored to goal, equipment, fitness level, and days per week.",
        "operationId": "fitWorkout",
        "security": [
          {
            "x402": []
          }
        ],
        "parameters": [
          {
            "name": "goal",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "e.g. muscle-gain, fat-loss, strength, endurance, general-fitness"
          },
          {
            "name": "equipment",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "e.g. full gym, dumbbells-only, bodyweight (default: full gym)"
          },
          {
            "name": "level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "beginner",
                "intermediate",
                "advanced"
              ]
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 2,
              "maximum": 6
            },
            "description": "Days per week (default: 4)"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Weekly workout plan with exercises, progression, and gear list"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Pair with /api/fit/nutrition for fueling strategy; follow with /api/fit/supplement for evidence-based stack to support the goal; use /api/fit/recover before this if injury history is flagged"
      }
    },
    "/api/fit/exercise": {
      "get": {
        "summary": "Exercise form guide",
        "description": "Muscles worked, setup steps, execution cues, common mistakes with fixes, variations, programming for each level, and gear with Amazon links.",
        "operationId": "fitExercise",
        "security": [
          {
            "x402": []
          }
        ],
        "parameters": [
          {
            "name": "exercise",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "e.g. barbell-squat, push-up, romanian-deadlift, pull-up"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Exercise form guide with muscles, cues, mistakes, and variations"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.08,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Chain after /api/fit/workout for exercise substitutions or technique detail; pairs with /api/fit/recover for safer exercise selection post-injury"
      }
    },
    "/api/fit/nutrition": {
      "get": {
        "summary": "Macro and nutrition targets",
        "description": "Daily calorie and macro targets (protein/carbs/fat), meal timing strategy, pre/post-workout nutrition, high-priority foods, and a sample day.",
        "operationId": "fitNutrition",
        "security": [
          {
            "x402": []
          }
        ],
        "parameters": [
          {
            "name": "goal",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "e.g. muscle-gain, fat-loss, maintenance, athletic-performance"
          },
          {
            "name": "weight",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Body weight in lbs"
          },
          {
            "name": "activity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "sedentary",
                "lightly-active",
                "moderately-active",
                "very-active",
                "athlete"
              ]
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Macro targets with meal timing and food guidance"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Always pair with /api/fit/supplement \u2014 nutrition gaps often reveal supplementation needs; pairs with MealPulse /api/meal/plan for meal planning that hits nutrition targets"
      }
    },
    "/api/fit/supplement": {
      "get": {
        "summary": "Evidence-based supplement analysis",
        "description": "Tier 1 (strong evidence) and Tier 2 (moderate evidence) supplements with dose, timing, Amazon links, a skip list with reasons, and safety notes.",
        "operationId": "fitSupplement",
        "security": [
          {
            "x402": []
          }
        ],
        "parameters": [
          {
            "name": "goal",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "e.g. muscle-gain, fat-loss, endurance, recovery, general-health"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Supplement stack with tier ratings, dosing, and Amazon links"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.08,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Use after /api/fit/nutrition to identify supplementation gaps; pair with /api/fit/workout to time supplements around training sessions; /api/fit/supplements for deeper evidence-based efficacy grading"
      }
    },
    "/api/fit/recover": {
      "get": {
        "summary": "Injury recovery protocol",
        "description": "See-doctor flags, recovery timeline, 3-phase rehab protocol (acute/subacute/strengthening) with exercises, return-to-sport criteria, and prevention tips.",
        "operationId": "fitRecover",
        "security": [
          {
            "x402": []
          }
        ],
        "parameters": [
          {
            "name": "injury",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "e.g. sprained-ankle, pulled-hamstring, rotator-cuff, shin-splints, runners-knee"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Phased recovery protocol with exercises and return-to-sport criteria"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Highest value for injured athletes \u2014 follow with /api/fit/rehab for phased return-to-sport; pairs with MindPulse /api/mind/sleep if chronic fatigue is part of the recovery picture"
      }
    },
    "/api/fit/supplements": {
      "get": {
        "summary": "Evidence-graded supplement efficacy tier list by goal",
        "description": "PubMed-grounded supplement efficacy ranking by fitness goal. Returns a tiered list (Tier 1 = strong evidence, Tier 2 = moderate, Tier 3 = weak/inconclusive) with optimal dosing, timing, and interaction warnings. Covers creatine monohydrate, caffeine, beta-alanine, citrulline, protein, HMB, and 30+ common supplements. Budget-sensitive recommendations for high-value vs. expensive-but-marginal choices. Global: accounts for banned substances by sport federation (WADA) and regional regulatory status.",
        "operationId": "fitSupplementsEfficacy",
        "x-price-usd": 0.08,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Use as comprehensive reference; follow with /api/fit/supplement for personalized stack; pairs with /api/fit/nutrition for whole-diet supplementation strategy",
        "parameters": [
          {
            "name": "goal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Fitness goal (muscle-gain, fat-loss, endurance, recovery, general-health)"
          },
          {
            "name": "budget",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Monthly budget for supplements (e.g. $50, $100, $200)"
          },
          {
            "name": "restrictions",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Dietary restrictions or intolerances (vegan, lactose-free, etc.)"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Response language"
          }
        ],
        "responses": {
          "200": {
            "description": "Tiered supplement efficacy list with dosing, timing, and cost-effectiveness ratings"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/api/fit/rehab": {
      "get": {
        "summary": "Sports medicine rehabilitation protocol",
        "description": "Phased return-to-sport rehabilitation protocol for common sports injuries. Provides progressive exercise stages (acute phase, sub-acute, strength restoration, sport-specific, return-to-play), clear progression criteria between phases, red flag symptoms requiring immediate medical attention, and safe cross-training alternatives during each phase. Covers: ACL/MCL/PCL, rotator cuff, hamstring, Achilles, plantar fasciitis, shin splints, stress fractures, tennis/golfer's elbow, and IT band syndrome. Evidence-based timelines by injury severity.",
        "operationId": "fitRehab",
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Use after /api/fit/recover for more detailed phased protocol; pairs with /api/fit/exercise for safe exercise substitutions during rehab phases; follow with /api/fit/workout when return-to-sport phase is reached",
        "parameters": [
          {
            "name": "injury",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Injury description (e.g. ACL tear, rotator cuff strain, Achilles tendinopathy)"
          },
          {
            "name": "sport",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Target sport or activity for return-to-sport phase"
          },
          {
            "name": "fitness_level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Pre-injury fitness level (recreational, competitive, elite)"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Response language"
          }
        ],
        "responses": {
          "200": {
            "description": "Phased rehabilitation protocol with progression criteria and return-to-sport timeline"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/api/fit/sleep": {
      "get": {
        "summary": "Athletic sleep optimization and CBT-I protocol",
        "description": "Sleep science-based guidance for athletes and active individuals. Covers sleep architecture impact on recovery (deep sleep = HGH release, REM = motor learning consolidation), sleep hygiene protocol, circadian rhythm optimization for training timing, travel/jet-lag management for competing athletes, CBT-I (Cognitive Behavioral Therapy for Insomnia) techniques clinically proven to outperform sleep medication, and pre-competition anxiety management. Quantifies sleep debt impact on performance: each hour of deficit reduces reaction time, strength output, and injury risk. Global: accounts for time zone strategies for international competition travel.",
        "operationId": "fitSleep",
        "x-price-usd": 0.08,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Pairs with MindPulse /api/mind/sleep for clinical insomnia; pairs with /api/fit/recover \u2014 sleep is the highest-leverage recovery intervention; follow with /api/fit/supplement for evidence-based sleep supplements (magnesium, tart cherry, etc.)",
        "parameters": [
          {
            "name": "issue",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Sleep issue (e.g. trouble falling asleep, early waking, poor recovery despite sleep, jet-lag)"
          },
          {
            "name": "training_schedule",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Training schedule context (e.g. morning workouts, evening training, two-a-days)"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Response language"
          }
        ],
        "responses": {
          "200": {
            "description": "Athletic sleep optimization protocol with CBT-I techniques and recovery-focused guidance"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/api/fit/plateau": {
      "get": {
        "summary": "Training plateau analysis and breakthrough protocol",
        "description": "Diagnoses why a fitness plateau is occurring and builds a specific breakthrough protocol. Covers the most common causes: accommodation (need new stimulus), metabolic adaptation (caloric deficit stall requiring diet break or refeed), overtraining (requires deload), sleep debt, and stress-cortisol interference. Returns a structured 4-week plateau-breaking plan with specific changes to training variables (volume, intensity, frequency, exercise selection, rest periods) and nutrition adjustments. Supports muscle gain, fat loss, strength, and endurance plateau scenarios.",
        "operationId": "fitPlateau",
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Use when /api/fit/workout is not producing results; pairs with /api/fit/nutrition \u2014 most plateaus have a nutrition component; follow with /api/fit/supplement for additional stimulus",
        "parameters": [
          {
            "name": "goal",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Goal that has plateaued (muscle-gain, fat-loss, strength, endurance, body-recomposition)"
          },
          {
            "name": "duration",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "How long the plateau has lasted (e.g. 6 weeks, 3 months)"
          },
          {
            "name": "current_routine",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Brief description of current training and diet approach"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Response language"
          }
        ],
        "responses": {
          "200": {
            "description": "Plateau diagnosis with specific 4-week breakthrough protocol for training and nutrition"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/api/fit/race": {
      "get": {
        "summary": "Race training plan built backwards from event date",
        "description": "Periodized race training plan customized to event type, target date, and current fitness level. Supports: 5K, 10K, half marathon, marathon, ultramarathon, triathlon (sprint/Olympic/Ironman), obstacle course races (OCR/Spartan), cycling sportives, and open-water swims. Builds backwards from race date with base building, build phase, peak, taper, and race-week protocols. Includes: weekly mileage/volume progressions, key workout types by phase, fueling strategy for long efforts, and race-day execution plan (pacing, nutrition, hydration). Global: references major international race events and training conditions for different climates.",
        "operationId": "fitRace",
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Follow with /api/fit/nutrition for race-specific fueling strategy; pairs with /api/fit/supplement for endurance-specific stack (electrolytes, caffeine, carbohydrate timing); /api/fit/sleep for taper-week sleep protocol",
        "parameters": [
          {
            "name": "race_type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Race type (5K, 10K, half-marathon, marathon, triathlon-sprint, triathlon-olympic, ironman, OCR)"
          },
          {
            "name": "race_date",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Race date (YYYY-MM-DD) \u2014 plan is built backwards from this date"
          },
          {
            "name": "current_fitness",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Current fitness level and recent training context"
          },
          {
            "name": "runs_per_week",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Available training days per week"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Response language"
          }
        ],
        "responses": {
          "200": {
            "description": "Periodized race training plan with phase breakdown, taper, and race-day execution strategy"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    }
  }
}