---
title: "Set Promo Code"
method: POST
path: "/v1/referral/set_promo_code"
tags: ["referral"]
---

# Set Promo Code

`POST /v1/referral/set_promo_code`

## Request

- Base URL: `https://api.linktodm.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.linktodm.com/v1/referral/set_promo_code`
- Auth: HTTP bearer

Set the member's promo code to one they picked.

Their previous code keeps working until the new one is live at a provider,
and is retired once it is.

## Request body

- SetPromoCodePayload: A code the member picked for themselves.
  - `code` string, required

## Response `200`

Successful Response

- UserReferralCodeResponseSchema: What the refer-and-earn page needs: the link code plus the promo code. `promo_code` is None until the member activates one -- codes are never minted by reading this, because creating one also creates discounts at the payment providers. `suggested_promo_code` is what activating would give them, computed without writing anything.
  - `referral_code` string, required
  - `promo_code` string, nullable
  - `promo_discount_percent` integer, nullable
  - `suggested_promo_code` string, nullable
  - `can_refer` boolean
  - `min_followers` integer
  - `state` 'LOCKED_FREE' | 'LOCKED_FOLLOWERS' | 'ELIGIBLE' | 'ACTIVATED': Where a member stands in the referral programme. LOCKED_FREE no paid plan LOCKED_FOLLOWERS paid, but no Instagram account over the follower bar ELIGIBLE allowed a code, hasn't activated one yet ACTIVATED holds a live code

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/linktodm/apis/salesmorph.md) - [All operations](https://skmtc.dev/linktodm/apis/salesmorph/llms.txt) - [OpenAPI document](https://skmtc.dev/linktodm/apis/salesmorph/revisions/4af0ad5dbe92?raw)
