User
Overview
In Let'sTrade, a User refers to the customer who interacts with the system. Users can sign up, log in, manage their profiles, addresses, and more. This documentation provides detailed information on the endpoints related to user management.
API Base URL
The base URL for all API endpoints is:
https://lets-trade-user-prod.letstrade.globalUser Definition
A User in Let'sTrade represents an individual customer who can interact with the platform to perform various activities such as purchasing products, managing orders, and updating personal information. The User entity is fundamental to the system, encapsulating all necessary details to provide a personalized and secure experience.
Attributes of a User
ID (
id): A unique identifier assigned to each user.Name (
name): The first name of the user.Surname (
surname): The last name of the user.Cell Number (
cell_number): The user's mobile phone number.Email (
email): The user's email address.Password (
password): A secure password for user authentication.Birthday (
birthday): The user's date of birth.Device ID (
device_id): An identifier for the device used by the user.Firebase Token (
firebase_token): A token for Firebase Cloud Messaging (FCM) to enable push notifications.Get Communication (
get_communication): A flag indicating whether the user has opted in to receive communications.Agrees to Terms and Conditions (
agrees_terms_and_conditions): A flag indicating whether the user has accepted the terms and conditions.Loyalty Sign Up (
loyalty_sign_up): A flag indicating whether the user needs to be signed up for your loyalty program.
Signup
POST /user/sign_up
Registers a new user in the Let'sTrade system.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
name
string
The first name of the user
surname
string
The last name of the user
cell_number
string
The user's mobile phone number
email
string
The user's email address
password
string
A secure password for user authentication
birthday
string
The user's date of birth. Format: yyyy-mm-dd
device_id
string
An identifier for the device used by the user
firebase_token
string
A token for Firebase Cloud Messaging (FCM) to enable push notifications.
get_communication
boolean
A flag indicating whether the user has opted in to receive communications.
agrees_terms_and_conditions
boolean
A flag indicating whether the user has accepted the terms and conditions.
loyalty_sign_up
boolean
A flag indicating whether the user needs to be signed up for your loyalty program.
Sample Request
{
"name": "John",
"surname": "Doe",
"cell_number": "1234567890",
"email": "[email protected]",
"password": "securepassword",
"birthday": "1990-01-01",
"device_id": "abc123device",
"firebase_token": "xyz789token",
"get_communication": true,
"agrees_terms_and_conditions": true,
"loyalty_sign_up": false
}Response
{
"success": true,
"message": "Successfully signed up!",
"content": {
"user": {
"client_id": "642423d9de237b000e1cccd6",
"parent_id": null,
"name": "John",
"surname": "Doe",
"cell_country_code": "+27",
"cell_number": "1234567890",
"email": "[email protected]",
"role": "USER",
"birthday": "1990-01-01T00:00:00.000Z",
"gender": "N/A",
"status": "ACTIVE",
"needs_password_change": false,
"device": {
"device_id": "abc123device",
"firebase_token": "xyz789token",
"apns_token": null
},
"get_communication": true,
"agrees_terms_and_conditions": true,
"floating_fleet": false,
"imported": false,
"extra_data": [],
"_id": "669e2bb3ea10875401c4e4d2",
"children": [],
"channels": [],
"createdAt": "2024-07-22T09:51:47.228Z",
"updatedAt": "2024-07-22T09:51:47.228Z"
},
"token": "eyJhbGciOiJIUzIR5cCI6IkpXVCJ9.eyJfaWQiOiI2NjllMmJiM2VhMTA4NzU0MDFjNGU0ZDIiLCJjbGllbnRfaWQiOiI2NDI0MjNkOWRlMjM3YjAwMGUxY2NjZDYiLCJuYW1lIjoiSm9obiIsInN1cm5hbWUiOiJEb2UiLCJlbWFpbCI6ImpvaG4uZG9lQGV4YW1wbGUuY29tIiwiY2VsbF9udW1iZXIiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNzIxNjQxOTA3fQ.aKv2njCMvKI0PNBDuYqJkbBcSLgubYSmrXjqtUEtdnE",
"loyalty_program": null
}
}Signin with Cell Number
POST /user/sign_in
Authenticates a user using their cell number and password
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
cell_number
string
The user's mobile phone number
password
string
A secure password for user authentication
firebase_token
string
A token for Firebase Cloud Messaging (FCM) to enable push notifications.
Sample Request
{
"cell_number": "1234567890",
"password": "securepassword",
"firebase_token": "xyz789token"
}Response
{
"success": true,
"message": "Successfully signed in!",
"content": {
"user": {
"device": {
"device_id": "abc123device",
"firebase_token": "xyz789token",
"apns_token": null
},
"_id": "669e2bb3ea10875401c4e4d2",
"client_id": "642423d9de237b000e1cccd6",
"parent_id": null,
"name": "John",
"surname": "Doe",
"cell_country_code": "+27",
"cell_number": "1234567890",
"email": "[email protected]",
"role": "USER",
"birthday": "1990-01-01T00:00:00.000Z",
"gender": "N/A",
"status": "ACTIVE",
"needs_password_change": false,
"get_communication": true,
"agrees_terms_and_conditions": true,
"floating_fleet": false,
"imported": false,
"extra_data": [],
"children": [],
"channels": []
},
"token": "eyJhbGciOiJInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NjllMmJiM2VhMTA4NzU0MDFjNGU0ZDIiLCJjbGllbnRfaWQiOiI2NDI0MjNkOWRlMjM3YjAwMGUxY2NjZDYiLCJuYW1lIjoiSm9obiIsInN1cm5hbWUiOiJEb2UiLCJlbWFpbCI6ImpvaG4uZG9lQGV4YW1wbGUuY29tIiwiY2VsbF9udW1iZXIiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNzIxNjQxOTk0fQ.k7G0_NnrwgTMpvsUDGowoaLn8TrGUB6W3frG7mf6iOM"
}
}Signin with Email
POST /user/sign_in
Authenticates a user using their email and password
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
email
string
The user's email address
password
string
A secure password for user authentication
firebase_token
string
A token for Firebase Cloud Messaging (FCM) to enable push notifications.
Sample Request
{
"email": "[email protected]",
"password": "securepassword",
"firebase_token": "xyz789token"
}Response
{
"success": true,
"message": "Successfully signed in!",
"content": {
"user": {
"device": {
"device_id": "abc123device",
"firebase_token": "xyz789token",
"apns_token": null
},
"_id": "669e2bb3ea10875401c4e4d2",
"client_id": "642423d9de237b000e1cccd6",
"parent_id": null,
"name": "John",
"surname": "Doe",
"cell_country_code": "+27",
"cell_number": "1234567890",
"email": "[email protected]",
"role": "USER",
"birthday": "1990-01-01T00:00:00.000Z",
"gender": "N/A",
"status": "ACTIVE",
"needs_password_change": false,
"get_communication": true,
"agrees_terms_and_conditions": true,
"floating_fleet": false,
"imported": false,
"extra_data": [],
"children": [],
"channels": []
},
"token": "eyJhbGciOiJInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NjllMmJiM2VhMTA4NzU0MDFjNGU0ZDIiLCJjbGllbnRfaWQiOiI2NDI0MjNkOWRlMjM3YjAwMGUxY2NjZDYiLCJuYW1lIjoiSm9obiIsInN1cm5hbWUiOiJEb2UiLCJlbWFpbCI6ImpvaG4uZG9lQGV4YW1wbGUuY29tIiwiY2VsbF9udW1iZXIiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNzIxNjQxOTk0fQ.k7G0_NnrwgTMpvsUDGowoaLn8TrGUB6W3frG7mf6iOM"
}
}Update Password
PUT /user/update_password
Updates the user's password.
Note: The user's token obtained from the signup or login response must be used for authorisation in the request header.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
current_password
string
Current secure password for user
new_password
string
New secure password for user
Sample Request
{
"current_password": "oldpassword",
"new_password": "newsecurepassword"
}Response
{
"success": true,
"message": "Successfully updated password!",
"content": {
"user": {
"device": {
"device_id": "abc123device",
"firebase_token": "xyz789token",
"apns_token": null
},
"_id": "669e2bb3ea10875401c4e4d2",
"client_id": "642423d9de237b000e1cccd6",
"parent_id": null,
"name": "John",
"surname": "Doe",
"cell_country_code": "+27",
"cell_number": "1234567890",
"email": "[email protected]",
"role": "USER",
"birthday": "1990-01-01T00:00:00.000Z",
"gender": "N/A",
"status": "ACTIVE",
"needs_password_change": false,
"get_communication": true,
"agrees_terms_and_conditions": true,
"floating_fleet": false,
"imported": false,
"extra_data": [],
"children": [],
"channels": [],
"last_signin": "2024-07-22T09:53:14.419Z"
},
"token": "eyJhbGciOiJIUzCI6IkpXVCJ9.eyJfaWQiOiI2NjllMmJiM2VhMTA4NzU0MDFjNGU0ZDIiLCJjbGllbnRfaWQiOiI2NDI0MjNkOWRlMjM3YjAwMGUxY2NjZDYiLCJuYW1lIjoiSm9obiIsInN1cm5hbWUiOiJEb2UiLCJlbWFpbCI6ImpvaG4uZG9lQGV4YW1wbGUuY29tIiwiY2VsbF9udW1iZXIiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNzIxNjQyMTE4fQ.kbuicJ33R0TB0ab0FzXOUmxxHXX2AlLIjnUDemncxJw"
}
}Add Address
POST /v2/add/address
Adds a new address for the user.
Note: The user's token obtained from the signup or login response must be used for authorization in the request header.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
label
string
User elected label of address for ease of identification
full_address
string
longitude
string
latitude
string
default
boolean
Sample Request
{
"label": "Home",
"full_address": "123 Main St, Apt 4B, Springfield, IL, 62704, USA",
"longitude": "-89.6500",
"latitude": "39.7817",
"default": false
}Response
{
"success": true,
"message": "Successfully added address!",
"content": {
"_id": "6551e6a9b1813059cea33fd2",
"label": "HOME",
"__v": 0,
"client_id": "642423d9de237b000e1cccd6",
"coordinates": [
-89.65,
39.7817
],
"createdAt": "2023-11-13T09:04:41.462Z",
"default": false,
"full_address": "123 Main St, Apt 4B, Springfield, IL, 62704, USA",
"type": "Point",
"updatedAt": "2024-07-22T09:56:06.853Z",
"user_id": "669e2bb3ea10875401c4e4d2",
"business_name": "",
"complex_building_details": "Bonsai estate",
"is_residential": true,
"longitude": "-89.65",
"latitude": "39.7817"
}
}Get User Addresses
GET /v2/address/list
Retrieves all addresses associated with the user.
Note: The user's token obtained from the signup or login response must be used for authorisation in the request header.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Response
{
"success": true,
"message": "Successfully retrieved 1 address(es)",
"content": {
"addresses": [
{
"_id": "6551e6a9b1813059cea33fd2",
"label": "HOME",
"full_address": "123 Main St, Apt 4B, Springfield, IL, 62704, USA",
"longitude": "-89.65",
"latitude": "39.7817",
"default": false,
"is_residential": true,
"business_name": "",
"complex_building_details": "Bonsai estate"
}
],
"count": 1
}
}Update Address
PUT /v2/update/address
Updates an existing address for the user.
Note: The user's token obtained from the signup or login response must be used for authorization in the request header.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
id
string
Unique address identifier
label
string
User elected label of address for ease of identification
full_address
string
longitude
string
latitude
string
default
boolean
Sample Request
{
"id": "address123",
"label": "Home",
"full_address": "123 Main St, Apt 4B, Springfield, IL, 62704, USA",
"longitude": "-89.6500",
"latitude": "39.7817",
"default": false
}Response
{
"success": true,
"message": "User address successfully updated.",
"content": {
"_id": "6551e6a9b1813059cea33fd2",
"label": "HOME",
"client_id": "642423d9de237b000e1cccd6",
"coordinates": [
-89.65,
39.7817
],
"default": false,
"full_address": "123 Main St, Apt 4B, Springfield, IL, 62704, USA",
"type": "Point",
"user_id": "669e2bb3ea10875401c4e4d2",
"business_name": "",
"complex_building_details": "Bonsai estate",
"is_residential": true,
"latitude": "39.7817",
"longitude": "-89.65"
}
}Delete Address
PUT /v2/delete/address
Updates an existing address for the user.
Note: The user's token obtained from the signup or login response must be used for authorisation in the request header.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
id
string
Generated id of the address
Sample Request
{
"id": "address123"
}Response
{
"success": true,
"message": "Successfully deleted address!",
"content": {
"_id": "6551e6a9b1813059cea33fd2",
"label": "HOME",
"__v": 0,
"client_id": "642423d9de237b000e1cccd6",
"coordinates": [
-89.65,
39.7817
],
"createdAt": "2023-11-13T09:04:41.462Z",
"default": false,
"full_address": "123 Main St, Apt 4B, Springfield, IL, 62704, USA",
"type": "Point",
"updatedAt": "2024-07-22T09:59:00.952Z",
"user_id": "669e2bb3ea10875401c4e4d2",
"business_name": "",
"complex_building_details": "Bonsai estate",
"is_residential": true,
"latitude": "39.7817",
"longitude": "-89.65"
}
}Update User
PUT /v2/update/user
Updates user profile information.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
_id
string
Generated _id of the user
name
string
The first name of the user
surname
string
The last name of the user
cell_number
string
The user's mobile phone number
email
string
The user's email address
Sample Request
{
"_id": "user123",
"name": "John",
"surname": "Doe",
"cell_number": "1234567890",
"email": "[email protected]"
}Response
{
"success": true,
"message": "Successfully updated John Doe",
"content": {
"device": {
"device_id": "abc123device",
"firebase_token": "xyz789token",
"apns_token": null
},
"_id": "669e2bb3ea10875401c4e4d2",
"client_id": "642423d9de237b000e1cccd6",
"parent_id": null,
"name": "John",
"surname": "Doe",
"cell_country_code": "+27",
"cell_number": "1234567890",
"email": "[email protected]",
"role": "USER",
"birthday": "1990-01-01T00:00:00.000Z",
"gender": "N/A",
"status": "ACTIVE",
"needs_password_change": false,
"get_communication": true,
"agrees_terms_and_conditions": true,
"floating_fleet": false,
"imported": false,
"extra_data": [],
"children": [],
"channels": [],
"last_signin": "2024-07-22T09:55:18.602Z"
}
}Last updated