Dashboard Sign InKR

[PUT] Update User

You can update user information.

Request

URL

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

Header

FieldTypeRequiredDescription
x-api-keyStringOAPI Key

Body

FieldTypeRequiredDescription
metadataMetadata Object or nullOuser metadata

Metadata Object

FieldTypeRequiredDescription
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/<USER_ID>" -X PUT \
  -H "x-api-key: <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

200 Ok

  • Update user successful

Body (result field)

FieldTypeDescription
user_idStringuser id
metadataMetadata Objectuser metadata

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": "sucess",
  "result": {
    "user_id": "<USER_ID>",
    "metadata": {
      "birth_year": 2001,
      "birth_month": 1,
      "birth_day": 1,
      "gendar": "male",
      "height": 178.6,
      "weight": 62.1  
    }
  }
}

404 Not Found

  • user does not exist
{
  "detail": "user not exist"
}