Dashboard Sign InKR

[GET] Get User

You can retrieve the information of an existing user using the user identifier.

Request

URL

GET https://api.asleep.ai/ai/v1/users/{user_id}

Header

FieldTypeRequiredDescription
x-api-keyStringOAPI Key

Path Parameter

FieldTypeRequiredDescription
user_idStringOuser id

Example

curl "https://api.asleep.ai/ai/v1/users/{user_id}" -X GET \
  -H "x-api-key: <YOUR_API_KEY>"

Response

200 OK

Body (result field)

FieldTypeDescription
user_idStringuser id
to_be_deletedBooleanwhether the user is marked for deletion
last_session_infoSession Object or nullinformation about the last session
metadataMetadata Object or nulluser metadata

Session Object

if state == OPEN: session_end_time is null

if state != COMPLETE: complete_end_time is null

Field

Type

Description

session_id

String

session id

inference_type

String

format of the audio data uploaded in the session

service

String

name of the service specified when creating the session

start_time

String (YYYY-MM-DDThh:mm:ssZ)

start time of the session

end_time

String (YYYY-MM-DDThh:mm:ssZ)?

end time of the session

state

String (OPEN,CLOSED,COMPLETE)

state of the session

complete_time

String (YYYY-MM-DDThh:mm:ssZ)?

completion time of the final session analysis if state != COMPLETE complete_tims is null

Metadata Object

FieldTypeDescription
birth_yearInt?birth year (1900 to the current year)
birth_monthInt?birth month (1 ~ 12)
birth_dayInt?birth day (1 ~ 31, actual effective range varies by month/leap year)
genderString (male, female, non_binary, other, prefer_not_to_say)?gender
heightFloat?height (0 ~ 300 cm, allow up to one decimal place)
weightFloat?weight (0 ~ 1000 kg, allow up to one decimal place)
{
  "detail": "success",
  "result": {
    "user_id": "<USER_ID>",
    "to_be_deleted": false,
    "last_session_info": {
      "session_id": "20230630224117",
      "inference_type": "MELSPECTROGRAM",
      "service": "NOSERVICE",
      "start_time": "2023-06-30T22:41:17",
      "end_time": "2023-07-01T05:36:12",
      "state": "COMPLETE",
      "complete_time": "2023-07-01T05:41:12"
    },
    "metadata": {
      "birth_year": 2001,
      "birth_month": 1,
      "birth_day": 1,
      "gender": "male",
      "height": 178.6,
      "weight": 62.1
    }
  }
}

404 Not Found

  • user corresponding to x-user-id does not exist
{
  "detail": "user does not exist"
}