---
title: "Assign Affiliate to Membership"
method: POST
path: "/memberships/{id}/assign_affiliate"
tags: ["Memberships"]
---

# Assign Affiliate to Membership

`POST /memberships/{id}/assign_affiliate`

## Request

- Base URL: `https://api.whop.com/api/v1`
- URL: `https://api.whop.com/api/v1/memberships/{id}/assign_affiliate`
- Auth: HTTP bearer

Assigns an affiliate to a membership and pays them the commission you set on its future payments; past payments are not recalculated. A user who is not yet an affiliate of your account becomes one, which also requires `affiliate:create`. Send a new `commission_type` or `commission_value` for the membership's current affiliate to change their commission; a membership that already has a different affiliate returns a conflict. Works for active or trialing memberships with one recurring variant that bill through Stripe or Whop's billing engine, and not for marketplace memberships, paused payments, or a scheduled cancellation. You cannot assign yourself.

## Path parameters

- `id` string, required

## Headers

- `Api-Version-Date` string
- `Idempotency-Key` string

## Request body

- object
  - `commission_type` 'flat_fee' | 'percentage', required: Whether the commission is a percentage of each payment or a fixed amount per payment.
  - `commission_value` number, required: A whole number from 1 to 90 for `percentage`, or an amount greater than 1 in the membership currency for `flat_fee`. The payout cannot exceed 90% of the next renewal amount. Flat fees need matching billing and settlement currencies.
  - `email` string: Email address of the user to assign. Pass exactly one of `user_id`, `email`, or `username`.
  - `user_id` string: The user to assign, prefixed `user_`. Pass exactly one of `user_id`, `email`, or `username`.
  - `username` string: Whop username of the user to assign. Pass exactly one of `user_id`, `email`, or `username`.

## Response `200`

affiliate assigned

