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.
POST https://api.asleep.ai/ai/v1/users
Parameter Type Required Description x-api-key String O API Key
Parameter Type Required Description metadata Metadata Object or null X user metadata
Parameter Type Required Description birth_year Int? X birth year (1900 to the current year) birth_month Int? X birth month (1 ~ 12) birth_day Int? X birth day (1 ~ 31, actual effective range varies by month/leap year) gender String (male, female, non_binary, other, prefer_not_to_say)? X gender height Float? X height (0 ~ 300 cm, allow up to one decimal place) weight Float? X weight (0 ~ 1000 kg, allow up to one decimal place)
cURL
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
}
}'
new user has been successfully created
Field Type Description user_id String user id
JSON
{
"detail": "success",
"result": {
"user_id": "<USER_ID>"
}
}