User Profile & Segment Management
GET User Full Profile
This endpoint returns detailed information about the logged-in user, including their personal details such as name, email, phone number, gender, date of birth, and language preferences. It also includes settings for communication preferences and other attributes related to the user profile.
Path: /users/profile/
Authentication Required: Yes
Headers:
Accept-Language: <iso_language_code>
Cookie: <cookie-name>=<session_id>Example Request
import requests
url = "https://{commerce_url}/users/profile/"
headers = {
'Accept-Language': '<iso_language_code>',
'Cookie': '<cookie-name>=<session_id>'
}
response = requests.get(url, headers=headers)
print(response.text)Example Response (200 OK)
Response Parameters:
email_allowed
Boolean
Indicates whether the user has allowed receiving emails.
sms_allowed
Boolean
Indicates whether the user has allowed receiving SMS.
call_allowed
Boolean
Indicates whether the user has allowed receiving phone calls.
GET User Detailed Profile
This endpoint returns the same payload as the user full profile, extended with the last_login field and an extra_fields block that holds the order statistics of the logged-in user. The statistics are aggregated over all orders of the user, regardless of order status.
Path: /users/profile/detailed/
Authentication Required: Yes
Headers:
Example Request
Example Response (200 OK)
Response Parameters:
extra_fields.order_count
Integer
Total number of orders placed by the user.
extra_fields.total_order_amount
Decimal
Customer lifetime value; sum of the amounts of all orders. Returns 0 when the user has no order.
extra_fields.first_order_date
Datetime
Creation date of the first order. Returns null when the user has no order.
last_login
Datetime
Last login date of the user.
GET User Detail
This endpoint retrieves the details of the authenticated user, including their username, email, and full name.
Path: /users/user/
Authentication Required: Yes
Headers:
Example Request
Example Response (200 OK)
PATCH Update User Profile / Update Phone Number with OTP
This method allows users to update their profile information, including personal details, contact preferences, and language settings. Additionally, if a user wants to change their phone number, they must verify it using an OTP (One-Time Password).
To update the phone number, the new number should be provided in the phone parameter, and the OTP received via SMS should be sent in the code parameter. If the OTP is incorrect, expired, or missing, the request will be rejected with an appropriate error response. Users can also request a new OTP by setting the resend parameter to true.
Additionally, for the system to send SMS OTP, the SMS_GATEWAY and SMS_GATEWAYS dynamic settings must be properly configured. Ensure the correct SMS gateway provider is set up in the application settings, and verify that the gateway is operational.
This ensures that only authorized users can modify their phone numbers, adding an extra layer of security.
Path: /users/profile/
Authentication Required: Yes
Headers:
Body Parameters
first_name
String
False
The first name of the user.
last_name
String
False
The last name of the user
email_allowed
Boolean
False
Indicates if the user consents to receiving emails.
sms_allowed
Boolean
False
Indicates if the user consents to receiving SMS messages.
call_allowed
Boolean
False
Indicates if the user consents to receiving phone calls.
gender
String
False
Enum type representing the user's gender (male, female, not_to_say).
date_of_birth
Datefield
False
The user's date of birth, formatted as YYYY-MM-DD.
phone
String
True
The user's phone number, validated and required for updates.
attributes
Dict
False
Additional customizable user attributes in key-value pairs.
language_code
String
False
The user's preferred language code (e.g., en, de).
avatar
Image
False
The profile image of the user.
code
String
False
The verification code required for phone number changes. This parameter is used in UserProfileKvkkViewSet and UserProfileSMSOtpView.
resend
Boolean
False
Indicates if an verification code should be resent. This parameter is used in UserProfileKvkkViewSet and UserProfileSMSOtpView.
Request Body
Example Request
Example Response (200 OK)
Example Response (202 Accepted)
Example Response (406 Not Acceptable)
GET User Profile Information with Loyalty Card Account
This endpoint allows authenticated loyalty card users to retrieve their profile information.
Path: /users/profile-with-loyalty/
Authentication Required: Yes
Headers:
Example Request
Example Response (200 OK)
PATCH Update User Profile with Loyalty Card Account
This endpoint allows authenticated users to update their profile information. Updates can include changes to the phone number, which may require optional SMS verification, and synchronization with a linked loyalty card account.
The CUSTOMER_LOYALTY_CARD_SERVICE dynamic setting must be configured to communicate with the 3rd party loyalty card service.
The system validates the phone number to ensure its uniqueness.
If a phone number change is requested:
The system requires an SMS verification code (via the
codefield).If the
resendis set to true, a new SMS verification code will be sent.
Path: /users/profile-with-loyalty/
Authentication Required: Yes
Headers:
Body Parameters
first_name
String
False
The first name of the user.
last_name
String
False
The last name of the user
email_allowed
Boolean
False
Indicates if the user consents to receiving emails.
sms_allowed
Boolean
False
Indicates if the user consents to receiving SMS messages.
call_allowed
Boolean
False
Indicates if the user consents to receiving phone calls.
gender
String
False
Enum type representing the user's gender (male, female, not_to_say).
date_of_birth
Datefield
True
The user's date of birth, formatted as YYYY-MM-DD.
phone
String
True
The user's phone number, validated and required for updates.
attributes
Dict
False
Additional customizable user attributes in key-value pairs.
language_code
String
False
The user's preferred language code (e.g., en, de).
code
String
False
The SMS verification code required for phone number changes.
resend
Boolean
False
Indicates if an SMS verification code should be resent.
Request Body
Example Request
Example Response (202 Accepted)
SMS verification is required, and a code has been sent to the new phone number:
Example Response (200 OK)
When resend is True:
Example Response (406 Not Acceptable)
Example Response (400 Bad Request)
POST User Register with Loyalty Card Account
This endpoint allows users to register a new account, with the option to link their account to a loyalty card. The registration process includes SMS verification for the phone number and, if requested, loyalty account synchronization.
The CUSTOMER_LOYALTY_CARD_SERVICE dynamic setting must be configured to communicate with the third-party loyalty card service.
The system validates the phone number to ensure it is unique.
The system requires an SMS verification code, provided in the
codefield.If resend is set to true, a new SMS verification code is sent.
If add_loyalty is set to true, a loyalty card is created and synchronized with the user's account.
Path: /users/register-with-loyalty/
Authentication Required: No
Headers:
Body Parameters
first_name
String
True
The first name of the user.
last_name
String
True
The last name of the user
String
True
The email address of the user.
password
String
True
The password of the user
phone
String
True
The user's phone number, validated and required for updates.
email_allowed
Boolean
False
Indicates if the user consents to receiving emails.
sms_allowed
Boolean
False
Indicates if the user consents to receiving SMS messages.
call_allowed
Boolean
False
Indicates if the user consents to receiving phone calls.
gender
String
False
Enum type representing the user's gender (male, female, not_to_say).
date_of_birth
String
True
The user's date of birth, formatted as YYYY-MM-DD.
attributes
Dict
False
Additional customizable user attributes in key-value pairs.
language_code
String
False
The user's preferred language code (e.g., en, de).
code
String
False
The SMS verification code required for phone number changes.
resend
Boolean
False
Indicates if an SMS verification code should be resent.
add_loyalty
Boolean
False
Indicates whether a loyalty card should be created and linked to the user.
Request Body
Example Request
Example Response (201 Created)
Example Response (202 Accepted)
Example Response (200 OK)
When resend is True:
Example Response (406 Not Acceptable)
GET List User Segments
Lists all segments that are assigned to the authenticated user. Segments are typically used for categorizing users based on different attributes like roles, behaviors, or preferences.
Path: /users/segments/
Authentication Required: Yes
Headers:
Example Request
Example Response (200 OK)
Response Parameters:
pk
Integer
The unique ID of the segment.
priority
Integer
The priority of the segment, which may affect its ordering.
name
String
The name of the segment.
POST Set User Segment
This endpoint is used to assign a specific segment to the authenticated user. Segments are typically used for categorizing users based on different attributes like roles, behaviors, or preferences.
Set a specific segment for the authenticated user.
Path: /users/segments/<segment_id>/set/
Authentication Required: Yes
Headers:
Example Request
Example Response (200 OK)
Example Response (406 Not Acceptable)
Last updated
Was this helpful?

