Gigya Job Openings

accounts.initRegistration JS

Skip to end of metadata
Go to start of metadata


This method initializes a registration process at a site. Site registration requires three API calls:

  1. accounts.initRegistration
  2. accounts.register
  3. accounts.finalizeRegistration.

This method returns a  regToken  (registration token) in the response, which is required when calling accounts.registeraccounts.finalizeRegistration.

For registration through a social network, see accounts.socialLogin.

Note: If you plan on integrating Gigya's Accounts API, we highly recommend reading the Registration-as-a-Service Guide. Registration-as-a-Service (RaaS) is a premium platform that requires separate activation. If RaaS is not part of your site package, please contact Gigya by filling in a support form through the Console. You can access the support page by clicking Support on the upper menu after logging into the Gigya Console.

This method is also supported in our REST API. It is highly recommended when possible, for security reasons, to execute this method from your server, so please refer to REST API > accounts.initRegistration





Method Parameters

This method does not have any required parameters. A callback, however, can be used to retrieve the regToken when necessary.

The following code example uses a very simple callback to show it's implementation.



Defines whether the regToken that is returned creates a full registered account or a lite account.  

This must be set to TRUE to create a lite account and receive a lite account regToken.

callbackfunctionA reference to a callback function. Gigya calls the specified function along with the results of the API method when the API method completes.
The callback function should be defined with the following signature: functionName(  response  ) .

Response Example

    "regToken": "RT1_stDPYG~02045353544b083130313130303935016f60~oAHqjSViRCJiHA-0laa91KduuxTltE4n7iytQruV8YR-krTRq6LDzshzLK9ii4oBLuVAzhcVLsyF1AqPmKquXmbFD8Ylrq2sPzIO1LIxwEc4uPYj_9Dm5H2y-LT-7NUCczBZRbLwB9ISjT6uQLTdiA_cJ5XAa6RzJBjebRDX5h-hovFTRqpfwgye1S351YTnQaQWnrPkEZiimW7rQm7adxvmEEiCUuvqjlhAwR1dnMr8p7o~",
    "statusCode": 200,
    "errorCode": 0,
    "statusReason": "OK",
    "callId": "fa3bb27490244ccebce4d9d072b482c1",
    "time": "2017-06-08T14:27:18.716Z",


Code Sample

<script type="text/javascript">
	function myCallback(response) {
	    if (response.errorCode== 0) {
	        myToken1 = response.regToken;
	    } else {
	        alert('There was an error!');
	function goInit() {
	    var params = {
	        "callback": myCallback,
// Now you can use the myToken1 variable in your accounts.register or accounts.finalizeRegistration calls

Lite Account Subscription Flow

Lite Registration is a premium product that requires separate activation. For inquiries, contact your Customer Engagement Executive by filling a support form. You can access the support page by clicking Support on the upper menu after logging into your Gigya Console.

Lite accounts differ from full registered accounts in several important ways *.

  • Lite accounts are NOT registered accounts.
  • Lite account users are not able to login to your site.
  • Lite accounts support additional limited functionality compared to full accounts.
  • The only two APIs required to create a lite account are:

You do not use accounts.register or accounts.finalizeRegistration in a lite account flow.To learn more about Lite Accounts, see the Lite Registration documentation.

The following will demonstrate how you can register a user's email address or update an existing lite account using Gigya's web SDK.

1.    If not using Screen-Sets, you will need to collect some basic information from the user. The minimum data required is an email address.

2.    If necessary, ensure that you defined the necessary subscription in your site's schema. This can be done using either the Screen-Sets UI Builder or the accounts.setSchema API.

3.   After the user confirms they would like to subscribe to your site/newsletter/etc., call accounts.initRegistration and pass isLite: true so the API recognizes that this is not for a full registration, and also a callback so you can retrieve the user's regToken which you will need in the next step.

gigya.accounts.initRegistration({ isLite: true, callback: liteRegistrationCallback });

4.   In the callback, call accounts.setAccountInfo and pass the following minimum parameters:

  • regToken (required - The regToken you received from accounts.initRegistration)
  • profile (required - If you have any profile data to associate with this user, i.e., profile.firstName, profile.lastName, etc. At a minimum you must pass an email address.)
  • subscriptions (optional - This must be an active subscription pre-defined in your site's schema. You can create lite accounts that do not have a subscription.)

A code example of the entire process follows, see Subscriptions Object REST for a full description of the subscription object:


JS Code Example

function liteRegistrationCallback(res) {
    var myToken,myEmail,myProfile,callParams;
    myToken = res.regToken;
    myEmail = "The user's email address";
    myProfile = {
        "email" : myEmail
        //, any additional profile data collected, i.e., firstName
    callParams = {
        "regToken": myToken,
        "profile": myProfile,
        "subscriptions": {
            "jun4th":{ // This MUST be active and predefined in your site's schema or setAccountInfo will fail!
                    "isSubscribed":true, // This tells whether the user is actually subscribed to the subscription, this can be false if the user registers but does not want to receive the newsletter.
                        // Any tags you want to associate with this user.
                        // The tags property should be removed if you are not setting tags or any existing data will be deleted.
function liteRegStart() {
        isLite: true,
        callback: function(res) {


5.   Once the call completes the user will have a new lite account on your site. You can then query this and other lite accounts on your site using the API or view them from the Identity Access page of the Gigya Console.

Response Example Using The isLite Parameter

// Note the regToken contains _LTE_ which designates this is a lite account regToken


Additional Information

For configuring a screen-set to support lite account creation, see our Lite Registration Quick Start Guide.


* If a client is not currently participating in our Early Adopters Program, Lite Accounts will not contain a UID.