User
The User API can be used to create, update and display users' information on Referd. Users are uniquely identified by playerUniqueId.
Available Endpoints
Type
Description
Endpoint
POST
/integrations/player
GET
/integrations/player/{playerUnqiueId}
DELETE
/integrations/player/{playerUnqiueId}
GET
/integrations/transactions/{playerUniqueId}/coupon
GET
/integrations/players/{playerUniqueId}/referrals
POST - Create User
The API call is used to create or update a user in Referd with the provided attributes.
Request
Header
Attribute
Type
Required
Description
APIKey
string
Yes
Client API key
Body
playerUniqueId
string
Yes
Unique identifier for the user in your database.
Could be database ID, random string, email or anything that uniquely identifies the user.
playerAttributes
object
No
deviceToken
string
No
The FCM token (Firebase Cloud Messaging) needed for sending mobile push notifications. (Used only in case of mobile app)
osType
string
No*
OS Type according to the mobile device used (if any).
Note: Required in case deviceToken
is sent in the payload (e.g. "android", "ios")
playerAttributes
Object
playerAttributes
ObjectParameter
Type
Description
displayName
string
User's display name.
firstName
string
User's first name.
lastName
string
User's last name.
mobile
string
User's mobile number.
gender
string
User's gender. Example: M or F, Male or Female.
email
string
User's email.
dateOfBirth
string
User's date of birth.
Example: "1980-09-19T00:00:00.000Z"
joinDate
string
User's join date at your system.
Example: "2019-09-19T21:06:29.158Z"
tags
string
Comma separated string of tags to be attached to the user.
Example: "VIP,Platinum"
country
string
Country of the user.
city
string
City of the user.
zip
string
ZIP of the user.
totalSpent
float
Total amount spent by user.
totalOrders
int
Total orders by user.
lastOrderDate
date
Last order date.
avgOrderAmount
float
Average order amount.
custom
object
Key value pairs of any extra player attributes.
{"class" : "E2022", "weight" : 78}
To ensure that a referral is properly counted, it is a must that the newly created user includes the same email
or mobile
in the playerAttributes
(specified in the request body) same as provided during the referral landing page submission.
Response
playerUniqueId
string
Unique identifier for the user at Referd.
gameballId
string
User's ID at Referd.
referralLink
string
Referral URL.
Sample Response
Usage Examples
Example One
This example creates a new user at Referd, using playerUniqueId
, playerAttributes
with custom
attributes.
Example Two
To complete the referral process, the new user must visit the referral link provided by the referrer and input their mobile phone number or email based on the client's specified configuration. Subsequently, a request should be sent to Referd to register this user. It is crucial that the new user re-enters the same email
or mobile
, which was initially provided on the landing page, within the playerAttributes
sent in the create user request.
In the following example, a request is sent to Referd to create a user with the email 'tyrion@example.com'
who was successfully referred by another user. The email is included within the playerAttributes
. To ensure the referral is counted, the user must input the same email during the referred player's registration on the landing page.
Note: All attributes inside the playerAttributes
object are optional, if the values of any attributes shown below are unavailable, remove the attribute from the playerAttributes
object.
GET - Retrieve User
This API call is used to retrieve user's information.
Request
Header
APIKey
string
Yes
Client APIKey
Lang
string
No
Language to get the user's info with. If not provided, the response would be in default language.
Note: The language provided should be as per configured languages in your account.
Example: "en"
, "fr"
.
Path Parameters
Parameter
Type
Required
Description
playerUniqueId
string
Yes
Unique identifier for the user at Referd.
Response
Parameter
Type
Description
playerUniqueId
string
Unique identifier for the user at Referd.
playerAttributes
object
referralLink
string
Referral URL.
Sample Response
Usage Example
The example shown is a request sent to Referd to get a user info with playerUniqueId
“player456”.
DELETE - Delete User
This API is used to delete a user along with his attributes, rewards and actions.
Request
Header
Attribute
Type
Required
Description
APIKey
string
Yes
Client API key
secretKey
string
Yes
Client Secret Key
Path Parameters
Attribute
Type
Required
Description
playerUniqueId
string
Yes
Unique identifier for the user at Referd.
Usage Example
GET - User's Coupons
This endpoint is used to get the Coupons of a specific user.
Request
Header
Attribute
Type
Required
Description
APIKey
string
Yes
Client API key
secretKey
string
Yes
Client Secret Key
Path Parameters
Attribute
Type
Required
Description
playerUniqueId
string
Yes
Unique identifier for the user at Referd.
Response
Attribute
Type
Description
coupons
array
coupon
Object
coupon
Objectcode
string
Coupon Code.
isUsed
boolean
A boolean indicating if the coupon was used by the specified user.
value
double
Value of coupon. ( in the case of percentage discount this would be the value in percentage of the coupon)
currency
string
Currency of the coupon.
creationDate
DateTime
The date that the coupon was created on.
couponType
string
Indicates the type of the coupon, the value of the string can be one of the following:
free_shipping
percentage_discount
fixed_discount
free_product
fixed_rate_discount
custom
product
object
startAt
DateTime
Date that the coupon starts at and can be applied.
endAt
DateTime
Date that the coupon expires at.
isExpired
boolean
Boolean indicating if the coupon is expired.
collections
array
An array of Collection Objects specifying the collections that the coupon can be applied on.
group
object
options
object
product
Object
product
ObjectproductId
integer
Unique identifier of the product.
productName
string
Name of the product.
productDisplayName
array
An array of display names for the product.
variantId
integer
In case the product has variants this is the id of the variant.
variantName
string
In case the product has variants this is the name of the variant.
collection
Object
collectionId
integer
Unique identifier of the collection.
collectionName
string
Name of the collection.
group
Object
group
Objecthandle
string
A unique identifier for the coupon group.
title
string
Title of the coupon group.
url
string
URL of the coupon group.
iconPath
string
Icon path of the coupon group.
description
string
Description of the coupon group.
maxPerPlayer
integer
Maximum number of times a user can achieve coupons from this group.
startDate
DateTime
Date at which coupons can start to be redeemed from this group.
expiryDate
DateTime
Date at which you can no longer redeem coupons from this group.
isAvailable
boolean
A boolean flag indicating if there are coupon available to be redeemed from this group.
isValid
boolean
Flag indicating if the group is valid (Current Date is between start and expiry dates).
isActive
boolean
Flag indicating if the group is active or not (Client marked the group as active or not and group’s dates are valid).
options
Object
options
ObjectExpiryAfter
integer
Number of days until the coupon expires.
UsageLimit
integer
Maximum number of times a coupon or offer can be used.
Capping
double
Maximum limit on the total amount of discount that can be applied to an order.
MinOrderValue
double
The minimum amount a user must spend on an order to qualify for the coupon.
CombinesWith
object
An object that that determines whether specific types of discounts can be combined and consists of three boolean values:
ShippingDiscounts
ProductDiscounts
OrderDiscounts
ProductId
string
Unique identifier of the product.
ProductName
string
Name of the product.
VariantId
string
In case the product has variants this is the id of the variant.
VariantName
string
In case the product has variants this is the name of the variant.
ProductDisplayName
string
Display name for the product.
HasCollections
boolean
Indicates if it has collections.
Platforms
array
List of platforms.
Sample Response
Usage Example
GET - User's Referrals
This endpoint is used to get the Referrals of a specific user with the status of the referral for each referred user, whether the referral has been completed (active
) or pending the needed referral action (pending
) as per your referral configurations.
Request
Header
Attribute
Type
Required
Description
APIKey
string
Yes
Client API key
Path Parameters
Attribute
Type
Required
Description
playerUniqueId
string
Yes
Unique identifier for the user at Referd.
Query Parameters
Attribute
Type
Required
Description
page
integer
No
Index of required page. (e.g. 1, 2, ..) Default: 1
limit
integer
No
limit of results per page. (e.g. 10, 20, ..) Default: 50 Max: 200
Response
Attribute
Type
Description
referredFriends
array
count
integer
Count of users in the in current page.
total
integer
Total number of users referred by the given user.
totalPending
integer
Total "pending"
number of users referred by the given user but haven't completed the required referral action (e.g. Placed an order).
totalActive
integer
Total "active"
number of users successfully referred by the given user and have completed the required referral action (e.g. Placed an order).
referredFriend Object
playerUniqueId
string
Unique identifier for the user at Referd.
displayName
string
User's display name.
email
string
User's email.
mobileNumber
string
User's mobile number.
joinDate
DateTime
The date at which the user joined the store.
status
string
Indicates the status of the referred user, the value of the string can be one of the following:
active
pending
Sample Response
Usage Example
Last updated