---
title: "Set up or change the programme"
method: PUT
path: "/v1/projects/{project}/referral-program"
tags: ["Referral Program"]
---

# Set up or change the programme

`PUT /v1/projects/{project}/referral-program`

## Request

- Base URL: `https://api.subscriby.net`
- URL: `https://api.subscriby.net/v1/projects/{project}/referral-program`
- Auth: HTTP bearer

```bash
curl -X PUT https://api.subscriby.net/v1/projects/7f3d1c92-8b45-4e6a-9d21-5c8e0a4b6f13/referral-program \
  -H "Authorization: Bearer sbt_..." \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "reward_kind": "cash",
    "commission_type": "percentage",
    "commission_value": 20,
    "commission_period_months": 6,
    "hold_days": 14,
    "friend_reward_kind": "free_days",
    "friend_reward_days": 3,
    "payout_details_label": "PayPal email",
    "terms": "One referral per household."
  }'
```

The first PUT creates the programme and answers `201`; every later PUT changes only the fields it carries and answers `200`. Omitting a field keeps its stored value; a first save without `reward_kind` is a free-days programme, and without `friend_reward_kind` gives friends nothing.

> **Changing the terms is not retroactive, and the affiliates are told.** Rewards already in the ledger keep their figures. Every approved or pending affiliate receives the new terms in their chat and by mail when a field they were promised moves: the reward, the commission, the hold, the friend's reward or your own terms text. Who may join, the payout label and the minimum payout are your side and send nothing.

## Path parameters

- `project` string, uuid, required

## Headers

- `Idempotency-Key` string, uuid, required

## Request body

- UpdateReferralProgramRequest: The Referral Program settings: what referrers earn, what their friends receive, who may join and which plans count. The first PUT creates the programme; every later PUT changes only the fields it carries.
  - `active` boolean: The on/off switch. Prefer the activate and deactivate endpoints, which fire the same event with only that change.
  - `customers_only` boolean: Whether only members with a live membership may join. Defaults to false.
  - `approval_required` boolean: Whether you approve each affiliate before their code counts. Defaults to false.
  - `reward_kind` 'free_days' | 'cash': What a referrer earns per referral: membership time, or money the creator pays out. Two kinds and no third, because every other shape a creator asked for (a coupon for the referrer, store credit) is one of these in disguise and each adds a surface the Payouts tab would have to explain.
  - `reward_days` integer, nullable: Days a referrer earns per converted friend, 1 to 3650; required when `reward_kind` is `free_days`.
  - `commission_type` 'percentage' | 'fixed': How a cash commission is worked out from a settled payment. A percentage rides every payment in the commission period, in the currency the payment settled in. A fixed amount is paid once, on the first payment, in the currency the programme names: a fixed sum per renewal would make a weekly plan pay a referrer more than the plan earns.
  - `commission_value` number, nullable: The rate: 0.0001 to 100 for a percentage, any amount above zero for a fixed commission. Stored as a decimal string with four places.
  - `commission_currency_id` string, nullable: The currency a `fixed` commission is paid in; required then, cleared for a percentage.
  - `commission_period_months` integer, nullable: How long a percentage commission runs after conversion: `0` for the friend's first payment only, 1 to 36 months, or null for life. A fixed commission is always the first payment only.
  - `hold_days` integer: Days a cash commission waits before it is payable, so a refund inside the window can take it back: 0 to 90. Defaults to 14.
  - `minimum_payout` number, nullable: A guide for you, the balance an affiliate reaches before you pay; nothing is enforced. Null for none.
  - `friend_reward_kind` 'none' | 'free_days' | 'coupon': What the referred friend receives for arriving through a referral, if anything. Days are banked on the friend's first purchase the moment it settles; a coupon is applied at their checkout and follows the coupon's own rules, which is why it is offered only to creators who hold the Coupons capability.
  - `friend_reward_days` integer, nullable: Days banked on the friend's first purchase, 1 to 3650; required when `friend_reward_kind` is `free_days`.
  - `friend_coupon_id` string, nullable: One of this project's coupon codes, applied at the friend's checkout; required when `friend_reward_kind` is `coupon`. Needs coupon codes on the project owner's plan.
  - `payout_details_label` string, nullable: The question affiliates answer so you can pay them, such as `PayPal email`; at most 120 characters. Null for none.
  - `terms` string, nullable: Your own terms, shown to affiliates and referred friends; at most 5,000 characters. Null for none.
  - `plan_ids` string[]: Restrict conversions to these plans of the project, at most 200. Omit to leave the restriction alone; send `[]` for every plan, including plans added later.

## Response `200`

The programme as written: 201 when this call created it, 200 after.

- string

## Other responses

- `400`: `IDEMPOTENCY_KEY_MISSING`: every write needs an `Idempotency-Key` header. Send a fresh UUID per distinct operation.
- `401`: `AUTHENTICATION_REQUIRED`: the request carries no bearer token, or one that is revoked, malformed, or minted for another environment (an `sbt_test_` token on production).
- `403`: `TOKEN_MISSING_ABILITY`: the token is valid but does not carry the ability this endpoint requires; `error.context.required_ability` names the one to grant. An endpoint that also checks who owns a row or which tier the account is on answers `FORBIDDEN`, `TEAM_TIER_REQUIRED` or `CONNECTOR_TIER_REQUIRED` with the same status, and says so in its own description. On this endpoint: `TEAM_TIER_REQUIRED`: when the creator has neither the Referral Program Addon nor a Growth plan.
- `404`: `RESOURCE_NOT_FOUND`: an id in the path names nothing the token can see. `TENANT_MISMATCH`: the project sits outside the token's `scope:project:` allow-list, or the token carries no team scope. Both answer 404 rather than 403 so that existence outside the token's scope cannot be inferred.
- `409`: `IDEMPOTENCY_KEY_REUSED`: the key was already used in the last 24 hours with a different request body.
- `422`: `VALIDATION_FAILED`: the payload broke a rule, and `error.fields` maps each offending key to its messages. A refusal from the domain, such as a plan that cannot go on sale or a member who cannot be removed, uses the same code with `error.message` saying why and no `fields`. On this endpoint: `VALIDATION_FAILED`: when a field is invalid, or the shape does not add up: a free-days reward without days, a cash commission without a type and a rate, a fixed commission without a currency, a percentage above 100, a friend coupon that is not one of the project's codes, or a friend coupon on a project whose plan has no coupon codes.
- `425`: `IDEMPOTENCY_REPLAY_IN_PROGRESS`: the first request with this key is still running; retry in a few seconds and the original response is replayed.
- `429`: `RATE_LIMITED`: the token has spent its 300 requests a minute or 10,000 an hour; `Retry-After` says when the next one is accepted.

---

[API](https://skmtc.dev/memberpass/apis/subscriby-rest-api.md) · [All operations](https://skmtc.dev/memberpass/apis/subscriby-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/memberpass/apis/subscriby-rest-api/revisions/59c4df91d764?raw)
