[POST] Reanalyze Session
Re-runs the sleep analysis of a specific session. If you specify an analysis range with start_time/end_time, the session is re-analyzed based on that range.
The analysis range information of a session with a specified analysis range can be checked via the analysis object of Get Session (v4).
Request
URL
POST https://api.asleep.ai/data/v1/sessions/{session_id}/reanalyze
Header
| Field | Type | Required | Description |
|---|---|---|---|
| x-api-key | String | O | API Key |
| x-user-id | String | O | Issued user id |
Path parameter
| Field | Type | Required | Description |
|---|---|---|---|
| session_id | String | O | id of the session you want to re-analyze |
Body
- Both
start_timeandend_timemust be in UTC. start_timemust be beforeend_time.
| Field | Type | Required | Description |
|---|---|---|---|
| start_time | String (YYYY-MM-DDThh:mm:ss+00:00)? | X | Start time of the analysis range (must be UTC) |
| end_time | String (YYYY-MM-DDThh:mm:ss+00:00)? | X | End time of the analysis range (must be UTC) |
Example
curl "https://api.asleep.ai/data/v1/sessions/{session_id}/reanalyze" -XPOST \
-H "x-api-key: <YOUR_API_KEY>" \
-H "x-user-id: <USER_ID>" \
-H "Content-Type: application/json" \
-d '{
"start_time": "2025-01-15T03:00:00+00:00",
"end_time": "2025-01-15T07:00:00+00:00"
}'Response
200 OK
- Reanalysis successful
{
"detail": "reanalyze success"
}- The session has already been analyzed under the same conditions, so no reanalysis was performed
{
"detail": "already analyzed"
}400 Bad Request
session_id: invalid format
{
"detail": "The format of sleep session id 20230608020315_hz82 is not valid"
}start_timeorend_timeis not in UTC
{
"detail": "analysis times must be UTC"
}start_timeis not beforeend_time
{
"detail": "start_time must be before end_time"
}- The analysis range exceeds the available sleep data of the session
{
"detail": "analysis range exceeds the available sleep data"
}401 Unauthorized
- Invalid or missing authentication credentials
{
"detail": "Unauthorized"
}403 Forbidden
- An inaccessible customer has made a request
{
"detail": "An inaccessible customer has made a request"
}404 Not Found
- The session corresponding to
session_idis not found
{
"detail": "Unable to find the sleep session of id {session_id}"
}- The sleep analysis of the session is not found
{
"detail": "Unable to find the sleep analysis of the sleep session {session_id}"
}409 Conflict
- A reanalysis of the session is already in progress
{
"detail": "The reanalysis of the sleep session {session_id} is in progress"
}410 Gone
- The analysis result of the session no longer exists
{
"detail": "Unable to find the analysis result of the sleep session {session_id}"
}422 Unprocessable Entity
- The session is not in the COMPLETE state
{
"detail": "The sleep session {session_id} is not complete"
}Updated about 6 hours ago
Did this page help you?
