Ir al contenido
GET /v1/duration

Sleep duration & cycle analysis

Pruébalo en vivo

10 llamadas gratis al día — sin registro, sin clave API. Pasa por el gateway de oanor.

Encabezados personalizados (opcional)
api.oanor.com/sleep-api

Funciona. Consigue una clave API y úsala en tu proyecto.

Obtener una clave API

Fragmentos de código

curl "https://api.oanor.com/sleep-api/v1/duration" \
  -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/sleep-api/v1/duration", {
  headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/sleep-api/v1/duration");
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/duration",
    headers={"x-oanor-key": "oanor_test_..."}
)

Respuesta de ejemplo

Una respuesta real de este endpoint, capturada en la última comprobación de estado.

{
    "data": {
        "bedtime": {
            "time_12h": "11:00 PM",
            "time_24h": "23:00",
            "minute_of_day": 1380
        },
        "wake_at": {
            "time_12h": "7:00 AM",
            "time_24h": "07:00",
            "minute_of_day": 420
        },
        "assessment": "healthy duration",
        "disclaimer": "Informational only — sleep needs vary by individual; not medical advice.",
        "full_cycles": 5,
        "sleep_hours": 8,
        "time_in_bed": "8h",
        "sleep_minutes": 480,
        "sleep_duration": "8h",
        "on_cycle_boundary": false,
        "fall_asleep_minutes": 0,
        "time_in_bed_minutes": 480,
        "cycle_length_minutes": 90,
        "minutes_into_current_cycle": 30,
        "minutes_to_next_cycle_boundary": 60
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:01.779Z",
        "request_id": "0f8c2983-3fde-4359-9778-57b725c95201"
    },
    "status": "ok",
    "message": "Sleep duration analysis",
    "success": true
}