Skip to main content
Write structured records straight into a Subject’s store, and read them back. The chat agent reads this same data with its built-in tools.

Write records

POST /v1/data
Authorization: Bearer mb_live_*
Content-Type:  application/json
FieldTypeDescription
recordsarrayEach record {indicator, value, unit, time}. Inserted in batches (1000 per batch).
userstringSubject the records belong to (tenant-isolation key).
retentionstringpermanent (default) / session / 1d. none is upgraded to permanent here — writing to the store but asking not to store is contradictory.
session_idstringRequired when retention=session.
curl https://mcp.thetahealth.cn/v1/data \
  -H "Authorization: Bearer $MIROBODY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "user": "alice",
        "records": [
          {"indicator": "fasting_glucose", "value": 5.4, "unit": "mmol/L", "time": "2026-06-16T07:30:00Z"},
          {"indicator": "fasting_glucose", "value": 5.1, "unit": "mmol/L", "time": "2026-06-17T07:25:00Z"}
        ]
      }'
Response:
{ "ingested": 2, "subject": "alice", "retention": "permanent" }

Read records

GET /v1/data?indicator=fasting_glucose&limit=100
Authorization: Bearer mb_live_*
QueryDescription
userSubject to read from.
indicatorOptional filter by indicator name.
limit11000.
Expired records are purged before the read, so you always get the Subject’s currently-valid data.
Python
import requests

r = requests.get(
    "https://mcp.thetahealth.cn/v1/data",
    headers={"Authorization": f"Bearer {MIROBODY_API_KEY}"},
    params={"user": "alice", "indicator": "fasting_glucose", "limit": 100},
)
print(r.json())
For one-off data that should not persist, attach it inline to a chat request as health_context with retention="none" instead of writing it here — see Chat → Inline data.