Dashboard Sign InKR

[POST] Create User

Generates an identifier (user id) for the user to record sleep, and one can use this identifier to continuously manage the user's sleep. The identifier of the generated user can be stored and managed in the appropriate storage of the customer for continuous use.

Request

URL

POST https://api.asleep.ai/ai/v1/users

Header

ParameterTypeRequiredDescription
x-api-keyStringOAPI Key

Body

ParameterTypeRequiredDescription
metadataMetadata Object or nullXuser metadata

Metadata Object

ParameterTypeRequiredDescription
birth_yearInt?Xbirth year (1900 to the current year)
birth_monthInt?Xbirth month (1 ~ 12)
birth_dayInt?Xbirth day (1 ~ 31, actual effective range varies by month/leap year)
genderString (male, female, non_binary, other, prefer_not_to_say)?Xgender
heightFloat?Xheight (0 ~ 300 cm, allow up to one decimal place)
weightFloat?Xweight (0 ~ 1000 kg, allow up to one decimal place)

Example

curl "https://api.asleep.ai/ai/v1/users" -X POST \
  -H "x-api-key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "metadata": {
        "birth_year": 2001,
        "birth_month": 1,
        "birth_day": 1,
        "gender": "male",
        "height": 178.6,
        "weight": 62.1
    }
}'

Response

201 Created

  • new user has been successfully created

Body (result field)

FieldTypeDescription
user_idStringuser id
{
  "detail": "success",
  "result": {
    "user_id": "<USER_ID>"
  }
}