Generating Referral Codes

Referral Code API Object

A referral code is represented as the following JSON object in all API responses.

{
  "object_id": "rfc_0cc175b9c0f1b6a831c399e269772661",
  "object": "referral_code",
  "code": "gXbqigbfImI",
  "alias": "ABCDEFGH",
  "link": "http://example.org?refcode=gXbqigbfImI"
}

alias property returned only if generate_alias param set to true on the request.

Referral Code Generation API

Referral codes are unique to campaigns and referrers. You will get the same referral code for each campaign and referrer combination.

Don't forget to replace the following placeholders with your own values when running the commands:

  • __API_KEY__  - your api key
  • __CAMPAIGN_ID__ - campaign object id
  • __EMAIL_ADDRESS__ - referrer email address
  • __NAME__ - referrer name (optional)
curl -X POST \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer __API_KEY__" \
    -d '{"campaign_id":"__CAMPAIGN_ID__","person_email":"__EMAIL_ADDRESS__","person_name":"__NAME__","generate_alias":true}' \
    "http://api.referralmagic.co/referral-codes"

generate_alias param is optional and when it's set to true, a unique alias code is generated along with the referral code.

Still need help? Contact Us Contact Us