Referral settings (management API)
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.
| Method | Path | What it does | Permission |
|---|---|---|---|
GET | /v1/manage/referrals/settings | Get the referral settings | Read |
PATCH | /v1/manage/referrals/settings | Change the referral settings | Full |
GET | /v1/manage/referrals/stats | Referral counts | Read |
GET | /v1/manage/referrals/leaderboard | Top referrers | Read |
Get the referral settings
Section titled “Get the referral settings”/v1/manage/referrals/settingsPermission: 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.
| Field | Type | Description |
|---|---|---|
enabled | boolean | |
expiration_days | number | |
max_per_user | number or null | |
reward_milestone | string | |
milestones | array of string | |
reward_type | string or null | |
reward_value | string or null | |
referee_reward_type | string or null | |
referee_reward_value | string or null | |
purchase_milestones | object or null | |
updated_at | string or null |
Change the referral settings
Section titled “Change the referral settings”/v1/manage/referrals/settingsPermission: 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
dry_run | true, false | No | true: check and preview the change without making it (the same as dry_run in the body). |
Request body (JSON):
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | No | Whether referrals are on. Turning them on makes a “ref” route and its landing page if there isn’t one. |
expiration_days | integer or null | No | Days a referral stays open before it expires, 1 to 365. Empty: 30. |
max_per_user | integer or null | No | The most referrals one person can make. Empty: no limit. |
reward_milestone | string or null | No | The milestone at which the referrer earns the reward, such as completed. Empty: completed. |
milestones | array of string or null | No | The steps a referral goes through, in order, such as [“signed_up”, “first_order”]. Empty: none. |
reward_type | string or null | No | What the referrer gets, such as credit or discount. Empty: none. |
reward_value | string or null | No | How much, such as “$5” or “10%”. Empty: none. |
referee_reward_type | string or null | No | What the person invited gets. Empty: none. |
referee_reward_value | string or null | No | How much the person invited gets. Empty: none. |
purchase_milestones | object or string or null | No | Referral milestones reached by purchases: the number of purchases to the milestone name, such as {“1”: “first_purchase”, “3”: “loyal”}. Empty: none. |
expected_updated_at | string | No | The 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.
| Field | Type | Description |
|---|---|---|
enabled | boolean | |
expiration_days | number | |
max_per_user | number or null | |
reward_milestone | string | |
milestones | array of string | |
reward_type | string or null | |
reward_value | string or null | |
referee_reward_type | string or null | |
referee_reward_value | string or null | |
purchase_milestones | object or null | |
updated_at | string or null |
Referral counts
Section titled “Referral counts”/v1/manage/referrals/statsPermission: 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.
| Field | Type | Description |
|---|---|---|
total | number | |
pending | number | |
completed | number | |
expired | number | |
conversion_rate | number | Completed as a percentage of all, one decimal. |
Top referrers
Section titled “Top referrers”/v1/manage/referrals/leaderboardPermission: Read.
Referrers by completed referrals, the same list as the public referral API’s leaderboard. Cached for up to ten minutes.
Query parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | No | How many (default 25). |
Response 200: a page of results in data, and next_cursor for the next page (see Paging). Each item:
| Field | Type | Description |
|---|---|---|
rank | number | |
referrer_id | string | |
referrer_name | string or null | |
total | number | |
completed | number | |
pending | number | |
total_reward_value | string or null | The numbers in the completed referrals’ reward values, added up. |