[POST] Create User

수면을 기록할 사용자의 식별자(user id)를 생성하며, 이 식별자를 사용해서 사용자의 수면을 지속적으로 관리할 수 있습니다. 기 생성된 사용자의 식별자를 고객의 적절한 저장소에 저장 및 관리하여 지속적으로 사용할 수 있습니다.

Request

URL

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

Header

ParameterTypeRequiredDescription
x-api-keyStringOAPI Key

Body

FieldTypeRequiredDescription
metadataMetadata Object or nullX사용자 정보

Metadata Object

FieldTypeRequiredDescription
birth_yearIntX출생 도 (1900 년 부터 현재 연도)
birth_monthIntX출생 월 (1 ~ 12 월)
birth_dayIntX출생 일 (1 ~ 31 일, 월/윤년에 따라 실제 유효 범위 상이)
genderString (male, female, non_binary, other, prefer_not_to_say)X성별
heightFloatX키 (0~300 cm, 소수점 한자리까지 허용 )
weightFloatX체중 (0~1000 kg, 소수점 한자리까지 허용)

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

  • 사용자 생성 생성 성공

Body (result field)

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