> ## Documentation Index
> Fetch the complete documentation index at: https://foreverbetter.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a custom health dashboard

> Go from raw multimodal data to a styled, render-ready dashboard in five calls.

Turn a user's labs and wearable data into a dashboard your app can render
(cards, scores, and a design system to style them) without building any
analysis logic yourself.

| Step                        | Endpoint                             |
| --------------------------- | ------------------------------------ |
| Upload data                 | `POST /imports/file`                 |
| Run one multimodal analysis | `POST /analyses`                     |
| Read the render-ready spec  | `GET /dashboard-specs/{id}`          |
| Pull recommendations        | `GET /analyses/{id}/recommendations` |
| Style it                    | `GET /design/systems/{id}`           |

```bash theme={null}
export FB_API="https://api.foreverbetter.xyz"
export FB_KEY="…"   # a key from the dashboard
export UID="user_123"  ORG="org_123"
```

## 1. Upload the user's data

Upload each modality; capture the returned `source.id`.

```bash theme={null}
LABS=$(curl -s -X POST "$FB_API/imports/file" -H "authorization: Bearer $FB_KEY" \
  -H "content-type: application/json" -d '{
    "user_id":"'$UID'","organization_id":"'$ORG'","category":"biomarkers",
    "filename":"labs.csv","content_type":"text/csv",
    "text":"marker,value,unit\nApoB,118,mg/dL\nHbA1c,5.7,%\nHDL-C,44,mg/dL\nVitamin D,24,ng/mL"
  }' | jq -r .source.id)

WEAR=$(curl -s -X POST "$FB_API/imports/file" -H "authorization: Bearer $FB_KEY" \
  -H "content-type: application/json" -d '{
    "user_id":"'$UID'","organization_id":"'$ORG'","category":"wearables",
    "filename":"wearables.csv","content_type":"text/csv",
    "text":"metric,value,unit\nsleep_duration,6.8,hours\nhrv,41,ms\nresting_heart_rate,61,bpm"
  }' | jq -r .source.id)
```

## 2. Run one multimodal analysis

`POST /analyses` combines every source for the user into a single analysis with a
healthspan score and a dashboard spec.

```bash theme={null}
AN=$(curl -s -X POST "$FB_API/analyses" -H "authorization: Bearer $FB_KEY" \
  -H "content-type: application/json" -d '{
    "user_id":"'$UID'","organization_id":"'$ORG'",
    "source_ids":["'$LABS'","'$WEAR'"],
    "profile":{"age":42,"sex":"male"}
  }' | jq -r .id)
```

## 3. Read the render-ready dashboard spec

Every card is normalized: a title, category, 0–100 score, status, a plain-language
summary, and a suggested action. Map these straight onto UI components.

```bash theme={null}
curl -s "$FB_API/dashboard-specs/$AN" -H "authorization: Bearer $FB_KEY" | jq '.cards[0]'
# { "id":"…","title":"ApoB","category":"biomarkers","score":55,
#   "status":"watch","summary":"ApoB is high versus the wellness target…",
#   "action":"Interpret alongside ApoB, Lp(a), blood pressure…" }
```

Pair it with the healthspan score and priority findings from the analysis summary
(`GET /analyses/{id}`) for a hero header.

## 4. Add prioritized recommendations

```bash theme={null}
curl -s "$FB_API/analyses/$AN/recommendations" -H "authorization: Bearer $FB_KEY" \
  | jq '.protocols'   # tiered core / optimize / maintain routines
```

## 5. Style it with a design system

Skip design bikeshedding: pull a ready design-token set and a `DESIGN.md`.

```bash theme={null}
curl -s "$FB_API/design/systems/clinical-modern" | jq '{colors,typography,radii}'
```

## Take it further

* Add `category=genetics` or `category=behavioral` uploads before step 2; the
  same analysis folds them in.
* Re-render on new data with `POST /analyses/{id}/rerun`.
* For an agent, the identical flow is available as MCP tools (`upload_health_data`,
  `run_health_analysis`, `get_dashboard_spec`).
