Refer Customer

This API allows you to refer someone with the referral code of a specific campaign to a customer (auto-generated referral code).

It is important to understand the following terminologies that you may come across while using the customer/APIs.

referral_codeUnique code generated for the referrer for a specific campaign. Each referral campaign generates a unique code for each customer.
inviteeA person who was invited by the referrer.
refereesCustomers from the invitee list who turned up to the stores and made either transactions or registration
incentivesRewards received by the referral for successful referees of the campaign. Currently, only coupons are issued as incentives.
scopeThe channel through which the referral was made. Currently, the referrals are supported only through email and mobile numbers. Scopes are used as name-value pairs, the value could be referees, invitees, or incentives as per the context.

Prerequisites

  • Authentication: Basic/OAuth authentication
  • Default access group.

Query Params

FieldData TypeDescription
mobile/emailstringMobile number or email ID of the customer.

Resource information

URIv1.1/customer/referrals
HTTP methodPOST
PaginationNA
Rate limitNA
Batch supportNA

API endpoint example

http://eucrm.cc.capillarytech.com/v1.1/customer/referrals

Request Parameters

ParameterData TypeDescription
customerArrayAn array of customer details.
- mobile* StringMobile number of the customer who is referring.
- referralsObjectAn object containing referral information.
-- campaign_tokenStringThe token of the referral campaign to which you are referring. You can get this token from the campaign home page under the referral campaign name.
--- type* StringType of referral. Supported values: MOBILE and EMAIL.
- referralArrayAn array of referral objects that contains the details of the individual to whom you are referring (invitee).
id* StringUser ID of the individual if any. Else, you can leave this field empty.
invited_on* StringA timestamp in ISO 8601 format indicating when the referral was invited along with the referral code. For example, 20240910T16:35:52.pV7BF, where pV7BF is the referral code.
nameStringName of the invitee
identifier* StringIdentifier (e.g., mobile number) of the invitee.
{
    "root": {
        "customer": [
            {
                "mobile": "7999836466",
                "referrals": {
                    "campaign_token": "J0H7Q",
                    "referral_type": {
                        "type": "MOBILE",
                        "referral": [
                            {
                                "id": "",
                                "invited_on": "20240910T16:35:52.pV7BF",
                                "name": "Shikhar",
                                "identifier": "7999836416"
                            }
                        ]
                    }
                }
            }
        ]
    }
}

Response parameters

ParametersDescription
statusContains the status of the response.
successIndicates if the request was successful.
codeThe HTTP status code.
messageA message providing additional details about the status.
customersContains customer details.
customerList of customer objects.
emailThe email of the customer.
mobileThe mobile number of the customer.
external_idExternal identifier for the customer.
firstnameThe first name of the customer.
lastnameThe last name of the customer.
referralsContains referral information.
referral_typeList of referral types.
typeThe type of referral ((MOBILE) or (EMAIL)).
referralList of referral details.
idIdentifier for the referral.
nameName associated with the referral.
identifierIdentifier for the invited referral.
invited_onTimestamp of when the referral was invited.
statusStatus of the referral.
codeStatus code of the referral.
messageMessage about the referral status.
item_statusContains the item status of the customer.
successIndicates if the item operation was successful.
codeStatus code of the item operation.
messageMessage regarding the item operation status.
{
    "response": {
        "status": {
            "success": "true",
            "code": 200,
            "message": "SUCCESS"
        },
        "customers": {
            "customer": [
                {
                    "email": null,
                    "mobile": "917999836466",
                    "external_id": null,
                    "firstname": "shikar",
                    "lastname": "",
                    "referrals": {
                        "referral_type": [
                            {
                                "type": "MOBILE",
                                "referral": [
                                    {
                                        "id": "",
                                        "name": "Shikhar",
                                        "identifier": "7999836416",
                                        "invited_on": "20240910T16:35:52.pV7BF",
                                        "status": {
                                            "success": "true",
                                            "code": 1000,
                                            "message": "Refer was successful"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    "item_status": {
                        "success": "true",
                        "code": 1000,
                        "message": "Referrals are invited successfully"
                    }
                }
            ]
        }
    }
}

{
    "response": {
        "status": {
            "success": "true",
            "code": 200,
            "message": "SUCCESS"
        },
        "customers": {
            "customer": [
                {
                    "email": null,
                    "mobile": "917999836466",
                    "external_id": null,
                    "firstname": "shikar",
                    "lastname": "",
                    "referrals": {
                        "referral_type": [
                            {
                                "type": "MOBILE",
                                "referral": [
                                    {
                                        "id": "",
                                        "name": "Shikhar",
                                        "identifier": "79998364",
                                        "invited_on": "20240910T16:35:52.pV7BF",
                                        "status": {
                                            "success": "false",
                                            "code": 1701,
                                            "message": "Invalid Identifier for the type"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    "item_status": {
                        "success": "true",
                        "code": 1000,
                        "message": "Referrals are invited successfully"
                    }
                }
            ]
        }
    }
}

API error codes

CodeDescription
1012Cannot find a customer for provided mobile.
1206Referral type is not supported.
1701Invalid Identifier for the type.
Language
Authorization
Basic
base64
:
URL
Click Try It! to start a request and see the response here!