Vai al contenuto
GET /v1/bedtime

Recommended bedtimes from a wake time

Provalo dal vivo

10 chiamate gratuite al giorno — senza registrazione, senza chiave API. Passa dal gateway oanor.

Intestazioni personalizzate (facoltative)
api.oanor.com/sleep-api

Funziona. Prendi una chiave API e usala nel tuo progetto.

Ottieni una chiave API

Frammenti di codice

curl "https://api.oanor.com/sleep-api/v1/bedtime" \
  -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/sleep-api/v1/bedtime", {
  headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/sleep-api/v1/bedtime");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-oanor-key: oanor_test_..."]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
import requests
requests.get(
    "https://api.oanor.com/sleep-api/v1/bedtime",
    headers={"x-oanor-key": "oanor_test_..."}
)

Risposta di esempio

Una risposta reale di questo endpoint, acquisita dall'ultimo health check.

{
    "data": {
        "advice": "To wake refreshed, fall asleep at one of these times so you wake at the end of a sleep cycle.",
        "wake_at": {
            "time_12h": "7:00 AM",
            "time_24h": "07:00",
            "minute_of_day": 420
        },
        "bedtimes": [
            {
                "cycles": 6,
                "quality": "ideal",
                "go_to_bed": {
                    "time_12h": "9:45 PM",
                    "time_24h": "21:45",
                    "minute_of_day": 1305
                },
                "sleep_hours": 9,
                "sleep_duration": "9h"
            },
            {
                "cycles": 5,
                "quality": "good",
                "go_to_bed": {
                    "time_12h": "11:15 PM",
                    "time_24h": "23:15",
                    "minute_of_day": 1395
                },
                "sleep_hours": 7.5,
                "sleep_duration": "7h 30m"
            },
            {
                "cycles": 4,
                "quality": "minimum recommended",
                "go_to_bed": {
                    "time_12h": "12:45 AM",
                    "time_24h": "00:45",
                    "minute_of_day": 45
                },
                "sleep_hours": 6,
                "sleep_duration": "6h"
            },
            {
                "cycles": 3,
                "quality": "short",
                "go_to_bed": {
                    "time_12h": "2:15 AM",
                    "time_24h": "02:15",
                    "minute_of_day": 135
                },
                "sleep_hours": 4.5,
                "sleep_duration": "4h 30m"
            }
        ],
        "disclaimer": "Informational only — sleep needs vary by individual; not medical advice.",
        "fall_asleep_minutes": 15,
        "cycle_length_minutes": 90
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:01.669Z",
        "request_id": "78db587f-7d48-4bf1-a77b-ec54a5ee4406"
    },
    "status": "ok",
    "message": "Recommended bedtimes",
    "success": true
}