Welcome to the API
The Mirobody Health API provides programmatic access to health device integrations, data retrieval, and AI-powered health insights.
Base URL: http://localhost:18080 (development) or https://your-domain.com (production)
API Categories
Base URLs
Authentication
Most API endpoints require authentication using JWT tokens in the Authorization header:
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
http://localhost:18080/api/v1/pulse/providers
Obtaining Tokens
Tokens are issued through the authentication endpoints:
Email Login : POST /api/v1/user/email/login
Google OAuth : POST /api/v1/user/google/login
Apple Sign In : POST /api/v1/user/apple/login
Some public endpoints (like /api/v1/pulse/providers) may work without authentication, but user-specific operations always require valid tokens.
Rate Limiting
API requests are rate-limited per user and per provider:
Default : 100 requests per minute per user
Provider-specific : Varies by provider (e.g., Garmin: 60 req/min)
Exceeding rate limits returns a 429 Too Many Requests response with a Retry-After header.
All API responses follow a standard format:
Success Response
Error Response
{
"code" : 0 ,
"msg" : "ok" ,
"data" : {
// Response data here
}
}
HTTP Status Codes
Status Description 200Success 400Bad Request - Invalid parameters 401Unauthorized - Invalid or missing token 403Forbidden - Insufficient permissions 404Not Found - Resource doesn’t exist 429Too Many Requests - Rate limit exceeded 500Internal Server Error
Common Error Codes
Code Description Resolution 0Success - -1General error Check error message -32000Auth required (MCP) Authenticate via OAuth flow -32601Method not found (MCP) Check method name -32602Invalid params (MCP) Verify parameter format
Quick Start
List available providers
curl http://localhost:18080/api/v1/pulse/providers
Returns all supported health device providers (Garmin, Whoop, Apple Health, etc.)
Link a provider (OAuth)
curl -X POST http://localhost:18080/api/v1/pulse/user/providers/link \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"provider_slug": "theta_garmin",
"platform": "theta",
"auth_type": "oauth2"
}'
Returns OAuth URL for user authorization
Chat with AI
curl -X POST http://localhost:18080/api/v1/chat/stream \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"question": "How many steps did I take this week?",
"agent": "deep",
"user_id": "user_123"
}'
Streams AI response with health data insights
Call MCP tools
curl -X POST http://localhost:18080/mcp \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_health_indicator",
"arguments": {"keywords": "steps"}
}
}'
Directly query health data via MCP protocol
API Endpoints Overview
Pulse API (/api/v1/pulse)
Endpoint Method Description /providersGET List all available providers /user/providersGET Get user’s linked providers /user/providers/linkPOST Link a new provider /user/providers/unlinkPOST Unlink a provider /{platform}/{provider}/callbackGET OAuth callback handler /{platform}/webhookPOST Provider webhook receiver
Chat API (/api/v1/chat)
Endpoint Method Description /streamPOST Stream chat response (SSE) /historyGET Get conversation history /sessionPOST Create/manage sessions
MCP API (/mcp)
Method Description initializeHandshake and capabilities tools/listList available tools tools/callExecute a tool resources/listList resources resources/readRead a resource
File API (/api/v1/data)
Endpoint Method Description /upload-with-processingPOST Upload and process health files /health/dataGET/POST Query/store health data /uploaded-filesGET List uploaded files
API Versioning
The API uses URL-based versioning:
Current : /api/v1/...
Future : /api/v2/... (when available)
Always use the versioned endpoints (/api/v1/...) to ensure compatibility. The MCP endpoint (/mcp) follows its own protocol versioning.
Webhooks
Mirobody Health supports webhooks for real-time health data updates from providers:
POST /{platform}/webhook
Content-Type: application/json
{
"user_id" : "user_123",
"source" : "theta_garmin",
"timestamp" : 1705320600000,
"timezone" : "America/Los_Angeles",
"data" : [
{
"type" : "steps",
"value" : 10543,
"unit" : "steps",
"timestamp" : 1705320600000
}
]
}
Webhooks are automatically configured when linking OAuth providers. See Provider Integration for details.
Next Steps