#sleep
2 APIs with this tag
Caffeine Calculator API
Caffeine metabolism maths as an API, computed locally and deterministically with a first-order (exponential) decay model. The level endpoint computes how much caffeine remains in the body after a given time from a dose and a half-life (about 5 hours by default), as milligrams and a percentage, and how long until it falls to a chosen threshold. The timeline endpoint returns an hour-by-hour decay curve and the time until caffeine is "sleep safe" — below a threshold (50 mg by default) — handy for working out a coffee cut-off before bed. The sources endpoint gives the typical caffeine content of common drinks (brewed coffee, espresso, tea, energy drinks, cola and more) for a single drink, or totals a list such as two coffees and a cola. Everything is computed locally and deterministically, so it is instant and private. This is informational only: real caffeine half-life varies widely between people (roughly 3–7 hours, and much longer in pregnancy or with certain medications) — it is not medical advice. Ideal for coffee, sleep and wellbeing apps, energy-drink and habit trackers, and quantified-self tools. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is caffeine pharmacokinetics; for a drug reference database use a drug API.
api.oanor.com/caffeine-api
Sleep Cycle API
Sleep-cycle planning as an API, built around the fact that a full sleep cycle averages about 90 minutes and that waking at the end of a cycle — rather than mid-cycle — leaves you feeling more refreshed. The bedtime endpoint takes a wake-up time and suggests the times to fall asleep so that you wake at the end of a whole number of cycles (6, 5, 4 or 3 cycles), allowing for the time it takes to drift off. The wake-time endpoint does the reverse: from a bedtime (or "now") it suggests the best times to set an alarm. The duration endpoint takes a bedtime and a wake time and reports time in bed, actual sleep, the number of full cycles, how many minutes you are into the current cycle and how close you are to a clean cycle boundary, with a healthy-duration assessment. The nap endpoint plans power, short, slow-wave and full-cycle naps from a start time and explains the trade-offs. All clock maths is modulo 24 hours and accepts both 24-hour ("23:15") and 12-hour ("10:30 PM") times. Everything is computed locally and deterministically, so it is instant and private. Ideal for sleep, alarm-clock and wellbeing apps, smart-home routines, shift-work planning and productivity tools. Pure local computation — no key, no third-party service, instant. Live, nothing stored. INFORMATIONAL ONLY — sleep needs vary by individual; not medical advice. 4 endpoints. This is sleep-cycle timing maths; for time-zone conversion use a time API and for body metrics such as BMI use a health-calculator API.
api.oanor.com/sleep-api