> ## Documentation Index
> Fetch the complete documentation index at: https://togai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrates accounts which are associated to one price plan to another price plan

> Migrates accounts which are associated to one price plan to another price plan



## OpenAPI

````yaml post /migrations/price_plan
openapi: 3.0.3
info:
  version: '1.0'
  title: Togai Apis
  contact:
    email: engg@togai.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  description: APIs for Togai App
servers:
  - description: Api endpoint
    url: https://api.togai.com/
  - description: Sandbox api endpoint
    url: https://sandbox-api.togai.com/
security:
  - bearerAuth: []
tags:
  - name: Customers
    description: Customer level calls
  - name: Accounts
    description: Account level calls
  - name: Event Schemas
    description: Event Schema level calls
  - name: Usage Meters
    description: Usage Meter level calls
  - name: Price Plans
    description: Price Plan level calls
  - name: Settings
    description: Settings
  - name: Price Experimentation
    description: Price Experimentation apis
  - name: InvoiceGroups
    description: Invoice Group level calls
  - name: Organization
    description: Organization level calls
  - name: FileStorage
    description: File Storage level calls
  - name: Aliases
    description: Alias level calls
  - name: Event Management
    description: APIs for getting events ingested in Togai
    externalDocs:
      description: docs
      url: https://togai.com/docs/billing/events
  - name: Metrics
    description: APIs for getting Togai metrics
    externalDocs:
      description: docs
      url: https://togai.com/docs/metrics
  - name: Licenses
    description: APIs for getting or updating license records in Togai
  - name: Entitlements
    description: APIs related to entitlements
  - name: Invoices
    description: Invoices API
  - name: Credits
    description: Credits API
  - name: Wallet
    description: Wallet API
  - name: InvoiceTemplates
    description: InvoiceTemplates API
  - name: Payments
    description: Payments API
  - name: Authentication
    description: Authentication API
externalDocs:
  description: Find out more about Togai
  url: https://docs.togai.com/docs
paths:
  /migrations/price_plan:
    post:
      tags:
        - Migrations
      summary: >-
        Migrates accounts which are associated to one price plan to another
        price plan
      description: >-
        Migrates accounts which are associated to one price plan to another
        price plan
      operationId: migratePricePlan
      requestBody:
        $ref: '#/components/requestBodies/CreatePricePlanMigrationRequest'
      responses:
        '201':
          $ref: '#/components/responses/BaseSuccessResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
        '401':
          $ref: '#/components/responses/ErrorResponse'
        '403':
          $ref: '#/components/responses/ErrorResponse'
        '404':
          $ref: '#/components/responses/ErrorResponse'
        '429':
          $ref: '#/components/responses/ErrorResponse'
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  requestBodies:
    CreatePricePlanMigrationRequest:
      description: Payload to update organization setting
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreatePricePlanMigrationRequest'
          examples:
            CreatePricePlanMigrationRequest:
              $ref: '#/components/examples/CreatePricePlanMigrationRequest'
  responses:
    BaseSuccessResponse:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BaseSuccessResponse'
    ErrorResponse:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            ErrorResponse:
              summary: Error message
              value:
                message: <Reason message>
  schemas:
    CreatePricePlanMigrationRequest:
      description: >-
        Request to migrate all account associations of a price plan to another
        price plan
      type: object
      additionalProperties: false
      required:
        - sourceId
        - sourceVersion
        - targetId
        - targetVersion
        - migrationMode
      properties:
        sourceId:
          description: Id of source price plan
          type: string
          maxLength: 255
        sourceVersion:
          description: Version of the source price plan
          type: integer
          format: int32
        targetId:
          description: Id of target price plan
          type: string
          maxLength: 255
        targetVersion:
          description: Version of the target price plan
          type: integer
          format: int32
        migrationMode:
          type: string
          enum:
            - IMMEDIATE
            - IMMEDIATE_IGNORE_OVERRIDE
            - NEXT_CYCLE
            - NEXT_CYCLE_IGNORE_OVERRIDE
        retainStartOffsets:
          type: boolean
          description: >
            If this flag is true, current pricing cycle of the account on the
            date of association will continue rather 

            than the configurations of the newly associated price plan. Pricing
            cycle overrides specified  using 

            `pricePlanDetailsOverride` will take precedence over the pricing
            cycle configurations of 

            the new price plan that the account needs to migrate to.
            PricingCycleInterval of the existing plan and 

            the new plan must be same for this to work. We'll return a `400
            BadRequest` otherwise.

            Examples:
              - Ongoing plan (1st Oct to 30th Oct) - {dayOffset: 1, monthOffset: NIL}
                New association (15th Oct to 15th Nov) of different price plan with retainStartOffsets option true 
                will use the same pricing cycle configuration {dayOffset: 1, monthOffset: NIL} rather than using the
                pricing cycle configuration of the new price plan that the account needs to migrate to.
              - Ongoing plan (1st Oct to 30th Oct) - {dayOffset: 1, monthOffset: NIL}
                New association (1st Nov to 30th Nov) of different price plan with retainStartOffsets option true will
                throw a `400 BadRequest` as no existing price plan configuration found on date of association 
    BaseSuccessResponse:
      type: object
      additionalProperties: false
      required:
        - success
      properties:
        success:
          type: boolean
          example: true
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - message
      properties:
        message:
          type: string
          description: error description
          maxLength: 500
  examples:
    CreatePricePlanMigrationRequest:
      value:
        sourceId: pp.1zYnCiM9Bpg.lv25y
        sourceVersion: 1
        targetId: pp.2zYnCiM9Bpg.bfeu2
        targetVersion: 2
        migrationMode: IMMEDIATE
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Bearer <credential>

````