# Miara API > Read and add to a family's Miara baby-care log from your own scripts, devices and bridges. HTTPS and JSON, described in OpenAPI 3.1. Free. - Base address: https://getmiara.com/api/v1 - Full reference: https://getmiara.com/api/v1/openapi.json (no token needed) - For people: https://getmiara.com/developers - Building a bridge: install the miara-bridge skill. In Claude Code: `claude plugin marketplace add noahpresler/miara-bridge`, then `claude plugin install miara-bridge@miara`. Elsewhere: `npx skills add noahpresler/miara-bridge --skill miara-bridge`. ## Rules - Tokens: send `Authorization: Bearer miara_pat_…`. A parent or caregiver makes one in the Miara app: Profile → Siri, assistants and connections → New connection. Scopes are `read`, `write:events`, `write:observations`, `write:plans` and `write:monitors`, for the children they pick. A token lasts 90 days by default and is shown once. - Every POST needs an `Idempotency-Key` header: 1 to 255 visible characters, new for each change. To retry, send the same request with the same key: within 24 hours it returns the first answer with `Idempotent-Replayed: true` and saves nothing twice. The same key with a different body is a 422. - Entries carry your own `source_event_id`. Sending the same one again updates that entry instead of adding another. - Errors are always `{"error": {"code": "…", "message": "…"}}`. Act on `code`; show `message` to people. - Limits: 120 requests a minute per token and 300 per family; 500 rows and 4 MB a request. A 429 carries `Retry-After` in seconds: wait that long, then resend with the same Idempotency-Key. A `daily_limit` 429 retries at midnight UTC. - Times are ISO 8601 with an offset. Readings are kept to the minute: one per child, metric and minute, and a resend replaces it. - Overlapping sleeps: a sleep that overlaps one a person logged comes back `suggested` and waits for them. Once they answer or delete it, resending comes back `skipped`. Don't work around either. - Metrics are the core set (`GET /metrics`) or your own `x..`, declared with `POST /metrics` before use. Unknown metrics are refused. - Vitals (`heart_rate`, `spo2`, `breathing_rate`) are kept as records and never interpreted. Don't describe them as findings or advice. - Open sleeps: send a sleep without `ended_at` while it's going on, then resend the same `source_event_id` with `ended_at` once it ends. It updates the entry; it doesn't add another. - Ending a sleep someone else started: POST /events:end with its id from GET /events and the `ended_at`. Only a sleep that's still running; an ended one is a 409 `already_ended`, a deleted one a 410 `deleted`. Don't retry those; read GET /events again. - Each run, re-read a window from the device (the last few hours) rather than only "since the last run", and send only entries that are new or changed. - A bridge that keeps running should call `GET /wait` between syncs instead of sleeping, and act on `reason` (`app_opened`, `monitor_watch`, `monitor_stop`, `monitor_snapshot`) when it answers `woken: true`. It doesn't count toward the 120 a minute. Treat a 404 as "not supported" and sleep instead. - Device logins stay on the user's machine. Never send a device's password or token to Miara, in `raw` or anywhere else. ## Sandbox (synthetic data, public) - Token: miara_pat_5a4d0b0c5a4d0b0c5a4d0b0c5a4d0b0c5a4d0b0c - Household: Sandbox family (synthetic) - Children: Juniper (sample) 5a4d0b0c-0000-4000-8000-000000000011, Basil (sample) 5a4d0b0c-0000-4000-8000-000000000012 - Resets every night at 09:41 UTC to 15 days of made-up history; dates move with each reset. - 30 requests a minute shared by everyone, 10 per caller; 500 entries and 5,000 readings a day. No insight cards; GET /status forecasts by a fixed rule (a feed 3 hours after the last, a nap 1h 45m to 2h 15m after the last wake). - Anyone can read and write it. Never send real data to it. ## Endpoints - GET /children (any token): the children the token is for, oldest first. - GET /events (read): a child's entries, newest first. child_id, since, until, kind, limit (1–500, default 100), cursor. - POST /events:batch (write:events): up to 500 sleep, bottle, nursing, diaper or pump entries. Each comes back saved, updated, unchanged, suggested, skipped or rejected. - POST /events:end (write:events): ends the running sleep named by id (from GET /events, a sleep with no ended_at), whoever started it. Body {"id", "ended_at"}. The app shows which connection ended it. 409 already_ended or 410 deleted when it can't, and nothing changes. - GET /observations (read): a child's readings, newest first. child_id, metric, since, until, limit (1–500), cursor. - POST /observations:batch (write:observations): up to 500 readings, all or nothing. - GET /metrics (any token): core metrics and the family's declared ones. - POST /metrics (write:observations): declare or change x.., a number range or 2 to 12 choices. - GET /insights (read): a child's insight cards. child_id, since (a date), limit (1–200, default 30). - GET /status (read): what's due for a child, for a screen. child_id. {"child_id", "time_zone", "now", "next_feed", "next_nap", "sleep_running", "last_feed", "last_diaper", "last_sleep"}: next_feed {expected_at, due, bottle, last_feed_at, based_on}, next_nap {kind: nap | bedtime, nap_number, opens_at, closes_at, woke_at, state: upcoming | open | late, based_on: own_history | typical_for_age}, sleep_running {event_id, started_at, started_by, paused, minutes_asleep, pauses}. The app's own forecasts; null when none stands, next_nap null while asleep. Say them as "around" and "likely", never as a schedule or advice. Times UTC; show them in time_zone. Once a minute is plenty. - GET /wait (any token): holds up to timeout seconds (1–25, default 25); {"woken": true, "reason": "app_opened" | "monitor_watch" | "monitor_stop" | "monitor_snapshot"} when woken, else {"woken": false}. One open wait a token; 20 a minute. 404 on an older Miara: sleep instead. - GET /plans (read): the family's care plans: {"plans": [{"id", "child_id", "key", "status": "active" | "paused" | "ended", "document", "from", "created_at", "updated_at", "time_zone", "next", "rounds", "items", "today"}]}. child_id, status (default active and paused). An active plan says where it stands today: next is {"type": "next" | "waiting" | "paused" | "ended", "step", "by", "late", "text": "By 9:35 AM"}; rounds are today's rounds, each {"rule", "due", "started", "closed", "steps": [{"id", "label", "kind", "state": "done" | "next" | "upcoming" | "missed" | "skipped", "opens", "by", "logged_at", "event_id", "text"}]}; items are the one-off steps the same way; today counts each step ({"step", "done", "total"}), so "6 of 8 pumps" is done of total. A step ticked off by hand in the app isn't seen. Read again when GET /wait wakes you. - POST /plans (write:plans): saves a plan the family or their clinician gave, as one document: {"version": 1, "key", "title", "child"?, "note"?, "starts"?, "ends"?, "rules"?, "items"?}. The same key replaces it; a paused plan stays paused. Their words and numbers only, never an amount you worked out. A field or step kind version 1 doesn't know is a 400 naming it. Answers {"id", "child_id", "key", "status": "created" | "replaced" | "unchanged", "plan_status"}. - POST /plans:end (write:plans): ends a plan this connection sent, by id (from GET /plans) or by key. Another source's plan is a 404. Body {"id"} or {"key", "child_id"?}. 409 already_ended when it already ended. - POST /monitors (write:monitors): registers or updates a child's baby monitor for this connection. Body {"child_id", "label", "capabilities": ["video"|"audio"|"snapshot"], "transport": "webrtc_signaled"|"whep"|"hls"|"snapshot_only", "stream_url"?, "stream_auth"?, "status"?, "night_vision"?}. Answers {"monitor_id", "child_id", "label", "status"}. - POST /monitors:remove (write:monitors): removes this connection's monitor for a child and deletes its stored snapshot. Body {"child_id"}. Answers {"removed": true|false}. - POST /monitors:snapshot (write:monitors): uploads a fresh JPEG, PNG or WebP still (<= 1.5 MB decoded) for a registered monitor. Body {"child_id", "content_type", "data_base64"}. 404 if no monitor is registered yet. Answers {"monitor_id", "snapshot_at"}. - GET /monitors:sessions (write:monitors): lists open WebRTC watch sessions (closing stale ones > 45s without heartbeat) and ephemeral ICE/TURN servers: {"sessions": [...], "ice_servers": [...]}. Call when GET /wait wakes with monitor_watch or monitor_stop. - POST /monitors:answer (write:monitors): posts an SDP answer or state change for a session from GET /monitors:sessions. Body {"session_id", "state": "answered"|"active"|"ended"|"busy"|"offline"|"failed", "answer_sdp"?, "error_code"?}. Answers {"session_id", "monitor_id", "state", "ended_at"}. - POST /links (no token): a sign-in link for a bridge's setup instead of a pasted token: {"token", "code", "url", "expires_in": 600, "interval": 3}. Body {"name", "scopes"} (default write:events, write:observations). Keep the token secret; show the person the url and code. 30 a minute across everyone. - GET /links (no token): with the token POST /links gave: {"status": "pending" | "approved" | "denied" | "expired"}. Poll every interval seconds; once approved the token works, so call GET /children and save it. - GET /openapi.json (no token): the reference. ## Example: one night's sleep, safe to retry curl -X POST https://getmiara.com/api/v1/events:batch \ -H "Authorization: Bearer miara_pat_5a4d0b0c5a4d0b0c5a4d0b0c5a4d0b0c5a4d0b0c" \ -H "Idempotency-Key: nursery-2026-11-16-0515" \ -H "Content-Type: application/json" \ -d '{"entries":[{"source_event_id":"night-2026-11-15","child_id":"5a4d0b0c-0000-4000-8000-000000000011","kind":"sleep","started_at":"2026-11-16T00:30:00Z","ended_at":"2026-11-16T10:00:00Z"}]}' ## Plans in Up next A plan is a routine the family was given (a feeding plan, a medicine schedule, a one-off step). POST /plans with the write:plans scope sends it as one version 1 document; Miara works out the next step from the family's log and shows it on Today under its own forecast, marked with the connection's name. Shape: {"version": 1, "key", "child", "title", "ends"?, "rules": [{"id", "repeat": {"every": "3h", "from": {"last": "feed", "edge": "start"}, "night"?: {"between": ["23:00","05:00"], "every": "4h"}} or {"at": ["08:00"]}, "steps": [{"id", "kind", "label"?, "amount"?: {"value", "unit"}, "duration"?, "within"?: "10m", "skip"?: {"between": [..]}}]}], "items"?: [{"id", "kind", "label", "by"}]}. Step kinds: nurse, bottle, pump, sleep, diaper, dose (names a medicine the family has), tummy_time, skin_to_skin, solids, activity (one of the family's own activities), custom (ticked off by hand). A log of the step's kind in its window ticks it off; amounts needn't match. Send only the family's or their clinician's words and numbers, never an amount, time or medicine you worked out. Any caregiver can pause or end a plan in the app; only the sending connection can replace (same key) or end it over the API. GET /plans returns each plan's next step, today's rounds and per-step counts. Guide: https://getmiara.com/developers#up-next ## Baby monitors and live video A bridge with `write:monitors` can register one baby monitor per child (`POST /monitors`), upload still snapshots (`POST /monitors:snapshot`, JPEG/PNG/WebP <= 1.5 MB decoded) and stream live video/audio into Today and the active sleep card alongside recent room readings (`room_temp_c`, `humidity`, `sound_db` within 30 minutes). Only parents and caregivers see monitors and snapshots; viewers never do. The public sandbox token does not include `write:monitors`. Transports: `webrtc_signaled` (recommended behind NAT — no open ports; Miara relays SDP and issues ephemeral Cloudflare TURN + STUN in `GET /monitors:sessions`), `whep` (app sends `POST stream_url` with `Content-Type: application/sdp`, `Accept: application/sdp`, optional `Authorization` from `stream_auth`, and `DELETE` to `Location` on close), `hls` (native playback of `.m3u8` with optional `Authorization`), or `snapshot_only`. If `stream_auth` does not start with `Bearer ` or `Basic `, Miara prefixes `Bearer `. Signaled WebRTC flow: keep a persistent `GET /wait` loop running (not cron); on `reason: "monitor_watch"`, call `GET /monitors:sessions` immediately (app times out at 20s) to read `offer_sdp` (Unified Plan, `recvonly` video + `recvonly` audio when `audio` is in `capabilities`, non-trickle ICE) and `ice_servers`; attach `sendonly` video (H.264 or VP8; H.264 uses hardware decode on phones) and optional Opus audio; wait for complete ICE gathering before posting `answer_sdp` (`state: "answered"`) to `POST /monitors:answer` (non-trickle — no trickle ICE endpoint); update to `active` when connected or `busy`/`offline`/`failed` with `error_code` (`stream_limit`, `camera_off`, `offline`, `failed`). The app heartbeats every 15s and sends `monitor_stop` when video closes or when a parent toggles Live camera off in Settings (which keeps sleep/readings running); `GET /monitors:sessions` closes stale sessions after 45s. Poll `GET /monitors:sessions` while streaming and tear down the peer connection and camera pull as soon as a session disappears. Refresh snapshots on `monitor_snapshot`. Never record, store or analyze video/audio; Miara never records media or opens the phone's mic and keeps only the single latest snapshot in private storage (deleted on `POST /monitors:remove`). Guide: https://getmiara.com/developers#monitors ## Bridges A bridge runs on the user's own machine: it fetches from a device's service with the user's login, maps what it finds to core or declared metrics, and sends batches with idempotency keys. Test on the sandbox, then run it on a schedule. Start from the template: https://github.com/noahpresler/miara-bridge (Python, with a Claude skill in skills/miara-bridge).