HomeAppVirality DocsAppVirality APIsSet User Referrer

Set User Referrer

This API call shall allow you to attribute a Referrer to a particular user

Most apps have enabled the option to allow users to enter the Invite Code separately through the app. This is pretty much a manual intervention of sorts.

Among all awesome things, AppVirality helps you do the same thing – with a simple API call, which you can cascade against an In-App field. A user has to simply enter the Invite Code he/she received, & the Referrer of the user shall then be set.


Base URL  https://api.appvirality.com

 POST         /v2_0/setuserreferrer

Content-Type application/json

Input i.e. Request

"userkey": "176502556c624614b913a62400ab4d7e",
"EmailId": "",
"UserIdInstore": "",
"ReferrerCode": "mapp2wer",
"avClick": "dsew-mapp2wer"
Input Params
Input Params Description
apikey API Key of the App 
Get it from Dashboard >> App Details
privatekey Private key for API requests 
Get it from: Dashboard >> App Details >> Click App Settings >> Scroll down to Advanced Settings
User Key of the App user, assigned by AppVirality – a unique identifier for every App User recorded
Email of the User, updated to AppVirality
Store Id of the App user, updated to AppVirality – a unique identifier of the user in your App
ReferrerCode Referrer's Referral Code: user will be attributed to his friend(one who invited) when on providing his referral code
AppVirality Click ID, this is query string parameter "avclk" value. This will be available if a user is redirected to App/Website by clicking on the referral link. If the user is already registered with you don't send this parameter
conditional – One of the conditional parameters is mandatory to identify the user. Priority for user identification is userkey, UserIdInstore and EmailId


  "userkey": "176502556c624614b913a62400ab4d7e",
  "shareurl": "http://r.appvirality.com/mapp2fag-da",
  "referralcode": "mapp2fag",
  "isExistingUser": false,
  "hasReferrer": true,
  "success": true,
  "statuscode": 1,
Response Params
Output Params Description
userkey User Key of the App user, assigned by AppVirality – a unique identifier for every App User recorded
shareurl Referral Link of the App user
referralcode Referral Code of the App user
isExistingUser (Boolean) This will be True, if the user is identified as an already registered user/device with Appvirality
hasReferrer (Boolean) This will be True if the user has a referrer
success (Boolean) Status of the API call. This will be true when the attribution is successful
message Information regarding API call (if relevant)
status code code based on status of the API call

Status codes which you will see while using Set User Referrer API

Status codes and description for API responses
Status Code Description
0 No data found for the search criteria
1 Success
5 Invalid StoreID or EmailID
13 Provided Click ID is Invalid
14 Error – Failed to Set Referrer Code
15 Referrer Code is his own code
16 Referrer is not Eligible to Participate in Campaign
18 Is an Existing User
19 Referrer Code doesn't exists
20 User Already Attributted
Was this article helpful to you? Yes 2 No