Longevity.haus

Longevity.haus API Reference

Public read-only endpoints for agents, integrators, and search indexes. All responses are JSON unless otherwise noted. No auth required. 60 req/min/IP rate limit enforced at the Cloudflare edge.

Quickstart

curl

# List the full treatment catalog
curl https://longevity.haus/api/treatments.json

# Fetch search index (all locations, min prices, treatment names)
curl https://longevity.haus/api/search-data

# Get EUR-base FX rates (1-hour cached, stale-on-error)
curl https://longevity.haus/api/exchange-rates

# Liveness probe
curl https://longevity.haus/api/health

Python (requests)

import requests

r = requests.get("https://longevity.haus/api/search-data", timeout=10)
r.raise_for_status()
data = r.json()

print(f"Loaded {len(data['locations'])} locations, "
      f"{len(data['minPricesByCompany'])} clinics with price data.")

TypeScript (fetch)

type TreatmentCatalog = {
  generatedAt: string;
  categories: Array<{ name: string; types: unknown[] }>;
  biomarkers: unknown[];
  meta: { totalBiomarkers: number; totalCategories: number };
};

const res = await fetch("https://longevity.haus/api/treatments.json");
if (!res.ok) {
  const { error } = await res.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const catalog: TreatmentCatalog = await res.json();

MCP (Claude Desktop, ChatGPT, Cursor)

# In claude_desktop_config.json
{
  "mcpServers": {
    "longevity-haus": {
      "url": "https://longevity.haus/api/mcp"
    }
  }
}

Authentication

All public read endpoints are unauthenticated. The data is the same data that powers the public web UI and is meant to be indexed, quoted, and presented by AI assistants.

There is no programmatic API token system today. Human users sign in via Better Auth (Google / GitHub OAuth, session cookies) — this is not suitable for headless agent use. For partner access (writes, analytics, bulk data), email [email protected].

Full details: /docs/agent-auth.

Endpoints

PathPurposeCache
/api/treatments.jsonCategories, biomarkers, service stats.5 min + swr 1h
/api/search-dataLocations, min prices by company, treatment names.2 min + swr 10m
/api/exchange-ratesEUR-base FX rates via Frankfurter, stale-on-error.1 hr + s-max 1h
/api/healthLiveness probe — Convex reachability + timestamp.no-store
/api/mcpMCP 1.0 JSON-RPC server (7 read-only tools).
/openapi.yamlThis spec — full schema, rendered below.1 hr + swr 24h

Error envelope

All four public read endpoints return a uniform error shape on failure. Agents should branch on error.code for retry logic.

{
  "error": {
    "code": "database_unavailable",
    "message": "The treatment catalog database is temporarily unreachable.",
    "hint": "Retry after a short backoff; state is usually restored within 30 seconds."
  }
}

Codes: database_unavailable, upstream_unavailable, invalid_query, not_found, rate_limited, internal_error. The MCP server at /api/mcp uses JSON-RPC 2.0 error codes (-32600..-32603, -32601) instead.

Pagination & cursors

The MCP server's list_treatments, search_clinics, and get_treatment tools return opaque base64 cursors in meta.nextCursor. Pass that string back as cursor on the next call. Malformed cursors return JSON-RPC -32602 (invalid params). The REST endpoints return complete datasets; they do not paginate.

Rate limits

60 requests / minute / IP, enforced at the Cloudflare WAF. All public API responses carry advisory headers: RateLimit-Policy: 60;w=60, X-RateLimit-Limit: 60, X-RateLimit-Window: 60. Burst-tolerant — retry with exponential backoff on 429.

Content-negotiated markdown

Send Accept: text/markdown on the following routes for a data-sourced markdown rendering instead of HTML: /, /provider/{slug}, /best/{treatment}/{city}, /{treatment}, /{treatment}/{alpha2}/{city}.

curl -H "Accept: text/markdown" \
  https://longevity.haus/provider/super-young-melbourne

MCP server

JSON-RPC 2.0 server at /api/mcp, Streamable HTTP transport. Seven read-only tools: list_treatments, get_clinic, get_treatment, search_clinics, get_price_index, search, fetch. Server card at /.well-known/mcp/server-card.json.

curl -X POST https://longevity.haus/api/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Full OpenAPI spec

The interactive viewer below loads the live openapi.yaml via the Scalar reference. For IDE autocomplete / code generation, point your tooling at https://longevity.haus/openapi.yaml.

Also useful