{
  "openapi": "3.1.0",
  "info": {
    "title": "LongevityPulse API",
    "description": "Global longevity intelligence API — biomarker interpretation, supplement evidence, personalized protocols, clinical trials, Blue Zone research, WHO country longevity profiles, epigenetic clocks, dietary analysis, longevity drug intelligence, and global clinic guides. All endpoints require x402 payment (USDC on Base mainnet) via the PAYMENT-SIGNATURE header.",
    "version": "1.0.0",
    "contact": { "url": "https://longevitypulse.vercel.app" }
  },
  "servers": [{ "url": "https://longevitypulse.vercel.app" }],
  "components": {
    "securitySchemes": {
      "x402": {
        "type": "apiKey",
        "in": "header",
        "name": "PAYMENT-SIGNATURE",
        "description": "x402 payment signature. Send GET without this header to receive 402 with payment requirements. Sign and retry.",
        "required": true
      }
    }
  },
  "security": [{ "x402": [] }],
  "paths": {
    "/api/longevity/biomarker": {
      "get": {
        "summary": "Biomarker interpretation through longevity science lens",
        "description": "Interpret any lab value with longevity-optimized reference ranges (beyond standard clinical ranges), aging significance, lifestyle interventions, supplement evidence, and testing recommendations. Covers 50+ biomarkers including ApoB, HbA1c, hs-CRP, homocysteine, testosterone, IGF-1, Lp(a), ferritin, vitamin D.",
        "operationId": "getBiomarker",
        "parameters": [
          { "name": "biomarker", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Biomarker name — e.g. ApoB | hs-CRP | HbA1c | testosterone | IGF-1 | homocysteine | Lp(a) | ferritin | vitamin D | DHEA-S" },
          { "name": "value", "in": "query", "schema": { "type": "string" }, "description": "Lab result with unit — e.g. 85 mg/dL | 2.1 mg/L | 5.4% | 420 ng/dL (optional — enables personalized assessment)" },
          { "name": "lang", "in": "query", "schema": { "type": "string" }, "description": "Response language: en|es|fr|de|ja|zh|ko|pt|ar|hi (default: en)" }
        ],
        "responses": { "200": { "description": "Biomarker intelligence JSON" }, "402": { "description": "Payment required — $0.15 USDC" } },
        "x-price-usdc": 0.15, "x-model": "claude-haiku-4-5-20251001",
        "x-data-sources": ["PubMed E-utilities API", "Tavily"]
      }
    },
    "/api/longevity/supplement-intel": {
      "get": {
        "summary": "Evidence-graded longevity supplement intelligence",
        "description": "Rigorous analysis of any longevity compound — mechanism, evidence grade (human RCT vs animal vs theoretical), dosing, safety, drug interactions, global availability. Covers NMN, NR, berberine, spermidine, urolithin A, fisetin, quercetin, AKG, resveratrol, taurine. Expert positions from Attia, Sinclair, Johnson, Kaeberlein.",
        "operationId": "getSupplementIntel",
        "parameters": [
          { "name": "compound", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Compound name — e.g. NMN | NR | berberine | spermidine | urolithin A | fisetin | quercetin | alpha-ketoglutarate | resveratrol | taurine" },
          { "name": "lang", "in": "query", "schema": { "type": "string" }, "description": "Response language (default: en)" }
        ],
        "responses": { "200": { "description": "Supplement intelligence JSON" }, "402": { "description": "Payment required — $0.20 USDC" } },
        "x-price-usdc": 0.20, "x-model": "claude-sonnet-4-6",
        "x-data-sources": ["PubMed E-utilities API", "OpenFDA", "Tavily"]
      }
    },
    "/api/longevity/protocol-builder": {
      "get": {
        "summary": "Personalized longevity protocol — exercise, nutrition, sleep, supplements",
        "description": "Build a personalized longevity protocol by age, sex, goals, and budget. Covers Zone 2, strength, VO2 max, time-restricted eating, protein targets, sleep optimization, hormesis (sauna/cold), supplement tiers, and biomarker tracking. Adapts to global food cultures. Based on Peter Attia, Bryan Johnson Blueprint, David Sinclair, Valter Longo frameworks.",
        "operationId": "getProtocolBuilder",
        "parameters": [
          { "name": "age", "in": "query", "required": true, "schema": { "type": "integer" }, "description": "Age in years — e.g. 35 | 52 | 65" },
          { "name": "sex", "in": "query", "schema": { "type": "string" }, "description": "Biological sex — male | female" },
          { "name": "goals", "in": "query", "schema": { "type": "string" }, "description": "Longevity goals — e.g. maximize healthspan | cardiovascular health | cognitive longevity | muscle preservation | reverse biological age" },
          { "name": "conditions", "in": "query", "schema": { "type": "string" }, "description": "Health conditions — e.g. type 2 diabetes | hypertension | none" },
          { "name": "budget", "in": "query", "schema": { "type": "string" }, "description": "Budget level — low | moderate | high | $200/month" },
          { "name": "lang", "in": "query", "schema": { "type": "string" }, "description": "Response language (default: en)" }
        ],
        "responses": { "200": { "description": "Personalized longevity protocol JSON" }, "402": { "description": "Payment required — $0.25 USDC" } },
        "x-price-usdc": 0.25, "x-model": "claude-sonnet-4-6",
        "x-data-sources": ["PubMed E-utilities API", "Tavily"]
      }
    },
    "/api/longevity/clinical-trials": {
      "get": {
        "summary": "Search active longevity clinical trials globally from ClinicalTrials.gov",
        "description": "Find active longevity and anti-aging trials by condition or intervention. Includes eligibility criteria, locations across 220+ countries, how to apply. Covers PEARL (rapamycin), TAME (metformin), NMN, senolytics, caloric restriction trials, and all aging interventions.",
        "operationId": "getClinicalTrials",
        "parameters": [
          { "name": "condition", "in": "query", "schema": { "type": "string" }, "description": "Condition or intervention — e.g. aging | rapamycin | metformin | NMN | senolytics | caloric restriction | Alzheimer prevention" },
          { "name": "recruiting_only", "in": "query", "schema": { "type": "boolean" }, "description": "Show only recruiting trials (default: true)" },
          { "name": "lang", "in": "query", "schema": { "type": "string" }, "description": "Response language (default: en)" }
        ],
        "responses": { "200": { "description": "Clinical trials intelligence JSON" }, "402": { "description": "Payment required — $0.10 USDC" } },
        "x-price-usdc": 0.10, "x-model": "claude-haiku-4-5-20251001",
        "x-data-sources": ["ClinicalTrials.gov API v2 (free, no key)", "Tavily"]
      }
    },
    "/api/longevity/blue-zone": {
      "get": {
        "summary": "Blue Zone intelligence — world longevity hotspots deep-dive",
        "description": "Comprehensive intelligence on Blue Zone centenarian communities. Diet, lifestyle, genetics vs lifestyle breakdown, social fabric, modern threats, and globally applicable lessons. Covers Okinawa, Sardinia, Ikaria, Nicoya, Loma Linda, and emerging candidates.",
        "operationId": "getBlueZone",
        "parameters": [
          { "name": "zone", "in": "query", "schema": { "type": "string" }, "description": "Blue Zone or region — e.g. Okinawa | Sardinia | Ikaria | Nicoya | Loma Linda | Blue Zones overview | Hunza | Vilcabamba" },
          { "name": "lang", "in": "query", "schema": { "type": "string" }, "description": "Response language (default: en)" }
        ],
        "responses": { "200": { "description": "Blue Zone intelligence JSON" }, "402": { "description": "Payment required — $0.10 USDC" } },
        "x-price-usdc": 0.10, "x-model": "claude-haiku-4-5-20251001",
        "x-data-sources": ["PubMed E-utilities API", "Tavily"]
      }
    },
    "/api/longevity/country-longevity": {
      "get": {
        "summary": "WHO country longevity profile — life expectancy, HALE, healthcare, initiatives",
        "description": "Comprehensive longevity profile for any of 195+ countries: WHO life expectancy and healthy life expectancy (HALE), healthspan gap, top causes of premature death, healthcare quality for aging, government longevity initiatives, and practical advice for residents and expats.",
        "operationId": "getCountryLongevity",
        "parameters": [
          { "name": "country", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Country name — e.g. Japan | Singapore | Spain | South Korea | Switzerland | Costa Rica | Australia | United States | India | Nigeria" },
          { "name": "lang", "in": "query", "schema": { "type": "string" }, "description": "Response language (default: en)" }
        ],
        "responses": { "200": { "description": "Country longevity profile JSON" }, "402": { "description": "Payment required — $0.12 USDC" } },
        "x-price-usdc": 0.12, "x-model": "claude-haiku-4-5-20251001",
        "x-data-sources": ["WHO Global Health Observatory API (free, no key)", "Tavily"]
      }
    },
    "/api/longevity/epigenetic-clock": {
      "get": {
        "summary": "Epigenetic aging clocks — biological age science, testing, and reversal",
        "description": "Deep intelligence on epigenetic aging: all major clocks (GrimAge, DunedinPACE, Horvath, PhenoAge), what accelerates or decelerates biological aging, consumer testing options with global availability, and cutting-edge reprogramming research (Yamanaka factors, Altos Labs, NewLimit).",
        "operationId": "getEpigeneticClock",
        "parameters": [
          { "name": "topic", "in": "query", "schema": { "type": "string" }, "description": "Topic — e.g. GrimAge | DunedinPACE | biological age overview | how to reverse biological aging | epigenetic reprogramming | how to test biological age" },
          { "name": "lang", "in": "query", "schema": { "type": "string" }, "description": "Response language (default: en)" }
        ],
        "responses": { "200": { "description": "Epigenetic clock intelligence JSON" }, "402": { "description": "Payment required — $0.20 USDC" } },
        "x-price-usdc": 0.20, "x-model": "claude-sonnet-4-6",
        "x-data-sources": ["PubMed E-utilities API", "Tavily"]
      }
    },
    "/api/longevity/diet-intel": {
      "get": {
        "summary": "Evidence-graded dietary analysis for longevity and healthspan",
        "description": "Rigorous longevity evidence for any dietary pattern: mechanisms (SIRT1, mTOR, autophagy), evidence grade, macronutrient profile, global cultural adaptations (Asian, Latin American, Middle Eastern, African), and expert positions from Valter Longo, Peter Attia, Walter Willett.",
        "operationId": "getDietIntel",
        "parameters": [
          { "name": "diet", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Diet pattern — e.g. Mediterranean | time-restricted eating | fasting mimicking diet | Blue Zone plant-based | MIND diet | caloric restriction | ketogenic | Japanese traditional" },
          { "name": "lang", "in": "query", "schema": { "type": "string" }, "description": "Response language (default: en)" }
        ],
        "responses": { "200": { "description": "Dietary longevity intelligence JSON" }, "402": { "description": "Payment required — $0.15 USDC" } },
        "x-price-usdc": 0.15, "x-model": "claude-haiku-4-5-20251001",
        "x-data-sources": ["PubMed E-utilities API", "Tavily"]
      }
    },
    "/api/longevity/longevity-drug": {
      "get": {
        "summary": "Pharmaceutical longevity intelligence — rapamycin, metformin, senolytics",
        "description": "Evidence-graded analysis of any longevity pharmaceutical: ITP animal lifespan data, human RCT evidence, off-label longevity dosing, safety profile, global prescription availability by country, and how to discuss with a physician. Covers rapamycin, metformin, acarbose, senolytics (dasatinib, quercetin, fisetin), SGLT2 inhibitors, GLP-1 agonists.",
        "operationId": "getLongevityDrug",
        "parameters": [
          { "name": "drug", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Drug name — e.g. rapamycin | metformin | acarbose | dasatinib | fisetin | senolytics | empagliflozin | semaglutide" },
          { "name": "lang", "in": "query", "schema": { "type": "string" }, "description": "Response language (default: en)" }
        ],
        "responses": { "200": { "description": "Longevity drug intelligence JSON" }, "402": { "description": "Payment required — $0.20 USDC" } },
        "x-price-usdc": 0.20, "x-model": "claude-sonnet-4-6",
        "x-data-sources": ["PubMed E-utilities API", "OpenFDA", "Tavily"]
      }
    },
    "/api/longevity/longevity-clinic": {
      "get": {
        "summary": "Global longevity clinic guide — destinations, treatments, red flags",
        "description": "Comprehensive global guide to longevity clinics and medical tourism: top destinations (Switzerland, Panama, Mexico, Thailand, Singapore, Israel), clinic profiles, treatment evidence grades, red flags to avoid, and cost ranges. Honest about what has evidence vs what is experimental.",
        "operationId": "getLongevityClinic",
        "parameters": [
          { "name": "country", "in": "query", "schema": { "type": "string" }, "description": "Country to research — e.g. Switzerland | Panama | Mexico | Thailand | Singapore | Israel | Germany | Japan | Colombia" },
          { "name": "treatment", "in": "query", "schema": { "type": "string" }, "description": "Treatment of interest — e.g. stem cell therapy | NAD+ IV | peptide therapy | hyperbaric oxygen | plasmapheresis | ozone therapy" },
          { "name": "lang", "in": "query", "schema": { "type": "string" }, "description": "Response language (default: en)" }
        ],
        "responses": { "200": { "description": "Longevity clinic intelligence JSON" }, "402": { "description": "Payment required — $0.12 USDC" } },
        "x-price-usdc": 0.12, "x-model": "claude-haiku-4-5-20251001",
        "x-data-sources": ["Tavily"]
      }
    }
  }
}
