Skip to content

Referral settings (management API)

View as Markdown

The referral programme’s settings, counts and leaderboard. To create referrals from your app, use the Referrals API instead. For what each setting does, see the user guide.

Every path also works under /v1/manage/appspaces/{appspace}, which you need when an OAuth token reaches more than one Appspace. See the management API overview for signing in, errors, dry runs and paging.

MethodPathWhat it doesPermission
GET/v1/manage/referrals/settingsGet the referral settingsRead
PATCH/v1/manage/referrals/settingsChange the referral settingsFull
GET/v1/manage/referrals/statsReferral countsRead
GET/v1/manage/referrals/leaderboardTop referrersRead
GET/v1/manage/referrals/settings

Permission: Read.

Whether referrals are on, the rewards for both sides and the milestone that earns them, the milestones, how long a referral stays open, the cap per person, and purchase milestones.

Response 200: the result in data.

FieldTypeDescription
enabledboolean
expiration_daysnumber
max_per_usernumber or null
reward_milestonestring
milestonesarray of string
reward_typestring or null
reward_valuestring or null
referee_reward_typestring or null
referee_reward_valuestring or null
purchase_milestonesobject or null
updated_atstring or null
PATCH/v1/manage/referrals/settings

Permission: Full. Changes something: takes dry_run and Idempotency-Key, and needs the Standard plan or above.

Only the fields sent change, tidied as the Settings page does (expiry 1 to 365 days, an empty milestone is “completed”). Turning referrals on makes a “ref” route with a referral landing page if there isn’t one. With dry_run, nothing changes: the answer is { dry_run: true, before, after, changes, warnings }.

Query parameters:

ParameterTypeRequiredDescription
dry_runtrue, falseNotrue: check and preview the change without making it (the same as dry_run in the body).

Request body (JSON):

FieldTypeRequiredDescription
enabledbooleanNoWhether referrals are on. Turning them on makes a “ref” route and its landing page if there isn’t one.
expiration_daysinteger or nullNoDays a referral stays open before it expires, 1 to 365. Empty: 30.
max_per_userinteger or nullNoThe most referrals one person can make. Empty: no limit.
reward_milestonestring or nullNoThe milestone at which the referrer earns the reward, such as completed. Empty: completed.
milestonesarray of string or nullNoThe steps a referral goes through, in order, such as [“signed_up”, “first_order”]. Empty: none.
reward_typestring or nullNoWhat the referrer gets, such as credit or discount. Empty: none.
reward_valuestring or nullNoHow much, such as “$5” or “10%”. Empty: none.
referee_reward_typestring or nullNoWhat the person invited gets. Empty: none.
referee_reward_valuestring or nullNoHow much the person invited gets. Empty: none.
purchase_milestonesobject or string or nullNoReferral milestones reached by purchases: the number of purchases to the milestone name, such as {“1”: “first_purchase”, “3”: “loyal”}. Empty: none.
expected_updated_atstringNoThe updated_at you read. If the thing has changed since, nothing is saved and the answer is 412 precondition_failed: read it again and retry.

Response 200: the result in data, with ref_route_created and warnings. With dry_run, a preview instead.

FieldTypeDescription
enabledboolean
expiration_daysnumber
max_per_usernumber or null
reward_milestonestring
milestonesarray of string
reward_typestring or null
reward_valuestring or null
referee_reward_typestring or null
referee_reward_valuestring or null
purchase_milestonesobject or null
updated_atstring or null
GET/v1/manage/referrals/stats

Permission: Read.

How many referrals there are, pending, completed and expired, and the share completed. Cached for up to five minutes.

Response 200: the result in data.

FieldTypeDescription
totalnumber
pendingnumber
completednumber
expirednumber
conversion_ratenumberCompleted as a percentage of all, one decimal.
GET/v1/manage/referrals/leaderboard

Permission: Read.

Referrers by completed referrals, the same list as the public referral API’s leaderboard. Cached for up to ten minutes.

Query parameters:

ParameterTypeRequiredDescription
limitintegerNoHow many (default 25).

Response 200: a page of results in data, and next_cursor for the next page (see Paging). Each item:

FieldTypeDescription
ranknumber
referrer_idstring
referrer_namestring or null
totalnumber
completednumber
pendingnumber
total_reward_valuestring or nullThe numbers in the completed referrals’ reward values, added up.
Was this page helpful?