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

# Clone a PricingModel



## OpenAPI

````yaml https://app.flowglad.com/api/openapi post /api/v1/pricing-models/{id}/clone
openapi: 3.1.0
info:
  title: Flowglad API
  version: 0.0.1
servers:
  - url: https://app.flowglad.com
security: []
externalDocs:
  url: https://docs.flowglad.com
paths:
  /api/v1/pricing-models/{id}/clone:
    post:
      tags:
        - Pricing Models
      summary: Clone a PricingModel
      operationId: pricingModels-clone
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  description: The name of the new pricing model.
                  type: string
                destinationEnvironment:
                  type: string
                  enum:
                    - livemode
                    - testmode
              required:
                - name
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  pricingModel:
                    $ref: '#/components/schemas/PricingModelDetailsRecord'
                required:
                  - pricingModel
                additionalProperties: false
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '401':
          description: Authorization not provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.UNAUTHORIZED'
        '403':
          description: Insufficient access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.FORBIDDEN'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    PricingModelDetailsRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        isDefault:
          type: boolean
        name:
          type: string
        products:
          type: array
          items:
            $ref: '#/components/schemas/ProductWithPricesRecord'
        usageMeters:
          type: array
          items:
            $ref: '#/components/schemas/UsageMeterWithPricesRecord'
        defaultProduct:
          $ref: '#/components/schemas/ProductWithPricesRecord'
          description: >-
            The default product for the pricing model. If no product is
            explicitly set as default, will return undefined.
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - isDefault
        - name
        - products
        - usageMeters
      additionalProperties: false
    error.BAD_REQUEST:
      title: Invalid input data error (400)
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Invalid input data
          type: string
        code:
          description: The error code
          example: BAD_REQUEST
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    error.UNAUTHORIZED:
      title: Authorization not provided error (401)
      description: The error information
      example:
        code: UNAUTHORIZED
        message: Authorization not provided
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Authorization not provided
          type: string
        code:
          description: The error code
          example: UNAUTHORIZED
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    error.FORBIDDEN:
      title: Insufficient access error (403)
      description: The error information
      example:
        code: FORBIDDEN
        message: Insufficient access
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Insufficient access
          type: string
        code:
          description: The error code
          example: FORBIDDEN
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    error.INTERNAL_SERVER_ERROR:
      title: Internal server error error (500)
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: Internal server error
        issues: []
      type: object
      properties:
        message:
          description: The error message
          example: Internal server error
          type: string
        code:
          description: The error code
          example: INTERNAL_SERVER_ERROR
          type: string
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
    ProductWithPricesRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        name:
          type: string
        description:
          anyOf:
            - type: string
            - type: 'null'
        imageURL:
          anyOf:
            - type: string
            - type: 'null'
        organizationId:
          type: string
        active:
          type: boolean
        singularQuantityLabel:
          anyOf:
            - type: string
            - type: 'null'
        pluralQuantityLabel:
          anyOf:
            - type: string
            - type: 'null'
        pricingModelId:
          type: string
        default:
          type: boolean
        slug:
          description: Unique identifier for the product within its pricing model
          type: string
          minLength: 1
          maxLength: 255
        prices:
          type: array
          items:
            $ref: '#/components/schemas/PriceRecord'
        defaultPrice:
          $ref: '#/components/schemas/PriceRecord'
          description: >-
            The default price for the product. If no price is explicitly set as
            default, will return the first price created for the product..
        features:
          type: array
          items:
            $ref: '#/components/schemas/FeatureRecord'
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - name
        - description
        - imageURL
        - organizationId
        - active
        - singularQuantityLabel
        - pluralQuantityLabel
        - pricingModelId
        - default
        - slug
        - prices
        - defaultPrice
        - features
      additionalProperties: false
    UsageMeterWithPricesRecord:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        name:
          description: The name of the usage meter
          type: string
          minLength: 1
          maxLength: 255
        pricingModelId:
          type: string
        slug:
          description: The slug of the usage meter
          type: string
          minLength: 1
          maxLength: 255
        aggregationType:
          description: >-
            The type of aggregation to perform on the usage meter. Defaults to
            "sum", which aggregates all the usage event amounts for the billing
            period. "count_distinct_properties" counts the number of distinct
            properties in the billing period for a given meter.
          type: string
          enum:
            - sum
            - count_distinct_properties
        prices:
          type: array
          items:
            $ref: '#/components/schemas/UsagePriceClientSelectSchema'
        defaultPrice:
          $ref: '#/components/schemas/UsagePriceClientSelectSchema'
          description: >-
            The default price for the usage meter. If no price is explicitly set
            as default, will return the first price.
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - name
        - pricingModelId
        - slug
        - aggregationType
        - prices
      additionalProperties: false
    PriceRecord:
      anyOf:
        - $ref: '#/components/schemas/SubscriptionPriceClientSelectSchema'
        - $ref: '#/components/schemas/SinglePaymentPriceClientSelectSchema'
        - $ref: '#/components/schemas/UsagePriceClientSelectSchema'
    FeatureRecord:
      oneOf:
        - $ref: '#/components/schemas/ToggleFeatureClientSelectSchema'
        - $ref: '#/components/schemas/UsageCreditGrantFeatureClientSelectSchema'
        - $ref: '#/components/schemas/ResourceFeatureClientSelectSchema'
      type: object
      discriminator:
        propertyName: type
        mapping:
          toggle:
            $ref: '#/components/schemas/ToggleFeatureClientSelectSchema'
          usage_credit_grant:
            $ref: '#/components/schemas/UsageCreditGrantFeatureClientSelectSchema'
          resource:
            $ref: '#/components/schemas/ResourceFeatureClientSelectSchema'
    UsagePriceClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        intervalUnit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        name:
          anyOf:
            - type: string
            - type: 'null'
        intervalCount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        type:
          type: string
          const: usage
        trialPeriodDays:
          description: Omitted.
          type: 'null'
        isDefault:
          description: >-
            Whether or not this price is the default price. For product prices,
            this indicates the default price for that product. For usage prices,
            this indicates the default price for that usage meter.
          type: boolean
        unitPrice:
          description: >-
            The price per unit. This should be in the smallest unit of the
            currency. For example, if the currency is USD, GBP, CAD, EUR or SGD,
            the price should be in cents.
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        usageEventsPerUnit:
          description: >-
            The number of usage events per unit. Used to determine how to map
            usage events to quantities when raising invoices for usage.
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        productId:
          type: 'null'
        active:
          type: boolean
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        slug:
          anyOf:
            - type: string
            - type: 'null'
        usageMeterId:
          description: >-
            The usage meter that uses this price. All usage events on that meter
            must be associated with a price that is also associated with that
            usage meter.
          type: string
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - intervalUnit
        - name
        - intervalCount
        - type
        - trialPeriodDays
        - isDefault
        - unitPrice
        - usageEventsPerUnit
        - productId
        - active
        - currency
        - slug
        - usageMeterId
        - pricingModelId
      additionalProperties: false
    SubscriptionPriceClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        intervalUnit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        name:
          anyOf:
            - type: string
            - type: 'null'
        intervalCount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        type:
          type: string
          const: subscription
        trialPeriodDays:
          description: >-
            The trial period in days. If the trial period is 0 or null, there
            will be no trial period.
          anyOf:
            - anyOf:
                - description: A positive integer
                  type: integer
                  exclusiveMinimum: 0
                  maximum: 9007199254740991
                - type: number
                  const: 0
            - type: 'null'
        isDefault:
          description: >-
            Whether or not this price is the default price. For product prices,
            this indicates the default price for that product. For usage prices,
            this indicates the default price for that usage meter.
          type: boolean
        unitPrice:
          description: >-
            The price per unit. This should be in the smallest unit of the
            currency. For example, if the currency is USD, GBP, CAD, EUR or SGD,
            the price should be in cents.
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        usageEventsPerUnit:
          description: Omitted.
          type: 'null'
        productId:
          description: The product this price belongs to. Required for subscription prices.
          type: string
        active:
          type: boolean
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        slug:
          anyOf:
            - type: string
            - type: 'null'
        usageMeterId:
          description: Omitted.
          type: 'null'
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - intervalUnit
        - name
        - intervalCount
        - type
        - isDefault
        - unitPrice
        - usageEventsPerUnit
        - productId
        - active
        - currency
        - slug
        - usageMeterId
        - pricingModelId
      additionalProperties: false
    SinglePaymentPriceClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        intervalUnit:
          description: Omitted.
          type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
        intervalCount:
          description: Omitted.
          type: 'null'
        type:
          type: string
          const: single_payment
        trialPeriodDays:
          description: Omitted.
          type: 'null'
        isDefault:
          description: >-
            Whether or not this price is the default price. For product prices,
            this indicates the default price for that product. For usage prices,
            this indicates the default price for that usage meter.
          type: boolean
        unitPrice:
          description: >-
            The price per unit. This should be in the smallest unit of the
            currency. For example, if the currency is USD, GBP, CAD, EUR or SGD,
            the price should be in cents.
          anyOf:
            - description: A positive integer
              type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: number
              const: 0
        usageEventsPerUnit:
          description: Omitted.
          type: 'null'
        productId:
          description: >-
            The product this price belongs to. Required for single payment
            prices.
          type: string
        active:
          type: boolean
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        slug:
          anyOf:
            - type: string
            - type: 'null'
        usageMeterId:
          description: Omitted.
          type: 'null'
        pricingModelId:
          type: string
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - name
        - type
        - isDefault
        - unitPrice
        - productId
        - active
        - currency
        - slug
        - pricingModelId
      additionalProperties: false
    ToggleFeatureClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        type:
          type: string
          const: toggle
        slug:
          type: string
          minLength: 1
          maxLength: 255
        name:
          type: string
        description:
          type: string
        amount:
          type: 'null'
          const: null
        usageMeterId:
          type: 'null'
          const: null
        renewalFrequency:
          type: 'null'
          const: null
        pricingModelId:
          type: string
        resourceId:
          type: 'null'
          const: null
        active:
          type: boolean
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - type
        - slug
        - name
        - description
        - pricingModelId
        - active
      additionalProperties: false
    UsageCreditGrantFeatureClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        type:
          type: string
          const: usage_credit_grant
        slug:
          type: string
          minLength: 1
          maxLength: 255
        name:
          type: string
        description:
          type: string
        amount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        usageMeterId:
          type: string
        renewalFrequency:
          type: string
          enum:
            - once
            - every_billing_period
        pricingModelId:
          type: string
        resourceId:
          type: 'null'
          const: null
        active:
          type: boolean
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - type
        - slug
        - name
        - description
        - amount
        - usageMeterId
        - renewalFrequency
        - pricingModelId
        - active
      additionalProperties: false
    ResourceFeatureClientSelectSchema:
      type: object
      properties:
        id:
          type: string
        createdAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        updatedAt:
          description: Epoch milliseconds.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        livemode:
          type: boolean
        organizationId:
          type: string
        type:
          type: string
          const: resource
        slug:
          type: string
          minLength: 1
          maxLength: 255
        name:
          type: string
        description:
          type: string
        amount:
          description: A positive integer
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        usageMeterId:
          type: 'null'
          const: null
        renewalFrequency:
          type: 'null'
          const: null
        pricingModelId:
          type: string
        resourceId:
          type: string
        active:
          type: boolean
      required:
        - id
        - createdAt
        - updatedAt
        - livemode
        - organizationId
        - type
        - slug
        - name
        - description
        - amount
        - pricingModelId
        - resourceId
        - active
      additionalProperties: false
    CurrencyCode:
      description: Currency code
      type: string
      enum:
        - USD
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BIF
        - BMD
        - BND
        - BOB
        - BRL
        - BSD
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHF
        - CLP
        - CNY
        - COP
        - CRC
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HTG
        - HUF
        - IDR
        - ILS
        - INR
        - ISK
        - JMD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KRW
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - MAD
        - MDL
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MUR
        - MVR
        - MWK
        - MXN
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SEK
        - SGD
        - SHP
        - SLE
        - SOS
        - SRD
        - STD
        - SZL
        - THB
        - TJS
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - UYU
        - UZS
        - VND
        - VUV
        - WST
        - XAF
        - XCD
        - XOF
        - XPF
        - YER
        - ZAR
        - ZMW
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````