Home
  • 한국어
  • ENGLISH
Home
  • 한국어
  • ENGLISH
  • API Guide
  • Withnox & Addnox

    • Introduction
    • Authentication
    • User
    • Analysis & History
  • LUX

    • Introduction
    • Authentication
    • Device
    • User

User

This page describes the APIs related to authentication for the LUX project.

Introduction

The LUX User API provides functions to perform user-related tasks such as Get User information, user info update and etc.

Authentication

Some authentication APIs require an authentication token. Please include the authentication token in the Authorization header to make authenticated API requests.

Authorization: Bearer your_token_here

Replace your_token_here with the access token obtained during the authentication process.

Endpoints

Get User Information

Retrieves the information of the logged-in user. The response indicates via boolean values whether it has been more than 3 months since the user last changed their password and whether a personal information update is required.

GET /api/v1/lux/user/me

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Request Example

GET /api/v1/lux/user/me HTTPS
Authorization: Bearer your_token_here

Response Example

200 OK
{
    "root_user_id": 1,
    "first_name": "test",
    "last_name": "kim",
    "birthdate": "20240722",
    "gender": "M",
    "phone": "+821012345678",
    "is_phone_number_checked": true,
    "register_type": "E",
    "national_code": "KR",
    "need_personal_info_update": false,
    "need_to_pwd_change": true,
    "is_device_muted": true,
    "is_device_alim_talk_enabled": true,
    "is_basestation_alert_enabled": true
}
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
401User is NoneNo registered user information found.
401User is DeletedThe user has deleted their account.
{
    "detail": "User is None"
}

Update User Information

Updates the information of the logged-in user.

PATCH /api/v1/lux/user/root-user

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
first_name optionalstringUser's first name.
last_name optionalUser's last name.
birthdate optionalstringUser's birthdate (yyyymmdd)
- Example : 19970101
gender optionalstringUser's gender
- M : Male
- F : Female
- N : Non-binary
- P : Prefer not to say

Request Example

PATCH /api/v1/lux/user/root-user HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json

{
  "first_name": "james",
  "last_name": "kim",
  "birthdate": "19970101",
  "gender": "M"
}

Response Example

200 OK
{
  "id": 1,
  "first_name": "james",
  "last_name": "kim",
  "birthdate": "19970101",
  "gender": "M",
  "phone": "+821012345678",
  "is_phone_number_checked": true,
  "register_type": "E"
}
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
401User is NoneUser information not found.
401User is DeletedUser has been deleted.
{
    "detail": "User is None"
}

Update User Policy

Updates the user's push notification and marketing notification settings.

PATCH /api/v1/lux/user/policy

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
is_push_agree optionalbooleanConsent to receive push notifications.
is_marketing_agree optionalbooleanConsent to receive marketing communications.

Request Example

PATCH /api/v1/lux/user/policy HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json

{
  "is_push_agree": true,
  "is_marketing_agree": true
}

Response Example

200 OK
{
  "is_push_agree": true,
  "is_marketing_agree": true,
  "push_agree_date": "2024-10-28T07:47:53.563Z",
  "marketing_agree_date": "2024-10-28T07:47:53.563Z"   
}
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
404User not foundNo registered user information found.
404User policy not foundNo user policy has been created.
409User policy update failedThe user's push token does not exist.
{
    "detail": "User policy update failed"
}

Set User Push Token

Saves the FCM token to the server to send push notifications to the user.

POST /api/v1/lux/user/push/set-token

Headers:

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters:

NameTypedescription
token requiredstringFCM Token.

Request Example:

POST /api/v1/lux/user/push/set-token HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json

{
  "token": string
}

Response Example:

200 OK
string
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
400Push permisson deniedPush permission has not been granted in the user policy.
409User push token update failedPlease check the token format again.
{
  "detail" : "User push token update failed"
}

Create Child User Account and Register Device

Creates a child account for the user and registers a device. The device registration process is combined for convenience of API calls.

POST /api/v1/lux/user/create-real-user

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
first_name requiredstringThe full name of the child account to be created.
last_name requiredstringThe full name of the child account to be created. Please send an empty string.
birthdate requiredstringThe birthdate of the child account to be created (yyyymmdd)
- Example : 19970101
gender requiredstringring The gender of the user.
- M : Male
- F : Female
- N : Non-binary
- P : Prefer not to say
serial_code requiredstringThe serial code of the device to register.
mac_id requiredstringThe MAC address of the device to register (send the last 4 characters in uppercase, excluding the colon).
unique_id requiredstringThe UUID of the device to register.

Request Example:

POST /api/v1/lux/user/create-real-user HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json
{
  "first_name": "test",
  "last_name": "",
  "birthdate": "19970101",
  "gender": "F",
  "serial_code": "SL20401000",
  "mac_id": "41AD",
  "unique_id": "unique"
}

Response Example:

200 OK
{
  "real_user_id": 1,
  "first_name": "test",
  "last_name": "",
  "birthdate": "19970101",
  "gender": "F",
  "device_id": 1,
  "now_firmware_id": 1,
  "unique_id": "unique",
  "serial_code": "SL20401000",
  "device_alias": "string",
  "last_log_file_id": 0,
  "created_at": "2024-10-28T08:09:47.889Z"
}
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
409Real user create failedFailed to create child account.
400Serial code is not validThe serial code is invalid.
401Not authorized userUser is not authorized.
404Not Found DeviceThe specified device could not be found.
409Already Connected DeviceThe device is already connected to another user.
{
    "detail": "Already Connected Device"
}

