[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
| Parameter | Type | Required | Description |
|---|---|---|---|
| x-api-key | String | O | API Key |
Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| metadata | Metadata Object or null | X | user metadata |
Metadata Object
| 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) |
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)
| Field | Type | Description |
|---|---|---|
| user_id | String | user id |
{
"detail": "success",
"result": {
"user_id": "<USER_ID>"
}
}Updated 12 months ago
Did this page help you?
