iRefer API Guide

Overview

Most of the iRefer functionality on your referral campaigns can be accessed through iRefer API. You can register your existing customers to your campaign, add new leads, check referral status of a customer or a campaign and more using the API.

iRefer API calls are made by making HTTP calls to iRefer API server (https://api.irefer.io).

iRefer API calls require you to add your unique iRefer license key to the API URL, followed by “.js”. Your iRefer license key can be found in the API Guide section of your iRefer campaign on app.irefer.io. All license keys start with W4qL and are 32 character long (for example W4qL69dbdc0ed0520530bede3c1fc574).

Your API URL will look like the following after you have added the license key. Notice the “.js/” in the end - https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/

All API calls respond with a resulting JSON. In case of a rare error, you might receive null response as well. Your code should be able to handle null results.

 

API URL Format

https://api.irefer.io/v1.0/{{license_key}}.js/{{api_name}}?{{api_parameters}}

Parameters are explained as follows -

{{license_key}}
Your unique iRefer license key (found in the API Guide section of your iRefer campaign on app.irefer.io).
This is mandatory.

{{api_name}}
Name of the API method being called. This is mandatory.

{{api_parameters}}
All required API parameters. Each parameter is separated by & character. Each parameter is composed of parameter_name and parameter_value separated by = character. There can be more than 1 parameters. Required parameters for each APIs are documented in next sections.

{{parameter1_name}}={{parameter1_value}}&{{parameter2_name}}={{parameter2_value}}&{{parameter3_name}}={{parameter3_value}}

 

Key API Parameters

License Key                Required
Website API Key        Required only when making API call from your server-side code.
Campaign Id               Required
 

Note: Your API Key should be kept private and secure. You should never share your API Key with anyone else and never use it directly in your code, specially client side code (jQuery/JavaScript). You should retrieve it from database or environment variable. API Key is not required when calling the API from client side (Your website UI/jQuery/JavaScript etc), as we verify the api request using host name server variable.

Note: If you are making API call from client-side code (your website UI jQuery/JavaScript code) instead of server-side code (your app/backend code), then do not include the api_key parameter (which you should never make public). We will verify your request based on the request host address. It should be the same website as of your iRefer campaign.

 

APIs

Following are the details of all APIs.

API - newSignup

Add a new participant to a campaign.

Add a new signup member to your referral campaign.

URL

https://api.irefer.io/v1/{{license_key}}.js/newSignup?campaign_id={{campaign_id}} &email={{participant_email_address}}&name={{participant_name}}&phone={{participant_phone}}&info_1={{info1}}&info_2={{info2}}&info_3={{info3}}&info_4={{info4}}&info_5={{info5}}&source={{lead_source}}&referrer_code={{referrer_code}}

 

Parameters

{{license_key}}
Your unique license key - found in settings section. This is a mandatory parameter.

{{campaign_id}}
Your campaign_id.
This is a mandatory parameter.

{{participant_email_address}}
Email address of new Signup. This is a mandatory parameter.

{{participant_name}}
Name of new Signup.
This is an optional parameter.

{{participant_phone}}
Phone number of new Signup. This is an optional parameter.

{{info_1}}
Optional information 1 about the new Signup. This is an optional parameter.

{{info_2}}
Optional information 2 about the new Signup. This is an optional parameter.

{{info_3}}
Optional information 3 about the new Signup. This is an optional parameter.

{{info_4}}
Optional information 4 about the new Signup. This is an optional parameter.

{{info_5}}
Optional information 5 about the new Signup. This is an optional parameter.

{{lead_source}}
Lead source of new Signup. Only if this Lead followed a shared referral link to your page. It could be one the following.

t – for Twitter
f – for Facebook
l – for LinkedIn
w – for WhatsApp e – for Email

This is an optional parameter.

{{referrer_code}}
Referrer code of the referrer of this new Signup. Only if this Lead followed a referral link to your page.
This is an optional parameter.

{{api_key}}
Required when calling the API from Server or testing it in web browser/command line thru direct URL call. Do not use it when sending API requests from Client side (your website UI/ jQuery/JavaScript etc), since we verify the request from host name.

You API Key can be found in the API Guide section of your iRefer campaign on app.irefer.io. Your API Key is unique to your website.

Your API key should be kept safe and private. Do not publish it on the website, or even use it directly in your code files. Instead either fetch it from your database, or from environment variables.

Note: If you are making this API call from client-side code (your website UI jQuery/JS code) instead of server-side code (your app/backend code), and you have the iRefer script code installed on your website, then we automatically track the referrer_code (the person who referred this new sign-up) using the url querystring (?iref=uniquecode) and cookie(vsu_referer_hash). Otherwise you should pass this information thru in this API call in order for referrer to get the referral credit. You have to read and store the url querystring (? iref=uniquecode) on your referral link landing page and then you can save it as a cookie and use it in this API call.

 

Sample URL

This URL should be called from inside your website. See the “Calling iRefer APIs” section for a sample example of how to call the APIs using jQuery.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/newSignup?campaign_id=2605&email=new-participant@irefer.io&name=testuser

This URL can be used to test the API through your browser. The last parameter (api_key) is required if you are making direct API call from your browser.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/newSignup?campaign_id=2605&email=new-participant@irefer.io&name=testuser&api_key=ireferextapi

 

Response

API Response is in JSON format.

campaign_name
Your Campaign Name

email
email address registered for this signup

confirmed
whether the email address is confirmed or not when campaign requires email confirmation. 1 is confirmed, 0 is not confirmed yet.

referral_link
Unique referral link assigned to this new signup

referrer
email address of the referrer

reward_next
Next reward that can be earned by referring participants

reward_next_referrals_required
Number of referrals required for the next Reward

rewards_offered
All rewards offered under this campaign (JSON ARRAY)

      signups_count
      Number of signups required to get to this reward

      reward_heading
      Reward name

 

Sample error response

If there is any error (like required parameters are missing or invalid), you will receive error in following format -

{
"error": "input missing or incorrect", "error_code": "irefer_api_newSignup_err_401"
}

 

Sample success response

 

{
"campaign_name": "Test Campaign",
"email": "participant5@email.address",
"confirmed": "1",
"referral_link": "http:\/\/getirefer.com\/?iref=z6VPk1s0",
"referrer": "participant2@email.address",
"reward_next": "Get a $10 Coupon!",
"reward_next_referrals_required": 1, "rewards_offered": [

{"signups_count": "1",
"reward_heading": "Get a $10 Coupon!"
},

{"signups_count": "5",
"reward_heading": "Get a $50 Coupon!",

] }
}

 

API - referralApproval

Use this API to approve an existing referral. This only applies if you have chosen to have referrals approved before reward emails are sent out. You need to pass the email address of the lead customer (replace participant@email.address with your lead's actual email address).

Usage

  • Approve a referral and trigger rewards
  • Convert Lead to a Customer

API URL

Use the following URL to make a call to this API. This URL is already customized to include your license key and campaign id.

https://api.irefer.io/v1.0/W4qLb411508c792cf7e89dfed936a2d2.js/referralApproval?campaign_id=2660&lead_email=participant@email.address&api_key=ec60427b2ff0
 

 

Response

Following is a sample JSON response for this API call.


{ "campaign_name":"API Demo", "lead_email":"participant@email.address", "referrer":"pete@irefer.io", "approved":true }

 

API - referralCheck

Use this API to check if a customer was referred. You need to pass the email address of the lead customer (replace participant@email.address with your lead's actual email address).

Alternatively, you can also pass referrer_email or referrer_code of the referrer. If the lead was not referred using friend invite then checks if referrer_email (or referrer_code) is valid.

Usage

  • Check if a customer was referred
  • Check if a referrer is valid

API URL

Use the following URL to make a call to this API. This URL is already customized to include your license key and campaign id.

https://api.irefer.io/v1.0/W4qLb411508c792cf7e89dfed936a2d2.js/referralCheck?campaign_id=2660&lead_email=participant@email.address&api_key=ec60427b2ff0
 

 

Response

Following is a sample JSON response for this API call.


{ "campaign_name":"API Demo", "referrer":"pete@irefer.io",
"referrer_name":"pete roberts", "referrer_code":"pete", "lead_email":"participant@email.address" }

 

API - referralCheckAndRegister

Use this API to check if a customer was referred and if yes, then register this as a new referral and trigger rewards. You need to pass the email address of the lead customer (replace participant@email.address with your lead's actual email address).

Alternatively, you can also pass referrer_email or referrer_code of the referrer. If the lead was not referred using friend invite then if referrer_email (or referrer_code) is valid then this will registered as a valid referral.

Usage

  • Check if a customer was referred - and if yes then register this referral
  • Register new referral

API URL

Use the following URL to make a call to this API. This URL is already customized to include your license key and campaign id.

https://api.irefer.io/v1.0/W4qLb411508c792cf7e89dfed936a2d2.js/referralCheckAndRegister?campaign_id=2660&lead_email=participant@email.address&api_key=ec60427b2ff0
 

 

Response

Following is a sample JSON response for this API call.


{ "campaign_name":"API Demo", "referrer":"pete@irefer.io", "referrer_code":"pete", "lead_email":"participant@email.address", "created_at":{"date":"2019-01-01 12:00:30","timezone_type":3,"timezone":"UTC"}, "approved":"0" }

 

API - referralRequest

Use this API to request referral from an existing referrer once they have received value from your product. This can also be used to send reminder emails if participant hasn't made any referrals yet.

Usage

  • Request referrals from an existing referrer
  • Send reminder email

API URL

Use the following URL to make a call to this API. This URL is already customized to include your license key and campaign id.

https://api.irefer.io/v1.0/W4qLb411508c792cf7e89dfed936a2d2.js/referralRequest?campaign_id=2660&email=participant@email.address&msg=Thanks for using our product. Please help spread the word.&subject=Spread the word&api_key=ec60427b2ff0
 

 

Response

Following is a sample JSON response for this API call.


{ "campaign_name": "Test Campaign", "email": "participant5@email.address", "confirmed": "1", "referral_code": "z6VPk1s0" }

 

API - referrerStats

Get Referrer Stats for a campaign participant.
Get detailed referrer stats for any signed up member on your referral campaign.

API #1 URL https://api.irefer.io/v1.0/{{license_key}}.js/referrerStats?email={{referrer_email_address}}&campaign_id={{campaign_id}}

 

Parameters

{{license_key}}
Your unique license key - found in settings section. This is a mandatory parameter.

{{referrer_email_address}}
Email address of the referrer. This is a mandatory parameter.

{{campaign_id}}
Your campaign_id.
This is a mandatory parameter.

{{api_key}}
Required when calling the API from Server or testing it in web browser/command line thru direct URL call. Do not use it when sending API requests from Client side (your website UI/ jQuery/JavaScript etc), since we verify the request from host name.

You API Key can be found in the API Guide section of your iRefer campaign on app.irefer.io. Your API Key is unique to your website.

Your API key should be kept safe and private. Do not publish it on the website, or even use it directly in your code files. Instead either fetch it from your database, or from environment variables.

 

Sample URL

This URL should be called from inside your website. See the “Calling iRefer APIs” section for a sample example of how to call the APIs using jQuery.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/referrerStats? email=test@gmail.com&campaign_id=2605

This URL can be used to test the API through your browser. The last parameter (api_key) is required if you are making direct API call from your browser.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/referrerStats? email=test@gmail.com&campaign_id=2605&api_key=ireferextapi

 

Response

API Response is in JSON format.

campaign_name
Your Campaign Name

email
Referrer email address

confirmed
whether the email address is confirmed or not when campaign requires email confirmation. 1 is confirmed, 0 is not confirmed yet.

referral_link
Referrer referral link

referrals_made
Number of referrals made by referrer

reward_last
Last reward earned by referrer

reward_next

Next reward that can be earned by referrer by referring more participants

reward_next_referrals_remaining
Number of referrals remaining for the next Reward

rewards_earned
All rewards earned so far (JSON ARRAY)

      signups_count
      Number of signups referred to get to this reward

      reward_heading
      Reward name

rewards_offered
All rewards offered under this campaign (JSON ARRAY)

      signups_count
      Number of signups required to get to this reward

      reward_heading
      Reward name

 

Sample error response

If there is any error (like required parameters are missing or invalid), you will receive error in following format -

{
"error": "input missing or incorrect", "error_code": "irefer_api_referrerStats_err_401"
}

 

Sample success response

{
"campaign_name": "My referral campaign",
"email": "testingirefer@gmail.com",
"confirmed": "1",
"referral_link": "http://getirefer.com/?iref=7XYu.oRD",
"referrals_made": 1,
"reward_last": "Get a $10 Coupon!",
"reward_next": "Get a $50 Coupon!",
"reward_next_referrals_remaining": 4,
"rewards_earned": [

{"signups_count": "1",

"reward_heading": "Get a $10 Coupon!"

}], "rewards_offered": [

{"signups_count": "1",
"reward_heading": "Get a $10 Coupon!"
},
{"signups_count": "5",

"reward_heading": "Get a $50 Coupon!"

}] }

 

API - campaignStats

Get Campaign Stats for a campaign. Get detailed stats for your referral campaign.

URL

https://api.irefer.io/v1/{{license_key}}.js/campaignStats?campaign_id={{campaign_id}} API #2 URL Parameters

{{license_key}}
Your unique license key - found in settings section. This is a mandatory parameter.

{{campaign_id}}
Your campaign_id.
This is a mandatory parameter.

{{api_key}}
Required when calling the API from Server or testing it in web browser/command line thru direct URL call. Do not use it when sending API requests from Client side (your website UI/ jQuery/JavaScript etc), since we verify the request from host name.

You API Key can be found in the API Guide section of your iRefer campaign on app.irefer.io. Your API Key is unique to your website.

Your API key should be kept safe and private. Do not publish it on the website, or even use it directly in your code files. Instead either fetch it from your database, or from environment variables.

 

Sample URL

This URL should be called from inside your website. See the “Calling iRefer APIs” section for a sample example of how to call the APIs using jQuery.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/campaignStats?campaign_id=2605

This URL can be used to test the API through your browser. The last parameter (api_key) is required if you are making direct API call from your browser.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/campaignStats?campaign_id=2605&api_key=ireferextapi

 

Response

API Response is in JSON format.

campaign_name
Your Campaign Name

total_views
Total number of views of this campaign

signups_total
Total number of signups received on this campaign

signups_today
Total number of signups received today on this campaign

conversion
conversion % ( signups_total / total views)

referrals
Total number of signups received thru referrals on this campaign

facebook_referrals
Total number of signups received thru Facebook sharing on this campaign

whatsapp_referrals
Total number of signups received thru Whatsapp sharing on this campaign

twitter_referrals
Total number of signups received thru Twitter sharing on this campaign

linkedin_referrals
Total number of signups received thru Linkedin sharing on this campaign

email_referrals
Total number of signups received thru email sharing on this campaign

rewards_offered
All rewards offered under this campaign (JSON ARRAY)

      signups_count
      Number of signups required to get to this reward

      reward_heading
      Reward name

 

Sample error response

If there is any error (like required parameters are missing or invalid), you will receive error in following format -

{
"error": "input missing or incorrect", "error_code": "irefer_api_campaignStats_err_401"
}

 

Sample success response

{
"campaign_name": "My referral campaign", "total_views": "126",
"signups_total": 27,
"signups_today": 0,
"conversion": "21.4%",
"referrals": 22,
"facebook_referrals": 1, "whatsapp_referrals": 1,
"twitter_referrals": 1,
"linkedin_referrals": 0,
"email_referrals": 1,
"rewards_offered": [

{"signups_count": "1",
"reward_heading": "Get a $10 Coupon!"},

{"signups_count": "5",
"reward_heading": "Get a $50 Coupon!"

} ]

}

 

API - newSpecificAction

Add new specific action.

Add a new Specific Action completion on your campaign in order to trigger the referral rewards.

URL

https://api.irefer.io/v1.0/{{license_key}}.js/newSpecificAction?campaign_id={{campaign_id}}&external_id={{participant_email_address}}&action={{action_name}} &referrer_code={{referrer_code}}

Parameters

{{license_key}}
Your unique license key - found in settings section. This is a mandatory parameter.

{{campaign_id}}
Your campaign_id.
This is a mandatory parameter.

{{participant_email_address}}
Email address (or any unique identifier that you want to track) of the referred person who completed the specific action.
This is a mandatory parameter.

{{action_name}}
Page name/URL of the specific action completed. It should match the specific action page name defined in rewards setup for your campaign. For example if you defined “/dashboard” then pass “/dashboard” here.
This is a mandatory parameter.

{{referrer_code}}
Referrer code of the referrer of this specific action sign up. This is a mandatory parameter.

{{api_key}}
Required when calling the API from Server or testing it in web browser/command line thru direct URL call. Do not use it when sending API requests from Client side (your website UI/ jQuery/JavaScript etc), since we verify the request from host name.

You API Key can be found in the API Guide section of your iRefer campaign on app.irefer.io. Your API Key is unique to your website.

Your API key should be kept safe and private. Do not publish it on the website, or even use it directly in your code files. Instead either fetch it from your database, or from environment variables.

 

Sample URL

This URL should be called from inside your website. See the “Calling iRefer APIs” section for a sample example of how to call the APIs using jQuery.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/newSpecificAction?campaign_id=2180&external_id=participant@email.address&action=/dashboard&referrer_code=uniquecode

This URL can be used to test the API through your browser. The last parameter (api_key) is required if you are making direct API call from your browser.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/newSpecificAction?campaign_id=2180&external_id=participant@email.address&action=/dashboard&referrer_code=uniquecode&api_key=ireferextapi

 

Sample error response

If there is any error (like required parameters are missing or invalid), you will receive error in following format -

{
"error": "input missing or incorrect",
"error_code": "irefer_api_newSpecificAction_err_401"
}

 

Sample success response


{ "campaign_name": "Test Campaign", "external_id": "participant@email.address" }

 

API - referrers

Get all Referrers.

Get a list of all referrers on your campaign.

API #5 URL https://api.irefer.io/v1.0/{{license_key}}.js/referrers?campaign_id={{campaign_id}}

Parameters

{{license_key}}
Your unique license key - found in settings section. This is a mandatory parameter.

{{campaign_id}}
Your campaign_id.
This is a mandatory parameter.

{{api_key}}
Required when calling the API from Server or testing it in web browser/command line thru direct URL call. Do not use it when sending API requests from Client side (your website UI/ jQuery/JavaScript etc), since we verify the request from host name.

You API Key can be found in the API Guide section of your iRefer campaign on app.irefer.io. Your API Key is unique to your website.

Your API key should be kept safe and private. Do not publish it on the website, or even use it directly in your code files. Instead either fetch it from your database, or from environment variables.

 

Sample URL

This URL should be called from inside your website. See the “Calling iRefer APIs” section for a sample example of how to call the APIs using jQuery.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/referrers? campaign_id=2605

This URL can be used to test the API through your browser. The last parameter (api_key) is required if you are making direct API call from your browser.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/referrers? campaign_id=2605&api_key=ireferextapi

 

Sample error response

If there is any error (like required parameters are missing or invalid), you will receive error in following format -

{
"error": "input missing or incorrect", "error_code": "irefer_api_referrers_err_401"
}

 

Sample success response

[
{"id":"271047","campaign_id":"2145","refferal_link":"aSbVGWuE","referrer_email":null, "name":"test1","email":"irefertest1@irefertestemail.com","phone":null, "info_1":null,"info_2":null,"info_3":null,"info_4":null,"info_5":null, "created_at":"2018-06-04T02:57:24Z","ip":"373.114.17.25","source_network":"", "referrals_count":"0"},

{"id":"271046","campaign_id":"2145","refferal_link":"ZsMj8uyJ","referrer_email":null, "name":"test2","email":"irefertest2@irefertestemail.com","phone":null, "info_1":null,"info_2":null,"info_3":null,"info_4":null,"info_5":null, "created_at":"2018-06-03T14:17:34Z","ip":"273.114.19.111","source_network":"", "referrals_count":"3"},

{"id":"271045","campaign_id":"2145","refferal_link":"1SgOM4xx","referrer_email":null, "name":"test3","email":"irefertest3@irefertestemail.com","phone":null, "info_1":null,"info_2":null,"info_3":null,"info_4":null,"info_5":null, "created_at":"2018-06-03T14:12:43Z","ip":"173.114.19.109","source_network":"", "referrals_count":"0"}

]


 

API - rewards

Get all Rewards triggered.
Get a list of all rewards triggered on your campaign.

API #6 URL https://api.irefer.io/v1.0/{{license_key}}.js/rewards?campaign_id={{campaign_id}}

Parameters

{{license_key}}
Your unique license key - found in settings section. This is a mandatory parameter.

{{campaign_id}}
Your campaign_id.
This is a mandatory parameter.

{{api_key}}
Required when calling the API from Server or testing it in web browser/command line thru direct URL call. Do not use it when sending API requests from Client side (your website UI/ jQuery/JavaScript etc), since we verify the request from host name.

You API Key can be found in the API Guide section of your iRefer campaign on app.irefer.io. Your API Key is unique to your website.

Your API key should be kept safe and private. Do not publish it on the website, or even use it directly in your code files. Instead either fetch it from your database, or from environment variables.

 

Sample URL

This URL should be called from inside your website. See the “Calling iRefer APIs” section for a sample example of how to call the APIs using jQuery.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/rewards? campaign_id=2605

This URL can be used to test the API through your browser. The last parameter (api_key) is required if you are making direct API call from your browser.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/rewards? campaign_id=2605&api_key=ireferextapi

 

Sample error response

If there is any error (like required parameters are missing or invalid), you will receive error in following format -

{
"error": "input missing or incorrect", "error_code": "irefer_api_rewards_err_401"

}

 

Sample success response

[
{"id":"375","campaign_id":"2205","triggered_at":"2018-06-15T16:11:45Z",

"recipient_id":"271139","recipient_email":"joinirefer@irefer.io","recipient_name":"pete", "recipient_referral_code":"eMxPNXQn","referrals_made":"6", "reward_id":"3371","reward_heading":"Get a $10 Coupon!","reward_signups_count":"3","reward_quantity":"SINGLE",

 

"reward_delivery":"EACHTIME","reward_goal_type":"STANDARD", "reward_to":"REFFERER"},

{"id":"374","campaign_id":"2205","triggered_at":"2018-06-15T16:10:44Z",

"recipient_id":"271139","recipient_email":"joinirefer@irefer.io","recipient_name":"pete", "recipient_referral_code":"eMxPNXQn","referrals_made":"3", "reward_id":"3371","reward_heading":"Get a $10 Coupon!","reward_signups_count":"3","reward_quantity":"SINGLE",

"reward_delivery":"EACHTIME","reward_goal_type":"STANDARD", "reward_to":"REFFERER"}

]


 

API - specificActionSignups

Get all specific action sign-ups.
Get a list of all specific action sign-ups on your campaign.

URL

https://api.irefer.io/v1.0/{{license_key}}.js/specificActionSignups?

campaign_id={{campaign_id}}

 

Parameters

{{license_key}}
Your unique license key - found in settings section. This is a mandatory parameter.

{{campaign_id}}
Your campaign_id.
This is a mandatory parameter.

{{api_key}}
Required when calling the API from Server or testing it in web browser/command line thru direct URL call. Do not use it when sending API requests from Client side (your website UI/ jQuery/JavaScript etc), since we verify the request from host name.

You API Key can be found in the API Guide section of your iRefer campaign on app.irefer.io. Your API Key is unique to your website.

Your API key should be kept safe and private. Do not publish it on the website, or even use it directly in your code files. Instead either fetch it from your database, or from environment variables.

 

Sample URL

This URL should be called from inside your website. See the “Calling iRefer APIs” section for a sample example of how to call the APIs using jQuery.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/specificActionSignups? campaign_id=2605

This URL can be used to test the API through your browser. The last parameter (api_key) is required if you are making direct API call from your browser.

https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/specificActionSignups? campaign_id=2605&api_key=ireferextapi

 

Sample error response

If there is any error (like required parameters are missing or invalid), you will receive error in following format -

{
"error": "input missing or incorrect",
"error_code": "irefer_api_specificActionSignups_err_401"

}

 

Sample success response

[{"id":"147598","campaign_id":"2204","referrer_email":"joinirefer@gmail.com", "referred_person":"test3@irefer.io","specific_action":"\/thanks\/", "created_at":"2018-06-15T15:10:57Z","ip":"109.228.52.121"},

{"id":"147597","campaign_id":"2204","referrer_email":"joinirefer@gmail.com", "referred_person":"test2@irefer.io","specific_action":"\/thanks\/", "created_at":"2018-06-15T15:09:35Z","ip":"73.114.17.89"},

{"id":"147596","campaign_id":"2204","referrer_email":"joinirefer@gmail.com", "referred_person":"test1@irefer.io","specific_action":"\/thanks\/",

 

"created_at":"2018-06-15T15:03:19Z","ip":"209.228.52.121"} ]

 

Calling iRefer APIs with jQuery

Here is a sample code to call iRefer APIs thru jQuery. You can also check more sample and examples on iRefer JSFiddle (https://jsfiddle.net/user/irefer/fiddles/)

<script src="https://code.jquery.com/jquery-3.1.1.js"></script> <script type='text/javascript'>

var api_url = "https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/referrerStats?email=test@gmail.com&campaign_id=2605";

$.get(api_url, function (json_result) {

//console.log("error result = " + JSON.stringify(json_result)); if(json_result.error){

alert("error = " + json_result.error );

alert("error result = " + JSON.stringify(json_result)); } else {

alert("referral_link = " + json_result.referral_link); alert("referrals_made = " + json_result.referrals_made); alert("all results = " + JSON.stringify(json_result));

}

}).done(function() {
alert( "all done" );

}); </script>

 

Troubleshooting

If you keep receiving the following error as JSON response, some of the input parameters for your API call may not be correct or valid.

{
"error":"input missing or incorrect", "error_code":"irefer_api_methodName_err_401"

}

Please double check and make sure all required parameters are being passed in the required format. You can check the following -

Please make sure that iRefer License Key is correct and is followed by “.js”. You License Key can be found in the API Guide section of your iRefer campaign on app.irefer.io.
Make sure that the campaign_id belongs to your iRefer campaign and is not a random/test id.

Make sure that referrer_email_address is a valid referrer’s email id who entered on your campaign.
Make sure API is called from within a website code (Server Side or Client side code). If calling from Server side code, please make sure API_Key is included in parameters. You API Key can be found in the API Guide section of your iRefer campaign on app.irefer.io.

If calling from Client side(your website UI/jQuery/JavaScript etc), please don’t include the API_Key, since we verify the request from host name.
If making the API call for testing from a browser (address box), please make sure you have added api_key parameter. For example - https://api.irefer.io/v1.0/W4qL69dbdc0ed0520530bede3c1fc574.js/referrerStats? email=test@gmail.com&campaign_id=2605&api_key=ireferextapi

If issue still persists please contact the iRefer Technical Support.


Did this help answer your question?

thumbs up
thumbs down

Thanks for the feedback! 🙏🏽