Skip to main content

Initialize Customer (Register/Identify)

Register or update a customer whenever they log in or register in your app.
🔒
Secure API Access: To benefit from v4.1 secure API endpoints, pass the sessionToken parameter when calling methods (required in upcoming SDK v4). This enables automatic routing to v4.1 secure endpoints. Learn more about v4.1 →

Request Parameters

string
required
Unique identifier for the customer. This should never change for a given customer.
string
Customer’s email address.
string
Customer’s mobile number with country code.
string
Push notification token (required if pushProvider is set).
'Firebase' | 'Huawei'
Push notification provider (required if deviceToken is set).
CustomerAttributes
Additional customer attributes.
string
Referral code if customer was referred by another customer.
boolean
Guest user flag (defaults to false).
string
Optional session token to override the global token for this specific request. Required in upcoming SDK v4.
In React Native SDK, passing a sessionToken parameter updates the global session token. Pass undefined to clear the global token, or omit it to use the current global token.

Validation Rules

InitializeCustomerRequest requires:
  • customerId cannot be empty or whitespace
  • If deviceToken is provided, pushProvider must also be specified
  • If pushProvider is specified, deviceToken must also be provided

CustomerAttributes

Choose an Unchangeable Customer IDThe customerId should be a permanent identifier that will NEVER change. Avoid using email or phone number as the customer ID since these can be updated by users.

Next Steps