User Management & Authentication
GET
Current User
GET
Current UserFetches the information of the currently logged-in user. The response includes user details such as their primary key, name, email, and various attributes.
Path: /current_user/
Authentication Required: Yes
Headers:
Example Request
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.
hashed_email
String
The hashed version of the user's email for privacy and security purposes.
is_email_verified
Boolean
Indicates whether the user's email address has been verified.
is_social_networks_connected
Boolean
Indicates whether the user's account is connected to any social networks.
client_type
Enum
Values: “default”, “android”, “ios”, “instore”, “b2b”.
selected_address
Dict
Contains the details of the user’s selected address.
POST
User Login
POST
User LoginUsed to facilitate the user’s log-in process. Cookies of the returned response must be stored by the client and sent with the next API requests.
Path: /users/login
Authentication Required: No
Headers:
Body Parameters
string
True
The email address of the user.
password
string
True
The password of the user.
Request Body
Example Request
Example Response (200 OK)
Response Headers:
Example Response (400 Bad Request)
POST
User Logout
POST
User LogoutThis endpoint logs out the currently authenticated user by deleting their session data. After the request is processed, the user is unauthenticated and must log in again to access authenticated endpoints.
Path: /users/logout/
Authentication Required: Yes
Headers:
Request Body
None
Example Request
Example Response (200 OK)
No content is returned in the response body. The 200 OK status indicates that the user has been successfully logged out and their session invalidated.
POST
User Registration with OTP
POST
User Registration with OTPThis endpoint allows users to create a new account. The registration process requires SMS OTP verification, which must be activated via the settings.
To enable SMS OTP verification, the following two environment variables must be added to the Commerce service in ACC.
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.
Path: /users/registration/
Authentication Required: No
Headers:
Query Parameters
next
String
False
Redirect url
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.
confirm
Boolean
True
Indicates that confirmation of the privacy policy must be set to True
.
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
False
The user's date of birth, formatted as YYYY-MM-DD
.
username
String
False
The username of the user.
user_type
String
False
A string that indicates the type of user. A string that indicates the type of user.
phone
String
False
The user's phone number, validated and required for updates.
attributes
Dict
False
Additional customizable user attributes in key-value pairs.
code
String
False
The verification code required for phone number changes. This parameter is used in RegisterKvkkView - RegisterKvkkSerializer and RegisterSMSOtpView - RegisterSMSOtpSerializer.
resend
String
False
Indicates if an verification code should be resent. This parameter is used in RegisterKvkkView - RegisterKvkkSerializer and RegisterSMSOtpView - RegisterSMSOtpSerializer.
Request Body
Example Request
Example Response (201 Created)
If the next
query parameter is provided, it is used to set the redirect_url.
key:
token
is used for authentication.
Example Response (201 Created)
Example Response (202 Accepted)
Example Response (200 OK)
When resend
is True:
Example Response (400 Bad Request)
When confirm
is False:
Example Response (400 Bad Request)
There is a GUEST_USER_REGISTRATION_REQUIRES_EMAIL_VERIFICATION
dynamic setting. When it is set to true and the request data is available:
Example Response (406 Not Acceptable)
POST
/GET
User Registration Email Confirmation
POST
/GET
User Registration Email ConfirmationThis endpoint handles email confirmation for users during the account activation process. It validates the confirmation key provided in the URL and confirms the user's email address.
Path: /users/registration/account-confirm-email/<key>/
Authentication Required: Yes
Headers:
Example Request
Example Response (200 OK)
Email confirmation succeeded, and the HTML file returned.
Example Response (404 Not Found)
If the confirmation key is invalid or expired:
POST
User Registration Verify Email
POST
User Registration Verify EmailThis endpoint verifies the user's email address by using the token sent via email. After the user registers, they will receive an email with a token that they need to submit to verify their email and activate their account.
Path: /users/registration/verify-email/
Authentication Required: Yes
Headers
Body Parameters
key
string
True
The verification token sent to the user’s email.
Request Body
Example Request
Example Response (200 OK)
GET
Verify User Email
GET
Verify User EmailThis endpoint verifies the user's email address. The user completes the verification process by clicking a confirmation link sent to their email. The signed_email
and user_id_key
are unique tokens generated by the commerce system to ensure secure validation.
Path: /users/email-verify/<signed_email>/<user_id_key>/
POST
Add New User Email
POST
Add New User EmailThis endpoint allows users to add a new email address to their account. A confirmation email is sent to the provided email address. The email is added only after the user confirms it through the link in the confirmation email.
Path: /users/emails/
Authentication Required: Yes
Headers:
Body Parameters
string
True
The email address to be added.
Request Body
Example Request
Example Response (200 OK)
The email has been added successfully, and a confirmation email has been sent:
Example Response (400 Bad Request)
If the email already exists:
GET
Set User Email as Primary
GET
Set User Email as PrimaryThis endpoint confirms the user's selection of a primary email address. The user completes the confirmation process by clicking a link sent to their email. The signed_email
and user_id_key
are unique tokens generated by the commerce system to ensure secure validation.
Path: /users/email-set-primary/<signed_email>/<user_id_key>/
POST
User Email Change
POST
User Email ChangeThis endpoint updates the primary email address of an authenticated user. A verification email is sent to the new email address, and the change is confirmed only after successful verification.
Path: /users/email-change/
Authentication Required: Yes
Headers:
Body Parameters
string
True
The new email address to set for the user.
password
string
True
The user's current password for validation.
Request Body
Example Request
Example Response (200 OK)
Example Response (400 Bad Request)
GET
User Email Show
GET
User Email ShowThis endpoint retrieves the email details associated with the authenticated user, including whether the email is verified and if it is the primary email.
Path: /users/emails/
Authentication Required: Yes
Headers:
Example Request
Example Response (200 OK)
Response Parameters:
id
Integer
The unique identifier of the email record.
String
The email address associated with the user.
verified
Boolean
Indicates if the email address has been verified.
primary
Boolean
Indicates if this is the primary email address of the user.
user
Integer
The unique identifier of the user who owns the email.
PATCH
KVKK Unsubscribe User
PATCH
KVKK Unsubscribe UserThis endpoint is used to update users' communication preferences as per KVKK (Turkish Personal Data Protection Law). The service utilizing this hook must be pre-registered. It allows unsubscribing users from email, SMS, or phone call permissions.
Path: /users/hooks/kvkk-unsubscribe-user/
Authentication Required: No
Headers:
Body Parameters
service_name
String
True
The name of the service using the hook.
hash_value
String
True
A SHA-256 hash generated by encrypting the secret_key
and request_datetime
.
request_datetime
String
True
Specifies the time the request was sent. It must be in timezone-aware ISO format: YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM
unsubscribed_users
List
True
A list of users to unsubscribe, including their email or phone details.
unsubscribed_users.phone
String
False
The phone number of the user (either phone
or email
must be provided, but not both).
unsubscribed_users.email
String
False
The email address of the user (either phone
or email
must be provided, but not both).
unsubscribed_users.email_allowed
Boolean
False
Whether the user allows email communication.
unsubscribed_users.sms_allowed
Boolean
False
Whether the user allows SMS communication.
unsubscribed_users.call_allowed
Boolean
False
Whether the user allows phone call communication.
Each user's subscription information must be specified as follows:
Only one of the
phone
oremail
fields can be used. Both cannot be provided at the same time.The
email_allowed
,sms_allowed
, andcall_allowed
fields can only have a value ofFalse
; these fields only allow the user to opt out of these communication channels.
Hash Calculation
The service checks the hash_value
provided by the user. This value is calculated using the secret_key
and request_datetime
. Below is a step-by-step explanation of how to compute the hash value.
1. Creating the Hash String: First, a string is created using the combination of secret_key
and request_datetime
(the time of the request) in ISO format.
secret_key: The key provided by the subscription service.
request_datetime: The timestamp of the request in ISO format.
The hash string is concatenated as follows:
Example:
secret_key
:"my_secret_key"
request_datetime
:"2024-09-26 10:49:58.694785+00:00"
request_datetime.isoformat()
:“2024-09-26T10:49:58.694785+00:00”
Hash string:
2. Calculating the Hash: The generated string is then hashed using the SHA-256 algorithm. This process converts the string into a fixed-length hash value, ensuring data confidentiality.
Example:
hash_string
:"my_secret_key2024-09-26T10:49:58.694785+00:00"
Calculated hash:
Resulting hash value:
Request Body
Example Request
Example Response (200 OK)
PATCH
Unsubscribe User
PATCH
Unsubscribe UserThis endpoint is used to update users' communication preferences. The service utilizing this hook must be pre-registered. It specifically targets unsubscribing users from various communication permissions (email, SMS, or phone).
Path: /users/hooks/unsubscribe-user/
Authentication Required: No
Headers:
Body Parameters
service_name
String
True
The name of the service using the hook.
hash_value
String
True
A SHA-256 hash generated by encrypting the secret_key
and request_datetime
.
request_datetime
String
True
Specifies the time the request was sent. It must be in timezone-aware ISO format: YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM
unsubscribed_users
List
True
A list of users to unsubscribe, including their email or phone details.
unsubscribed_users.email
String
True
The email of the user to be unsubscribed.
unsubscribed_users.email_allowed
Boolean
False
Whether the user allows email communication.
unsubscribed_users.sms_allowed
Boolean
False
Whether the user allows SMS communication.
unsubscribed_users.call_allowed
Boolean
False
Whether the user allows phone call communication.
Hash Calculation
The hash calculation varies depending on each subscription gateway.
Request Body
Example Request
Example Response (200 OK)
PATCH
User Anonymization
PATCH
User AnonymizationThis endpoint allows an authenticated user to anonymize their personal data, in compliance with data privacy regulations. When anonymized, the following actions occur:
Identifying details (e.g., name, email, phone number): These are hashed to ensure user privacy.
Linked social accounts and email addresses: All associated accounts are anonymized.
User account: The account is deactivated.
The feature depends on the dynamic_settings.SELF_ANONYMIZATION_ENABLED
configuration being set to True
. By default, this setting is False
.
Path: /users/anonymize/
Authentication Required: Yes
Headers:
Example Request
Example Response (401 Unauthorized)
Authentication credentials were not provided:
Example Response (403 Forbidden)
The feature is disabled (SELF_ANONYMIZATION_ENABLED
is False
):
Example Response (200 OK)
Anonymization is successful, and no content is returned.
Last updated
Was this helpful?