- Membership
  - `account` StorefrontAccount, required: The account (seller) this membership belongs to.
    - `banner_image_url` string, nullable, required: Account banner image URL. `null` when the account has not set one.
    - `id` string, required: Account ID, prefixed `biz_`.
    - `logo_url` string, nullable, required: Account logo image URL. `null` when the account has not set one.
    - `route` string, required: Account public route identifier, used in the `whop.com/{route}` storefront path.
    - `title` string, required: Account display name.
  - `affiliate` MembershipAffiliate, nullable, required
    - `applies_to_payments` 'first_payment' | 'all_payments', required: Whether the commission is paid on the membership's first payment only or on all its payments.
    - `commission_amount` Money, nullable, required
      - `amount` string, required: The amount in major units, as an exact decimal string. For example, `"10.00"` is ten dollars. It is a string so that no float rounds it in transit.
      - `currency` string, required: Three-letter ISO 4217 currency code, lowercase.
      - `decimals` integer, required: How many decimal places the amount carries. This is the precision the charge itself runs at.
      - `display_decimals` integer, required: How many decimal places to SHOW. Usually equal to `decimals`, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is `2` and `0`. Format the number in your own locale using this.
    - `commission_percentage` number, nullable, required: The percentage commission in percentage points, so `20` means 20%, or `null` for a flat fee.
    - `commission_source` 'custom' | 'member' | 'marketplace' | 'global', required: How the commission rate was set: `custom` for a rate set for this affiliate, `member` for the member affiliate rate of the plan or product, `global` for the product's global affiliate rate, or `marketplace` for a Whop marketplace referral.
    - `commission_type` 'flat_fee' | 'percentage', required: Whether the commission is a percentage or a flat fee.
    - `enabled` boolean, required: Whether this membership pays affiliate commissions. `false` means the affiliate is kept on the membership but is no longer paid.
    - `id` string, required: Affiliate ID, prefixed `aff_`.
    - `user_id` string, required: ID of the affiliate's user, prefixed `user_`.
  - `billing_period_days` integer, nullable, required: Number of days between recurring charges. `null` for non-renewing memberships or memberships with multiple renewal schedules.
  - `cancel_at_period_end` boolean, required: Whether the membership is set to cancel when the current billing period ends. Only meaningful for recurring variants.
  - `cancel_option` 'too_expensive' | 'switching' | 'missing_features' | 'technical_issues' | 'bad_experience' | 'unused' | 'other' | 'testing' | 'null', nullable, required: The category the member picked for why they canceled. `null` when no category was picked.
  - `canceled_at` string, nullable, required: When cancellation was requested, or when the membership was canceled if no request time is recorded, as an ISO 8601 timestamp. `null` when neither is recorded.
  - `cancellation_reason` string, nullable, required: Free-text explanation provided when canceling. `null` when no reason was provided.
  - `collection_method` 'charge_automatically' | 'send_invoice' | 'null', nullable, required: How renewals are collected. `charge_automatically` charges the saved payment method each period; `send_invoice` emails the buyer an invoice each period. `null` when not set.
  - `created_at` string, required: When the membership was created, as an ISO 8601 timestamp.
  - `current_period_end` string, nullable, required: When the current billing period renews, or when a non-renewing membership expires, as an ISO 8601 timestamp. `null` for one-time purchases with no expiration.
  - `current_period_start` string, nullable, required: When the current billing period started, as an ISO 8601 timestamp. `null` when no billing period is recorded.
  - `expires_at` string, nullable, required: When access ends for a membership with a fixed expiration, as an ISO 8601 timestamp. `null` when the membership has no expiration, such as a renewing membership.
  - `external_accounts` MembershipExternalAccount[], nullable, required
    - `external_id` string, required: The member's user ID on the platform, such as a Discord user ID. Prefixed with the platform (`discord_<external_id>`), it is the `external_account` value List Memberships filters by.
    - `platform` 'discord' | 'telegram', required: The platform the member's account is on.
    - `username` string, nullable, required: The member's username on the platform. `null` when Whop doesn't know it, such as for a membership imported with only a Discord ID.
  - `feedback_option` MembershipFeedbackOption, nullable, required
    - `label` string, required: The option's label when the member picked it. Renaming the option later does not change it.
  - `id` string, required: Membership ID, prefixed `mem_`.
  - `initial_price` Money, required: The variant's current up-front price, in the variant's currency. A list price, not necessarily what the buyer paid. `amount` is `"0.00"` when the first charge is free.
    - `amount` string, required: The amount in major units, as an exact decimal string. For example, `"10.00"` is ten dollars. It is a string so that no float rounds it in transit.
    - `currency` string, required: Three-letter ISO 4217 currency code, lowercase.
    - `decimals` integer, required: How many decimal places the amount carries. This is the precision the charge itself runs at.
    - `display_decimals` integer, required: How many decimal places to SHOW. Usually equal to `decimals`, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is `2` and `0`. Format the number in your own locale using this.
  - `license_key` string, nullable, required: The software license key for this membership. Only present when the product includes a software licensing experience.
  - `manage_url` string, nullable, required: URL where the buyer can sign in to manage billing. `null` without a member record or unless the caller is the buyer or has `member:manage` on the account.
  - `member` MembershipMember, nullable, required
    - `access_level` 'no_access' | 'admin' | 'customer', required: What the member can reach on the account: `customer` for paying members, `admin` for team members, `no_access` once every grant has lapsed.
    - `last_accessed_at` string, nullable, required: When the member last opened the account's content, as an ISO 8601 timestamp. `null` if they never have.
    - `position` number, nullable, required: The member's sort position in the buyer's own account list. `null` until they arrange it.
  - `member_id` string, nullable, required: The buyer's member record on the account, prefixed `mber_`. `null` when the membership has no member record, such as an unclaimed membership.
  - `metadata` object, required: Custom key-value pairs stored on the membership, commonly used for software licensing.
  - `most_recent_action` 'canceled_on' | 'finished_split_pay_at' | 'canceling_on' | 'ending_on' | 'renewing_on' | 'past_due' | 'next_payment_attempt' | 'paused_at' | 'trial_ends_at' | 'unresolved_at' | 'trial_canceling_on' | 'null', nullable, required: The membership's latest lifecycle event, such as `renewing_on` or `canceled_on`. Pair it with `most_recent_action_at`. `null` when none is recorded.
  - `most_recent_action_at` string, nullable, required: When `most_recent_action` happened or is scheduled to happen, as an ISO 8601 timestamp. A future time for upcoming events such as `renewing_on`. `null` when no action is recorded.
  - `phone_number` string, nullable, required: The buyer's phone number recorded for this membership, or `null`. The number collected (or verified) at checkout when the seller's phone collection is on; falls back to the buyer's account number when they have shared one with this seller.
  - `product` MembershipProduct, required: The product this membership grants access to.
    - `id` string, required: Product ID, prefixed `prod_`.
    - `logo_url` string, nullable, required: Product logo image URL. `null` when the product has no logo.
    - `title` string, required: Product display name.
  - `product_id` string, required: The product this membership grants access to, prefixed `prod_`.
  - `promo_code_id` string, nullable, required: The promo code discounting this membership, prefixed `promo_`. `null` when none is applied. Set at checkout or by Apply Promo Code to Membership.
  - `renewal_price` Money, nullable, required
    - `amount` string, required: The amount in major units, as an exact decimal string. For example, `"10.00"` is ten dollars. It is a string so that no float rounds it in transit.
    - `currency` string, required: Three-letter ISO 4217 currency code, lowercase.
    - `decimals` integer, required: How many decimal places the amount carries. This is the precision the charge itself runs at.
    - `display_decimals` integer, required: How many decimal places to SHOW. Usually equal to `decimals`, and deliberately not always: COP is charged in centavos but written in whole pesos, so it is `2` and `0`. Format the number in your own locale using this.
  - `split_pay_current_payments` integer, nullable, required: Paid installments counted so far on a split pay membership. `null` when the membership is not on split pay, or before its first installment is counted.
  - `split_pay_required_payments` integer, nullable, required: Installment payments required before the membership stops billing. `null` when the membership is not on split pay.
  - `status` 'trialing' | 'active' | 'past_due' | 'completed' | 'canceled' | 'expired' | 'unresolved' | 'scheduled', required: Billing state of the membership. `active` and `trialing` memberships grant access. `past_due` is the grace period after a failed payment. `completed` one-time purchases keep access. `scheduled` memberships wait for their variant's start date, when the first charge runs and access starts. `canceled` and `expired` memberships do not grant access.
  - `updated_at` string, required: When the membership was last changed, as an ISO 8601 timestamp. Reflects the most recent change to the membership itself, so you can reconcile against webhook retries, replays, and backfills.
  - `user_id` string, nullable, required: The buyer, prefixed `user_`. `null` when the buyer is another business or the membership is unclaimed.
  - `variant_id` string, required: The variant the buyer purchased, prefixed `plan_`.

