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

# Upgrade/Change Plan

> Perform a mid-cycle contract upgrade.

export const IntRedir = () => {
  if (typeof document === "undefined") {
    return null;
  } else {
    setTimeout(() => {
      const currentUrl = new URL(window.location.href);
      if (currentUrl.hostname === 'docs-int.wingback.com') {
        currentUrl.hostname = 'docs.wingback.com';
        window.location.replace(currentUrl.toString());
      }
    }, 1);
    return <></>;
  }
};

<IntRedir />


## OpenAPI

````yaml POST /v1/c/contract/{contract_id}/upgrade
openapi: 3.0.3
info:
  title: wingback-api
  description: ''
  contact:
    name: ''
  license:
    name: commercial
  version: 0.1.0
servers:
  - url: http://127.0.0.1:8080
    description: Local server
  - url: https://api.app.test.wingback.com
    description: Testing server
security: []
paths:
  /v1/c/contract/{contract_id}/upgrade:
    post:
      tags:
        - contract
      operationId: upgrade_contract
      parameters:
        - name: contract_id
          in: path
          description: Id of the Contract
          required: true
          schema:
            type: string
          example: Cont_cc871a3a-2b38-4689-a32d-14bf2e62b1ae
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/inbound.contract.WbCustomerUpgradeConfiguration
        required: true
      responses:
        '200':
          description: Upgraded
          content:
            application/json:
              schema:
                type: string
              example: Cont_cc871a3a-2b38-4689-a32d-14bf2e62b1ae
      security:
        - api-key: []
        - wb_user_cookie: []
