Calculate optimal bedtimes and wake times using 90-minute sleep cycles to avoid grogginess. Access via MCP in Cursor or Windsurf for sleep scheduling in health apps, or use GET /v1/health/sleep REST endpoint. Input your desired wake time, get multiple sleep options. Based on REM cycle science — waking between cycles feels more refreshing than mid-cycle interruptions.
curl "https://tinyfn.io/v1/health/sleep" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/health/sleep', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/health/sleep',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's health tools:
{
"mcpServers": {
"tinyfn-health": {
"url": "https://tinyfn.io/mcp/health",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Sleep cycles average 90 minutes from light sleep through deep sleep to REM. Waking at cycle boundaries (after 3, 4.5, 6, 7.5, or 9 hours) typically feels more refreshing than waking mid-cycle during deep sleep phases.
Send your target wake time, and optionally specify how many cycle options to return. The API calculates backwards in 90-minute intervals, accounting for average 10-15 minute fall-asleep time.
Yes, the MCP tool integrates directly into Claude Code and other AI coding assistants. Perfect for building sleep schedule features in health apps or personal productivity tools.
The tool uses the standard 90-minute average. Individual cycles range 70-120 minutes, so treat results as guidelines rather than rigid schedules for optimal sleep timing.
Unlike basic calculators, this API provides programmatic access for integration into apps and workflows. Same core science, but deterministic output format suitable for AI agents and development projects.
Get your free API key and start using Sleep Cycles in seconds.
Get Free API Key