> ## Documentation Index
> Fetch the complete documentation index at: https://www.referly.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update commission plans

> Requires `commission-plans:write`. See [Commission plans behavior](/developer-documentation/api/management) and [common API rules](/developer-documentation/api/overview).

Requires `commission-plans:write`. See the [commission plans guide](https://www.referly.so/docs/developer-documentation/api/management.md) for behavior and examples.


## OpenAPI

````yaml PATCH /commission-plans/{id}
openapi: 3.0.3
info:
  title: Referly API
  description: >-
    REST API for affiliates, referrals, sales, links, coupons, programs, groups,
    commission plans, commissions, adjustments, balances, payouts, analytics and
    webhooks. Send Authorization: Bearer <YOUR_API_KEY>. Keys have resource
    permissions and optional expiry. Requests default to the key’s original
    program; operational endpoints also support X-Program-Id for a program
    created by that exact key. See the authentication and operational API guides
    for scope, pagination, errors and retry behavior.
  version: 1.0.0
servers:
  - url: https://www.referly.so/api/v1
security:
  - bearerAuth: []
paths:
  /commission-plans/{id}:
    patch:
      tags:
        - commission-plans
      summary: Update commission plans
      description: >-
        Requires `commission-plans:write`. See [Commission plans
        behavior](/developer-documentation/api/management) and [common API
        rules](/developer-documentation/api/overview).
      operationId: patch_commission_plans_id_
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            minLength: 8
            maxLength: 200
            pattern: ^[\x21-\x7e]+$
          description: >-
            Optional retry key, unique within the selected program. Reuse the
            same key, method, path and validated payload; a conflicting reuse
            returns 409.
        - name: X-Program-Id
          in: header
          required: false
          description: >-
            Select the key's original program or a program provisioned by this
            exact key. Other owned programs remain inaccessible.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OperationalPlanPatch'
      responses:
        '200':
          description: Success; see management guide for state and accounting semantics
          content:
            application/json:
              schema:
                $ref: 2dd373fe-872c-4f51-bece-3253fdaeba14
              example:
                id: plan_standard
                name: Standard Partner Plan
                affiliateProgramId: prog_acme_partners
                affiliateGroupId: null
                commissionRate: 20
                commissionType: PERCENTAGE
                numberOfPayments: 0
                numberOfMonths: 0
                baseCondition: ALL
                isActive: true
                paymentTrigger: PURCHASE
                rewardType: CASH
                nonCashRewardType: null
                nonCashTrigger: null
                nonCashCouponId: null
                nonCashSignupsRequired: null
                nonCashMaxCoupons: null
                nonCashPurchaseTrigger: null
                nonCashPurchaseCount: null
                nonCashPurchaseMonthLimit: null
                creditType: null
                creditMaxTimes: null
                creditPerCurrencyUnit: null
                creditCalculationMode: null
                creditFlatPerPurchase: null
                creditPurchaseLimit: null
                creditPurchaseMonthLimit: null
                creditAmount: null
                creditUnit: null
                autoApproveAffiliates: true
                autoApproveRewards: true
                createdAt: '2026-09-01T12:00:00.000Z'
                updatedAt: '2026-09-01T12:00:00.000Z'
                commissionRuleGroups:
                  - id: rule_group_1
                    commissionPlanId: plan_standard
                    commissionAmountId: null
                    order: 0
                    groupCondition: ALL
                    createdAt: '2026-09-01T12:00:00.000Z'
                    updatedAt: '2026-09-01T12:00:00.000Z'
                    commissionRules:
                      - id: rule_1
                        commissionRuleGroupId: rule_group_1
                        ruleType: ORDER_AMOUNT
                        condition: GREATER_THAN
                        value: '100'
                        createdAt: '2026-09-01T12:00:00.000Z'
                        updatedAt: '2026-09-01T12:00:00.000Z'
                commissionAmounts:
                  - id: amount_1
                    commissionPlanId: plan_standard
                    productRequirement: '[\"api:0\"]'
                    commissionRate: 25
                    commissionType: PERCENTAGE
                    numberOfPayments: 3
                    numberOfMonths: 0
                    creditAmount: null
                    creditFlatPerPurchase: null
                    creditPerCurrencyUnit: null
                    nonCashCouponId: null
                    nonCashPurchaseTrigger: null
                    nonCashPurchaseCount: null
                    nonCashPurchaseMonthLimit: null
                    ruleGroups: []
                    commissionAfterPeriods:
                      - id: period_1
                        order: 1
                        commissionType: PERCENTAGE
                        commissionRate: 10
                        numberOfMonths: 0
                        numberOfPayments: 0
                        affiliateProgramId: null
                        commissionPlanId: null
                        commissionAmountId: amount_1
                        createdAt: '2026-09-01T12:00:00.000Z'
                        updatedAt: '2026-09-01T12:00:00.000Z'
                commissionAfterPeriods: []
                CommissionTier:
                  - id: tier_1
                    name: Tier 1
                    tier: 1
                    minReferrals: 0
                    minRevenue: 0
                    conditionType: ALL
        '400':
          description: Request failed (400); see the common error contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: invalid_json
                  message: Invalid JSON body
                  requestId: 5c1f7a2e-2b39-4c2d-9c31-7a6e0f6a9b21
        '401':
          description: Request failed (401); see the common error contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: unauthorized
                  message: Invalid, expired or revoked API key
                  requestId: 5c1f7a2e-2b39-4c2d-9c31-7a6e0f6a9b21
        '403':
          description: Request failed (403); see the common error contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: insufficient_scope
                  message: Requires commission-plans:write
                  requestId: 5c1f7a2e-2b39-4c2d-9c31-7a6e0f6a9b21
        '404':
          description: Request failed (404); see the common error contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: not_found
                  message: Resource not found
                  requestId: 5c1f7a2e-2b39-4c2d-9c31-7a6e0f6a9b21
        '409':
          description: Request failed (409); see the common error contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: plan_in_use
                  message: >-
                    Reassign affiliates, tiers and defaults before archiving a
                    plan
                  requestId: 5c1f7a2e-2b39-4c2d-9c31-7a6e0f6a9b21
        '413':
          description: Request failed (413); see the common error contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: body_too_large
                  message: Request body must be at most 64 KiB
                  requestId: 5c1f7a2e-2b39-4c2d-9c31-7a6e0f6a9b21
        '422':
          description: Request failed (422); see the common error contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: validation_error
                  message: Invalid request parameters
                  requestId: 5c1f7a2e-2b39-4c2d-9c31-7a6e0f6a9b21
        '429':
          description: Request failed (429); see the common error contract
          content:
            application/json:
              schema:
                $ref: f48d42e5-fe37-407f-b348-be8b1adae0be
              example:
                error: Too many requests. Please slow down.
                retryAfter: 42
        '500':
          description: Request failed (500); see the common error contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: internal_error
                  message: Request failed
                  requestId: 5c1f7a2e-2b39-4c2d-9c31-7a6e0f6a9b21
components:
  schemas:
    OperationalPlanPatch:
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        commissionRate:
          type: number
          minimum: 0
          maximum: 1000000000
          default: 0
        commissionType:
          type: string
          enum:
            - PERCENTAGE
            - FLAT
          default: PERCENTAGE
        numberOfPayments:
          type: integer
          minimum: 0
          maximum: 1000000
          default: 0
        numberOfMonths:
          type: integer
          minimum: 0
          maximum: 1000000
          default: 0
        creditAmount:
          type: number
          minimum: 0
          maximum: 1000000000
          nullable: true
        creditFlatPerPurchase:
          type: number
          minimum: 0
          maximum: 1000000000
          nullable: true
        creditPerCurrencyUnit:
          type: number
          minimum: 0
          maximum: 1000000000
          nullable: true
        nonCashCouponId:
          type: string
          minLength: 1
          maxLength: 200
          nullable: true
        nonCashPurchaseTrigger:
          type: string
          enum:
            - FIRST_PURCHASE
            - X_PURCHASES
          nullable: true
        nonCashPurchaseCount:
          type: integer
          minimum: 0
          maximum: 1000000
          nullable: true
        nonCashPurchaseMonthLimit:
          type: integer
          minimum: 0
          maximum: 1000000
          nullable: true
        baseCondition:
          type: string
          enum:
            - ALL
            - SOME
          default: ALL
        paymentTrigger:
          type: string
          enum:
            - PURCHASE
            - SIGNUP
          default: PURCHASE
        isActive:
          type: boolean
          default: true
        rewardType:
          type: string
          enum:
            - CASH
            - NON_CASH
          default: CASH
        nonCashRewardType:
          type: string
          enum:
            - COUPON
            - CUSTOM_CREDITS
          nullable: true
          default: null
        nonCashTrigger:
          type: string
          enum:
            - SIGNUP
            - PURCHASE
          nullable: true
          default: null
        nonCashSignupsRequired:
          type: integer
          minimum: 0
          maximum: 1000000
          nullable: true
        nonCashMaxCoupons:
          type: integer
          minimum: 0
          maximum: 1000000
          nullable: true
        creditType:
          type: string
          enum:
            - SHOPIFY_STORE_CREDITS
            - STRIPE_CREDITS
            - WOOCOMMERCE_CREDITS
            - CREEM_CREDITS
            - CUSTOM
          nullable: true
        creditUnit:
          type: string
          minLength: 1
          maxLength: 100
          nullable: true
        creditMaxTimes:
          type: integer
          minimum: 0
          maximum: 1000000
          nullable: true
        creditCalculationMode:
          type: string
          enum:
            - FLAT_PER_PURCHASE
            - PER_CURRENCY_UNIT
          nullable: true
        creditPurchaseLimit:
          type: integer
          minimum: 0
          maximum: 1000000
          nullable: true
        creditPurchaseMonthLimit:
          type: integer
          minimum: 0
          maximum: 1000000
          nullable: true
        autoApproveAffiliates:
          type: boolean
          default: true
        autoApproveRewards:
          type: boolean
          default: true
        ruleGroups:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              groupCondition:
                type: string
                enum:
                  - ALL
                  - SOME
                default: ALL
              rules:
                type: array
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    ruleType:
                      type: string
                      enum:
                        - ORDER_AMOUNT
                        - PRODUCT
                        - MEDIUM
                        - LANDING_PAGE
                        - STATEMENT_DESCRIPTION
                        - COUPON_USED
                    condition:
                      type: string
                      enum:
                        - ANY
                        - NONE
                        - IS
                        - IS_NOT
                        - GREATER_THAN
                        - LESS_THAN
                        - CONTAINS
                        - DOES_NOT_CONTAIN
                    value:
                      type: string
                      maxLength: 10000
                  required:
                    - ruleType
                    - condition
                    - value
                minItems: 1
                maxItems: 50
            required:
              - rules
          maxItems: 50
          default: []
        amounts:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              commissionRate:
                type: number
                minimum: 0
                maximum: 1000000000
                default: 0
              commissionType:
                type: string
                enum:
                  - PERCENTAGE
                  - FLAT
                default: PERCENTAGE
              numberOfPayments:
                type: integer
                minimum: 0
                maximum: 1000000
                default: 0
              numberOfMonths:
                type: integer
                minimum: 0
                maximum: 1000000
                default: 0
              creditAmount:
                type: number
                minimum: 0
                maximum: 1000000000
                nullable: true
              creditFlatPerPurchase:
                type: number
                minimum: 0
                maximum: 1000000000
                nullable: true
              creditPerCurrencyUnit:
                type: number
                minimum: 0
                maximum: 1000000000
                nullable: true
              nonCashCouponId:
                type: string
                minLength: 1
                maxLength: 200
                nullable: true
              nonCashPurchaseTrigger:
                type: string
                enum:
                  - FIRST_PURCHASE
                  - X_PURCHASES
                nullable: true
              nonCashPurchaseCount:
                type: integer
                minimum: 0
                maximum: 1000000
                nullable: true
              nonCashPurchaseMonthLimit:
                type: integer
                minimum: 0
                maximum: 1000000
                nullable: true
              ruleGroups:
                type: array
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    groupCondition:
                      type: string
                      enum:
                        - ALL
                        - SOME
                      default: ALL
                    rules:
                      type: array
                      items:
                        type: object
                        additionalProperties: false
                        properties:
                          ruleType:
                            type: string
                            enum:
                              - ORDER_AMOUNT
                              - PRODUCT
                              - MEDIUM
                              - LANDING_PAGE
                              - STATEMENT_DESCRIPTION
                              - COUPON_USED
                          condition:
                            type: string
                            enum:
                              - ANY
                              - NONE
                              - IS
                              - IS_NOT
                              - GREATER_THAN
                              - LESS_THAN
                              - CONTAINS
                              - DOES_NOT_CONTAIN
                          value:
                            type: string
                            maxLength: 10000
                        required:
                          - ruleType
                          - condition
                          - value
                      minItems: 1
                      maxItems: 50
                  required:
                    - rules
                maxItems: 50
                default: []
              afterPeriods:
                type: array
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    commissionRate:
                      type: number
                      minimum: 0
                      maximum: 1000000000
                      default: 0
                    commissionType:
                      type: string
                      enum:
                        - PERCENTAGE
                        - FLAT
                      default: PERCENTAGE
                    numberOfPayments:
                      type: integer
                      minimum: 0
                      maximum: 1000000
                      default: 0
                    numberOfMonths:
                      type: integer
                      minimum: 0
                      maximum: 1000000
                      default: 0
                maxItems: 50
                default: []
          maxItems: 50
          default: []
        afterPeriods:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              commissionRate:
                type: number
                minimum: 0
                maximum: 1000000000
                default: 0
              commissionType:
                type: string
                enum:
                  - PERCENTAGE
                  - FLAT
                default: PERCENTAGE
              numberOfPayments:
                type: integer
                minimum: 0
                maximum: 1000000
                default: 0
              numberOfMonths:
                type: integer
                minimum: 0
                maximum: 1000000
                default: 0
          maxItems: 50
          default: []
      minProperties: 1
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human readable description of what went wrong
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.