Getting Started
Quickstart
Three steps: connect your data, watch it standardize, put AI on top.
Mirobody in three steps: ① connect data → ② it comes back standardized → ③ use it with AI. Everything is OpenAI-compatible — you’ll need an mb_live_* key and ~10 minutes.
All /v1 endpoints share one base URL — pick the cluster your account uses:
https://api.mirobody.ai/v1 # Globalhttps://api.mirobody.cn/v1 # ChinaJapan and EU clusters are in preparation — see Regions. Model providers and pricing can differ by region, so read GET /v1/models from the cluster you call.
Connect your data
Health data arrives in four shapes — each has exactly one door in:
| Data shape | Typical source | How it goes in | Endpoint |
|---|---|---|---|
| Structured readings | Devices / wearables (you own the integration — write daily aggregates), manual entries | Structured records | POST /v1/data — pre-aggregate high-frequency samples; episodes (sleep, workouts) carry time + end_time. See the device-data cookbook. |
| Files / photos | Lab reports, checkup PDFs, phone photos | File upload | POST /v1/files — stores the original, extracts its text, and pulls out standardized readings automatically. POST /v1/standardize runs the same extraction synchronously — for example as a dry-run preview. |
| Narrative with readings | “headache all day, temperature was 38.2 °C”, dictated notes | Narrative text | POST /v1/standardize — the quantifiable readings are extracted; the narrative around them is dropped. |
| Purely subjective journal | “dizzy and a headache all afternoon”, mood notes | Single-turn agent call | POST /v1/responses with store: true — readings and durable memories are extracted from the entry. See the Journaling recipe. |
Mirobody stores source data, standardizes structured readings, and makes both available to AI. You decide how data is collected and prepared before it reaches the API.
Write structured readings with POST /v1/data (retention is required), or upload a lab report — PDF, photo, spreadsheet — with POST /v1/files:
# Structured recordscurl https://api.mirobody.ai/v1/data \ -H "Authorization: Bearer $MIROBODY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "user": "alice", "retention": "permanent", "records": [ {"indicator": "fasting_glucose", "value": 97, "unit": "mg/dL", "time": "2026-06-16T07:30:00Z"}, {"indicator": "FBG", "value": 92, "unit": "mg/dL", "time": "2026-06-17T07:25:00Z"} ] }'
# Or a document (the original is stored right away; its text is ready a moment later)curl https://api.mirobody.ai/v1/files \ -H "Authorization: Bearer $MIROBODY_API_KEY" \ -F "user=alice" -F "file=@lab_report.pdf"user is the tenant-isolation key — pass each end-user’s stable id and their data never mixes.
It comes back standardized
Note the two spellings above — fasting_glucose and FBG. Read the data back and both rows carry the same LOINC code, a canonical name, UCUM-parsed values, and a FHIR mirror id:
curl "https://api.mirobody.ai/v1/data?user=alice&limit=10" \ -H "Authorization: Bearer $MIROBODY_API_KEY"{ "object": "list", "data": [ { "indicator": "FBG", "value": "92 mg/dL", "parsed_value": "92", "parsed_unit": "mg/dL", "loinc_code": "1558-6", "canonical_name": "Fasting glucose [Mass/volume] in Serum or Plasma", "fhir_resource_id": "8f3c9a1e-...", "time": "2026-06-17T07:25:00+00", "source": "api", "comment": "" } ], "has_more": false, "subject": "alice"}That’s the standardization pipeline — deterministic name→LOINC (no LLM code-guessing) + UCUM + FHIR, on every structured-record write. To extract and standardize readings from a document, use POST /v1/standardize with the file itself or an uploaded file_key.
Put AI on top
A grounded answer is three lines — the agent reads the standardized series, so “glucose” finds the rows written as “FBG”:
from openai import OpenAIclient = OpenAI(api_key="mb_live_...", base_url="https://api.mirobody.ai/v1")print(client.chat.completions.create(model="mirobody-flash", user="alice", messages=[{"role": "user", "content": "How is my fasting glucose trending?"}]).choices[0].message.content)And a real agent — with your own tool — is ten. The openai-agents SDK talks to the Agent API with only a new base URL:
from agents import Agent, ModelSettings, Runner, function_tool, set_default_openai_client, set_tracing_disabledfrom openai import AsyncOpenAI
set_default_openai_client(AsyncOpenAI( base_url="https://api.mirobody.ai/v1", api_key="mb_live_..."))set_tracing_disabled(True)
@function_tooldef book_appointment(date: str) -> str: """Book a clinic appointment for the end user (ISO date).""" return f"Booked: {date} 09:30, Dr. Chen"
agent = Agent(name="Health assistant", model="mirobody-flash", tools=[book_appointment], model_settings=ModelSettings(extra_body={"user": "alice"}))print(Runner.run_sync(agent, "Check my recent glucose; book a follow-up if it's trending up.").final_output)Mirobody’s built-in tools read alice’s real data; when the model decides to book, it hands off to your function. See Function calling for the protocol underneath.
Prefer clicking over curl?
Section titled “Prefer clicking over curl?”The console Playground follows the same flow: ① Ingest data → ② Auto-standardize → ③ Agent or Answers. Upload a file, inspect the extracted text or standardized records, and run either API without writing code.
Ingest data, inspect standardization, then open Agent or Answers.
Request counts for the last 30 days.
Next steps
Section titled “Next steps”Answers vs Agent — closed completion or full agent.
Client tools, stored conversations, streaming events.
OCR → extraction → LOINC → UCUM → FHIR, explained.
curl / Python / Node / openai-agents, end to end.