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:

Property
Data Type
Description

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 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

Property
Data Type
Required
Description

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).

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 code field).

  • If the resend is set to true, a new SMS verification code will be sent.

Path: /users/profile-with-loyalty/

Authentication Required: Yes

Headers:

Body Parameters

Property
Data Type
Required
Description

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).

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 code field.

  • 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

Property
Data Type
Required
Description

first_name

String

True

The first name of the user.

last_name

String

True

The last name of the user

email

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).

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:

Property
Data Type
Description

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)

Was this helpful?