Skip to main content
POST
/
v1
/
referrals
/
{campaignId}
/
members
/
{memberId}
/
holders
Add Referral Code Holders with Campaign ID
curl --request POST \
  --url https://{cluster}.voucherify.io/v1/referrals/{campaignId}/members/{memberId}/holders \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-App-Id: <api-key>' \
  --header 'X-App-Token: <api-key>' \
  --data '{
  "holders": [
    {
      "source_id": "cst-prsn01",
      "name": "Alex Doe",
      "email": "alex-doe@your.domain.com",
      "country": "England"
    },
    {
      "source_id": "cst-prsn02",
      "name": "Alex Joe",
      "email": "alex-joe@your.domain.com",
      "country": "Wales"
    }
  ],
  "metadata": {
    "influencer_code": true
  }
}'
{
"holders": [
{
"id": "rh_0f198761748966ffab",
"created_at": "2024-07-23T10:40:48.579Z",
"redeemable_id": "v_uOrG9tQresN9X51gbAoo0a2vY4MLV9lS",
"redeemable_object": "voucher",
"campaign_id": "camp_vVk4unz3k4gA023fk9XoSiTh",
"campaign_type": "REFERRAL_PROGRAM",
"voucher_type": "DISCOUNT_VOUCHER",
"customer_id": "cust_r8yoJtgAAF2pqU1yuICtk9bv",
"holder_role": "REFEREE",
"object": "redeemable_holder",
"metadata": {
"influencer_code": true
}
},
{
"id": "rh_0f198761748966ffac",
"created_at": "2024-07-23T10:40:48.579Z",
"redeemable_id": "v_uOrG9tQresN9X51gbAoo0a2vY4MLV9lS",
"redeemable_object": "voucher",
"campaign_id": "camp_vVk4unz3k4gA023fk9XoSiTh",
"campaign_type": "REFERRAL_PROGRAM",
"voucher_type": "DISCOUNT_VOUCHER",
"customer_id": "cust_uCLPtbQkQayw6t40O9IMPQzV",
"holder_role": "REFEREE",
"object": "redeemable_holder",
"metadata": {
"influencer_code": true
}
}
]
}

Authorizations

X-App-Id
string
header
required
X-App-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

campaignId
string
required

Unique identifier of a referral program campaign.

Example:

"camp_rRsfatlwN7unSeUIJDCYedal"

memberId
string
required

Unique referral code or its identifier.

Example:

"MmFAzfDe"

Body

application/json

Specify the customer data to be upserted as redeemable holders.

Request body schema for POST v1/referrals/{campaignId}/members/{memberId}/holders and POST v1/referrals/members/{memberId}/holders.

holders
Customer Id And Source Id · object[]
required

Array of holders to be added to a referral card as referees. You have to send at least one object in the array up to a maximum of 100 objects. You can send either a source_id or id, or both; however, at least one of them is required. If both are sent, Voucherify checks id to upsert that customer's data.

metadata
object

A set of custom key/value pairs that you can attach to the redeemable holders sent in the array. The value can be a string, number, boolean, date, datetime, image URL, or object. The metadata must meet the metadata schema for publications. The metadata object stores all custom attributes assigned to the redeemable holder.

Response

Returns a list of redeemable holder objects.

Response body schema for POST v1/referrals/{campaignId}/members/{memberId}/holders and POST v1/referrals/members/{memberId}/holders.

holders
Customer Redeemable · object[]
required

Contains an array of referral card holders who are the customers sent in the request.

I