components:
  schemas:
    inbound.contract.WbCustomerUpgradeConfiguration:
      type: object
      description: >-
        Upgrade configuration used when WbCustomer is performing a Contract
        Upgrade for a Customer
      required:
        - upgrade_configuration
      properties:
        downgrade_allowed:
          type: boolean
          description: >-
            By default downgrading to a cheaper plan can only be done at the end
            of the billing cycle

            This is done to avoid the need to refund unused part of the current
            billing cycle

            from the old contract

            However, WbCustomer may override this behaviour, and force immediate
            downgrade by

            setting this argument to `true`.

            Default is `false`
        upgrade_configuration:
          $ref: '#/components/schemas/UpgradeConfiguration'
    UpgradeConfiguration:
      oneOf:
        - allOf:
            - $ref: '#/components/schemas/PlanUpgrade'
            - type: object
              required:
                - upgrade_strategy
              properties:
                upgrade_strategy:
                  type: string
                  enum:
                    - new_plan
        - allOf:
            - $ref: '#/components/schemas/UnitCountUpgrade'
            - type: object
              required:
                - upgrade_strategy
              properties:
                upgrade_strategy:
                  type: string
                  enum:
                    - change_unit_count
        - allOf:
            - $ref: '#/components/schemas/BillingDateConfiguration'
            - type: object
              required:
                - upgrade_strategy
              properties:
                upgrade_strategy:
                  type: string
                  enum:
                    - change_billing_date
      description: >-
        Type of plan upgrade:

        * NewPlan - upgrade to a different plan

        * ChangeUnitCount - only increase or decrease the number of purchased
        units for the current plan


        The main difference between ChangeUnitCount and using NewPlan with the
        ID of the same plan

        is that if the prices of features changed between contract creation and
        current time,

        ChangeUnitCount will preserve the prices of features recorded in the
        contract,

        while using NewPlan will also mean that new prices will take effect.
      discriminator:
        propertyName: upgrade_strategy
    PlanUpgrade:
      type: object
      description: Configuration for upgrading from one plan to another
      required:
        - plan_id
        - cycle
        - currency
        - activation
        - unit_count_configuration
        - unit_configuration
      properties:
        activation:
          $ref: '#/components/schemas/UpgradeActivation'
        currency:
          $ref: '#/components/schemas/Currency'
        cycle:
          $ref: '#/components/schemas/Cycle'
        discount_id:
          allOf:
            - $ref: '#/components/schemas/Id'
          nullable: true
        plan_id:
          $ref: '#/components/schemas/Id'
        pricing_id:
          allOf:
            - $ref: '#/components/schemas/Id'
          nullable: true
        unit_configuration:
          type: object
          description: >-
            Configuration specifying overrides to apply to new plan during
            contract upgrade.

            In addition to the number of units to purchase, it is possible to

            override price and flat_fee of specific features to create
            customized plans

            See UnitConfiguration for format
          additionalProperties:
            $ref: '#/components/schemas/FeatureConfigurationInternal'
        unit_count_configuration:
          type: object
          description: >-
            Configuration specifying the number of units to purchase

            on the new plan for unit-based features. This is a hashmap where

            keys are slugs of features, and values are the numbers of units to
            purchase

            {

            "{feature_slug}": {number_of_units}

            }
          additionalProperties:
            type: string
    UnitCountUpgrade:
      type: object
      description: >-
        Configuration to only change the amount of purchased units in the active
        contract
      required:
        - activation
        - unit_count_configuration
      properties:
        activation:
          $ref: '#/components/schemas/UpgradeActivation'
        discount_id:
          allOf:
            - $ref: '#/components/schemas/Id'
          nullable: true
        unit_count_configuration:
          type: object
          description: >-
            Configuration specifying the number of units to purchase

            on the new plan for unit-based features. This is a hashmap where

            keys are slugs of features, and values are the numbers of units to
            purchase

            {

            "{feature_slug}": {number_of_units}

            }
          additionalProperties:
            type: string
    BillingDateConfiguration:
      type: object
      description: Configuration to only change the billing date of the active contract
      required:
        - date
        - recalculate_charges
      properties:
        date:
          type: string
          format: date-time
          description: >-
            New billing date. All subsequent charges will occur on the same day
            of the billing cycle.
        discount_id:
          allOf:
            - $ref: '#/components/schemas/Id'
          nullable: true
        recalculate_charges:
          type: boolean
          description: >-
            Determines if the customer will be charged for the difference in
            days/months

            between old and new billing dates
    UpgradeActivation:
      oneOf:
        - type: object
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - next_cycle
        - type: object
          required:
            - upgrade_date
            - type
          properties:
            type:
              type: string
              enum:
                - date
            upgrade_date:
              type: string
              format: date-time
              description: Date of the upgrade
      description: |-
        Configuration to choose the date when upgrade takes place:
        * NextCycle - at the beginning of the next billing cycle
        * Date - at the specific date (UTC)
      discriminator:
        propertyName: type
    Currency:
      type: string
      description: |-
        A supported currency

        The format for parsing and reading is the lowercased
        ISO 4217 currency code (e.g. "usd")
      enum:
        - usd
        - eur
        - gbp
        - brl
        - ars
    Cycle:
      type: string
      description: |-
        Enum that lists supported payment cycles for contracts:
        * Once - one-time payment
        * Constant - one-time payment for the duration of the contract
        * Week - contract is paid weekly
        * Month - contract is paid monthly
        * Quarter - contract is paid every quarter
        * Year - contract is paid yearly
      enum:
        - once
        - hour
        - day
        - week
        - month
        - quarter
        - year
        - constant
    Id:
      type: string
      description: >-
        Unique identifier of an object. Consists of object class prefix and a
        UUID
      example: Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670
    FeatureConfigurationInternal:
      type: object
      description: >-
        Helper structure to store the overridden price and flat_fee for
        customized

        contracts, as well as the number of units being purchased for the
        contract
      properties:
        flat_fee:
          type: string
          description: the overridden flat_fee for the usage-based feature
          nullable: true
        price:
          type: string
          description: the overridden price of the given feature
          nullable: true
        purchased:
          type: boolean
          description: >-
            used for optional features - the optional feature is added to the
            contract only if this

            is set to `true`
          nullable: true
        tiers:
          type: array
          items:
            $ref: '#/components/schemas/Tier'
          description: Override tiers
          nullable: true
        unit_count:
          type: string
          description: the number of units being purchased
          nullable: true
    Tier:
      type: object
      description: A pricing tier
      required:
        - tier_start
        - tier_end
        - amount
      properties:
        amount:
          type: string
          description: Price per unit for this tier
        tier_end:
          $ref: '#/components/schemas/TierValue'
        tier_start:
          type: string
          description: Number of units where this tier starts applying.
    TierValue:
      oneOf:
        - type: object
          required:
            - Concrete
          properties:
            Concrete:
              type: string
        - type: string
          enum:
            - Infinity
      description: Either a number of `infinity`. Must be a string
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: wb-key
    wb_user_cookie:
      type: apiKey
      in: cookie
      name: app-session

````