Get Child User Account

Retrieves the information of a user's child account. The real_user_id can be obtained from the /api/v1/lux/device/get-all-device endpoint.

GET /api/v1/lux/user/real-user/{real_user_id}

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Parameters

NameTypedescription
real_user_id requiredintegerThe ID of the child account.

Request Example

GET https://app.nueyne.dev/api/v1/lux/user/real-user/1 HTTPS
Authorization: Bearer your_token_here

Response Example

200 OK
{
  "id": 0,
  "root_user_id": 0,
  "first_name": "string",
  "last_name": "string",
  "birthdate": "string",
  "gender": "string"
}
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
401Not authorized userUser is not authorized.
404Real user is not foundChild account information not found.
{
    "detail": "Real user is not found"
}

Update Child User Information

Updates the information of a user's child account.

PATCH /api/v1/lux/user/update-real-user

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
id requiredintegerThe real_user_id of the child account to update.
first_name optionalstringThe new first name for the child account.
last_name optionalstringThe new last name for the child account.
birthdate optionalstringThe new birthdate for the child account (yyyymmdd)
- Example : 19970101
gender optionalstringThe new gender for the child account.
- M : Male
- F : Female
- N : Non-binary
- P : Prefer not to say

Request Example

PATCH https://app.nueyne.dev/api/v1/lux/user/real-user/1 HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json
{
  "id": 1,
  "first_name": "tester",
  "last_name": "john",
  "birthdate": "20010608",
  "gender": "P"
}

Response Example

200 OK
{
  "id": 1,
  "root_user_id": 1,
  "first_name": "tester",
  "last_name": "john",
  "birthdate": "20010608",
  "gender": "P"
}
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
401Not authorized userUser is not authorized.
404Real user is not foundChild account information not found.
{
    "detail": "User is None"
}

Update User Phone Number

Updates the user's phone number. Flow: Call SMS sending API -> Call this API.

POST /api/v1/lux/user/change-phone

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
phone requiredstringThe new phone number to change to.
validnum optionalstringThe verification code received via SMS.

Request Example

POST https://app.nueyne.dev/api/v1/lux/user/change-phone HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json
{
  "phone": "+821012345678",
  "validnum": "123456"
}

Response Example

200 OK
{
  "statusCode": 200,
  "message": "Root user phone updated"
}
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
400Validation code is expiredVerification code has expired.
400Validation code is invalidVerification code does not match.
403User previously deletedThe user has previously deleted their account.
409Phone number is already registeredThe phone number is already in use.
{
    "detail": "Validation code is expired"
}

Update User Notification Settings

Updates the user's notification settings. The default value for all notifications is false.

PATCH /api/v1/lux/user/notification

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
is_device_muted requiredbooleanEnable mute mode for the WithNox device.
is_device_alim_talk_enabled requiredbooleanEnable KakaoTalk notifications for WithNox device electrode contact.
is_basestation_alert_enabled requiredbooleanEnable notifications for the base station sensor.

Request Example

PATCH https://app.nueyne.dev/api/v1/lux/user/notification HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json
{
    "is_device_muted": 1,
    "is_device_alim_talk_enabled": 1,
    "is_basestation_alert_enabled": 1
}

Response Example

200 OK
{
    "is_device_muted": 1,
    "is_device_alim_talk_enabled": 1,
    "is_basestation_alert_enabled": 1
}
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
404User not foundUser information not found.
409User notification update failedUser notification update failed (contact server admin).
{
    "detail": "User not found"
}

Delete Child User Account and Unregister Device

Deletes a user's child account and unregisters the associated device.

DELETE /api/v1/lux/user/delete-real-user

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Parameters

NameTypedescription
real_user_id requiredintegerThe ID of the child account to delete.
unique_id requiredstringThe unique_id of the device to unregister.

Request Example

DELETE /api/v1/lux/user/delete-real-user HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json
{
  "real_user_id": 1,
  "unique_id": "string",
}

Response Example

200 OK
{
  "statusCode": 200,
  "message": "Real user deleted successfully",
}
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
401Not authorized userUser is not authorized.
404Real user is not foundChild account information not found.
409Real user delete failedFailed to delete child account.
{
    "detail": "Real user is not found"
}

Delete Account

Used when a user wants to withdraw or delete their account.

DELETE /api/v1/lux/user/root-user

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Request Example

DELETE /api/v1/lux/user/root-user HTTPS
Authorization: Bearer your_token_here

Response Example

200 OK
{
  "statusCode": 200, 
  "message": "Root user deleted"
}
ERROR

Error Response

Provides API status codes and messages for each HTTP status code. Refer to the table below.

HTTP status codedetaildescription
404Sign in type is not foundThe user's sign-up method (email, social) could not be found.
{
    "detail": "Sign in type is not found"
}

Common Error Handling

These are error codes that are commonly returned by all endpoints.

Error Response Example

  • 401 Unauthorized: The token is invalid.
    {
      "detail": "Could not validate credentials" // The token is invalid
    }
    
  • 401 Unauthorized: The token has expired.
    {
      "detail": "Token is expired" // The token has expired.
    }
    
  • 404 Not Found: The resource cannot be found. Please check the URI again.
    {
      "detail": "Resource not found"
    }
    
  • 500 Internal Server Error: This is a server error.
    {
      "detail": "Internal server error. Please try again later."
    }
    
Last Updated:: 6/9/25, 6:09 AM
Contributors: Jeongtae Kim, JeongTaeNueyne
Prev
Device