← Back to Luna Developers

Build on Luna: REST API, MCP connector and CLI.

Luna by getmyluna.app is a baby tracker for feeds, sleep, nappies, solids and routines. Everything the web app does is available programmatically, scoped to one family per credential. This page is the developer portal; the machine-readable versions are linked in every section.

OpenAPI 3.1 MCP streamable HTTP CLI, no dependencies Bearer tokens with scopes

Start here

OpenAPI spechttps://getmyluna.app/openapi.json
Interactive docshttps://getmyluna.app/docs (Swagger UI) · https://getmyluna.app/redoc
API index (JSON)https://getmyluna.app/api
MCP serverhttps://getmyluna.app/mcp · manifest /.well-known/luna-connector.json · setup guide
Agent instructionshttps://getmyluna.app/llms.txt
CLIhttps://getmyluna.app/cli/luna.py (single file, Python 3.9+, standard library only)
Support[email protected]

Authentication

Create a free account at /onboard (or POST /api/vega/onboard). Then create a bearer token in the app under Settings → Connect an assistant, or from a signed-in session:

curl -X POST https://getmyluna.app/api/vega/token \
  -H "Cookie: luna_session=<session>" -H "Content-Type: application/json" \
  -d '{"label": "my-script", "scopes": ["read", "write"]}'

The token is shown once. Send it as Authorization: Bearer <token> on every request. Tokens are stored hashed, carry read or read+write scope, and can be listed (GET /api/vega/tokens) and revoked (POST /api/vega/token/revoke) at any time. Only GET /api/health and POST /api/vega/onboard work without credentials; everything else returns 401 {"error": "unauthorized"}.

Example requests

Live status (asleep or awake, hunger, next feed estimate, today's totals):

curl https://getmyluna.app/api/vega/live -H "Authorization: Bearer $LUNA_TOKEN"

Log a 150 ml bottle now:

curl -X POST https://getmyluna.app/api/vega/log \
  -H "Authorization: Bearer $LUNA_TOKEN" -H "Content-Type: application/json" \
  -d '{"type": "milk", "ml": 150}'

Log a solid meal at a specific time, then read back the day:

curl -X POST https://getmyluna.app/api/vega/log \
  -H "Authorization: Bearer $LUNA_TOKEN" -H "Content-Type: application/json" \
  -d '{"type": "solid", "foods": ["scrambled egg", "toast"], "meal_type": "meal", "ts": "2026-09-20T12:15:00"}'

curl "https://getmyluna.app/api/vega/events?date=2026-09-20" -H "Authorization: Bearer $LUNA_TOKEN"

Responses are JSON. Errors are {"error": "<code>"} with a 4xx status. Timestamps are ISO 8601 in the family's local time; future timestamps are rejected. Volumes are millilitres, weights kilograms, lengths centimetres regardless of the family's display units.

Endpoints

Grouped as in the spec. Every operation has a unique operationId, typed request and response schemas, and the error responses it can return, so the spec can be loaded straight into a function-calling or tool-use framework.

GroupWhat it covers
DiscoveryGET /api/health, GET /api/me, /llms.txt, the MCP manifest
AccountSign-up, members, invite links, export, permanent deletion
TokensCreate, list and revoke bearer tokens
TrackerPOST /api/vega/log and friends: feeds, sleep, nappies, solids, notes, supplements, measurements; edit, delete, undo, react
InsightsLive status, patterns and the weekly nutrition/allergen review (once solids have started), growth measurements
ProfileChild profile; region (uk/us), units and timezone
Ask LunaLuna Plus questions answered from the family's own log, and the notes Luna remembers

MCP connector

The same bearer token works with Luna's hosted MCP server at https://getmyluna.app/mcp (streamable HTTP, JSON responses, stateless). It exposes 23 tools, 3 resources and 3 prompts designed for assistants: every response names the child and the clock it was read at, write tools return a plain-language confirmation summary and accept an idempotency key. Setup for Meta Muse and Claude Code is on the connector page.

claude mcp add luna --transport http https://getmyluna.app/mcp --header "Authorization: Bearer $LUNA_TOKEN"

CLI

A single-file command-line client that needs nothing beyond Python's standard library:

curl -fsSLO https://getmyluna.app/cli/luna.py && chmod +x luna.py
export LUNA_TOKEN=...            # or: ./luna.py login [email protected]
./luna.py status
./luna.py log milk 150
./luna.py log solid "scrambled egg" toast --meal snack
./luna.py events --date 2026-09-19 --pretty
./luna.py api GET /api/vega/patterns

Every command prints JSON and exits non-zero on an HTTP error, so it composes with jq and shell scripts. luna api METHOD /path reaches any endpoint in the spec.

Limits and conduct

Changelog