## Other responses

- `400`: Invalid Parameters
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Resource not found
- `409`: Conflict
- `503`: Service Unavailable

## Changes

- **2026-11-25** `1a0055e4f5df`: 1 warning
  - added the new `scheduled` enum value to the `status` response property for the response status `200`
- **2026-11-24** `44189be0e68a`: 1 info
  - added the required property `account/banner_image_url` to the response with the `200` status
- **2026-11-03** `9109f75faead`: 1 info
  - added the required property `external_accounts` to the response with the `200` status
- **2026-10-27** `3f9894af7679`: 1 breaking, 1 info
  - removed the required property `plan_id` from the response with the `200` status
  - added the required property `variant_id` to the response with the `200` status
- **2026-10-27** `874a62e00f25`: 1 info
  - added the required property `affiliate/oneOf[#/components/schemas/MembershipAffiliate]/commission_source` to the response with the `200` status

[Operation history](https://skmtc.dev/whop/apis/whop-api/changes/memberships/:id/assign_affiliate/post.md)

---

[API](https://skmtc.dev/whop/apis/whop-api.md) - [All operations](https://skmtc.dev/whop/apis/whop-api/llms.txt) - [OpenAPI document](https://skmtc.dev/whop/apis/whop-api/revisions/b10d1ab093e8?raw)
