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

# Restore plan instance version

> Restores a plan instance version: a new version of its plan instance, with the charges and the plan version of the restored version and the reason rollback, becomes the active version. The new version has no custom field values. The request answers the new version.

Requires the role `plan_instance_versions:write`.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/plan-instance-versions/{id}/rollback
openapi: 3.1.0
info:
  title: API Reference
  version: '1.0'
  description: Aira API Reference
  x-logo:
    url: https://static.useaira.com/images/airalogo.svg
    backgroundColor: '#FFFFFF'
    altText: Aira Logo
servers:
  - url: https://api.useaira.com
    description: API base URL
security:
  - ApiKey: []
paths:
  /v1/plan-instance-versions/{id}/rollback:
    post:
      tags:
        - Plan Instances
      summary: Restore plan instance version
      description: >-
        Restores a plan instance version: a new version of its plan instance,
        with the charges and the plan version of the restored version and the
        reason rollback, becomes the active version. The new version has no
        custom field values. The request answers the new version.


        Requires the role `plan_instance_versions:write`.
      parameters:
        - schema:
            type: string
            format: uuid
          in: path
          name: id
          required: true
          description: The unique identifier of the plan instance version in our system.
      responses:
        '200':
          description: >-
            Schema representing a plan instance version, one state of the
            charges of a plan instance. Each change of the charges creates a
            version: the active version is the one that billing uses, and a
            restore can bring back any of the others.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    description: >-
                      The unique identifier of the plan instance version in our
                      system.
                    type: string
                    format: uuid
                  planInstanceId:
                    description: >-
                      The unique identifier of the plan instance that the
                      version belongs to.
                    type: string
                    format: uuid
                  planVersionId:
                    description: >-
                      The unique identifier of the plan version that the version
                      comes from.
                    type: string
                    format: uuid
                  versionNumber:
                    description: >-
                      The number of the version in its plan instance, from 1,
                      one more for each new version.
                    type: integer
                    minimum: 1
                  isActive:
                    description: >-
                      Whether billing uses this version. A plan instance has one
                      active version.
                    type: boolean
                  planInstanceVersionReason:
                    description: >-
                      Why the version exists: created_from_plan_version (it
                      comes from a plan version of the plan),
                      duplicated_from_contract (a copy of a plan instance of
                      another contract), manual_override (an update of the
                      charges of the plan instance), readjustment (a rate
                      adjustment) or rollback (a restore of an earlier version).
                    type: string
                    enum:
                      - created_from_plan_version
                      - duplicated_from_contract
                      - manual_override
                      - readjustment
                      - rollback
                  metadata:
                    anyOf:
                      - type: object
                        description: >-
                          The details of a version that comes from a plan
                          version of the plan.
                        properties:
                          reason:
                            type: string
                            enum:
                              - created_from_plan_version
                            description: >-
                              The reason of the version:
                              created_from_plan_version.
                          sourcePlanVersionId:
                            description: >-
                              The unique identifier of the plan version that the
                              version comes from.
                            type: string
                            format: uuid
                        required:
                          - reason
                          - sourcePlanVersionId
                        additionalProperties: false
                      - type: object
                        description: >-
                          The details of a version that copies a plan instance
                          of another contract, from a duplication of that
                          contract.
                        properties:
                          reason:
                            type: string
                            enum:
                              - duplicated_from_contract
                            description: >-
                              The reason of the version:
                              duplicated_from_contract.
                          sourceContractId:
                            type: string
                            format: uuid
                            description: >-
                              The unique identifier of the contract that the
                              duplication copied.
                          sourcePlanInstanceId:
                            type: string
                            format: uuid
                            description: >-
                              The unique identifier of the plan instance that
                              the version copies.
                        required:
                          - reason
                          - sourceContractId
                          - sourcePlanInstanceId
                        additionalProperties: false
                      - type: object
                        description: >-
                          The details of a version from an update of the charges
                          of the plan instance, in the billing app or through
                          the API.
                        properties:
                          reason:
                            type: string
                            enum:
                              - manual_override
                            description: 'The reason of the version: manual_override.'
                          previousPlanInstanceVersionId:
                            type: string
                            format: uuid
                            description: >-
                              The unique identifier of the plan instance version
                              that was active before the update.
                        required:
                          - reason
                          - previousPlanInstanceVersionId
                        additionalProperties: false
                      - type: object
                        description: >-
                          The details of a version from a rate adjustment, which
                          applies a percentage to the prices of the plan
                          instance.
                        properties:
                          reason:
                            type: string
                            enum:
                              - readjustment
                            description: 'The reason of the version: readjustment.'
                          previousPlanInstanceVersionId:
                            type: string
                            format: uuid
                            description: >-
                              The unique identifier of the plan instance version
                              that was active before the rate adjustment.
                          percentage:
                            type: string
                            description: >-
                              The percentage that the rate adjustment applied to
                              the prices, as a decimal string, such as "5" for a
                              rise of 5%.
                            examples:
                              - '5'
                        required:
                          - reason
                          - previousPlanInstanceVersionId
                          - percentage
                        additionalProperties: false
                      - type: object
                        description: >-
                          The details of a version from a restore of an earlier
                          version.
                        properties:
                          reason:
                            type: string
                            enum:
                              - rollback
                            description: 'The reason of the version: rollback.'
                          rolledBackFromPlanInstanceVersionId:
                            type: string
                            format: uuid
                            description: >-
                              The unique identifier of the plan instance version
                              whose charges the restore brought back.
                        required:
                          - reason
                          - rolledBackFromPlanInstanceVersionId
                        additionalProperties: false
                      - type: 'null'
                        description: Aira recorded no details for the version.
                    description: >-
                      The details of how the version came to exist, by reason,
                      such as the plan version that it comes from, the version
                      before it or the percentage of a rate adjustment, or null
                      when Aira recorded none.
                  customFields:
                    type: object
                    description: >-
                      The custom field values that the version was created with.
                      An update of the plan instance sets them, and every other
                      way of creating a version leaves them empty.
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: array
                          items:
                            type: string
                    default: {}
                    example:
                      customField1: value1
                      customField2:
                        - value2
                        - value3
                  createdAt:
                    description: The moment when Aira created the version.
                    type: string
                    format: date-time
                  planCharges:
                    description: The plan charges of the version.
                    type: array
                    items:
                      type: object
                      description: >-
                        Schema representing a plan charge, one priced line of a
                        plan: its item names what it bills, its category says
                        what it bills from, its pricing model turns a quantity
                        into money, and its billing frequency says how often it
                        bills. The fields of a charge depend on its category. An
                        amount is an integer number of cents, and a price is a
                        decimal string with up to 6 decimal places, in BRL or in
                        the credit unit of the charge.
                      discriminator:
                        propertyName: category
                      oneOf:
                        - type: object
                          description: >-
                            A fixed charge: the same amount in every charge
                            period, billed on the invoice that its billing
                            timing names.
                          properties:
                            category:
                              type: string
                              description: 'The category of the charge: fixed.'
                              enum:
                                - fixed
                            id:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the plan charge in our
                                system.
                            position:
                              type: integer
                              minimum: 0
                              description: >-
                                The position of the charge in the plan, from 0,
                                in the order that the billing app shows.
                            itemId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the item that the
                                charge bills. The line items of the charge name
                                the same item.
                            productId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the product that the
                                charge belongs to.
                            name:
                              type: string
                              minLength: 1
                              description: The name of the charge, as the invoices show it.
                              examples:
                                - Mensalidade
                            isCustomNameEnabled:
                              type: boolean
                              description: >-
                                Whether the charge has a name of its own. When
                                false, the name of the charge is the name of its
                                resource, of its license or of its item.
                            billingFrequency:
                              type: object
                              description: >-
                                How often the charge bills: each charge period
                                of the charge lasts count units, the charge
                                counts its charge periods from the contract
                                start, and it bills each charge period once.
                                Aira accepts 1 or 2 weeks and 1, 3, 6 or 12
                                months, and a prorated charge bills every week
                                or every month.
                              properties:
                                unit:
                                  type: string
                                  enum:
                                    - month
                                    - week
                                  description: >-
                                    The unit of the billing frequency: month or
                                    week. Every charge of a plan has the same
                                    unit.
                                count:
                                  type: integer
                                  minimum: 1
                                  description: >-
                                    The number of units in each charge period of
                                    the charge.
                              required:
                                - unit
                                - count
                              additionalProperties: false
                            pricingModel:
                              type: string
                              description: The pricing model of the charge, always fixed.
                              enum:
                                - fixed
                            pricing:
                              type: object
                              description: >-
                                The price of a fixed charge or of a minimum
                                commitment.
                              properties:
                                model:
                                  description: 'The pricing model of the price: fixed.'
                                  enum:
                                    - fixed
                                amount:
                                  type: integer
                                  minimum: 0
                                  description: >-
                                    The amount that the charge bills in each
                                    charge period, in cents, or the amount of
                                    one unit when the charge has a quantity. For
                                    a minimum commitment, the least that the
                                    charges of the plan with its billing
                                    frequency bill.
                                quantity:
                                  type: integer
                                  minimum: 1
                                  description: >-
                                    The number of units that a fixed charge
                                    bills in each charge period, when it has
                                    one, so that each charge period bills
                                    quantity times amount. A minimum commitment
                                    has none.
                              required:
                                - model
                                - amount
                              additionalProperties: false
                            billingTiming:
                              type: string
                              enum:
                                - in_advance
                                - in_arrears
                              description: >-
                                When the charge bills a charge period:
                                in_arrears bills it on the closing invoice of
                                its last cycle, and in_advance bills it before
                                it starts, on the activation invoice or on the
                                closing invoice of the cycle before. The billing
                                timing moves the invoice, never the amount.
                          required:
                            - id
                            - position
                            - itemId
                            - productId
                            - name
                            - isCustomNameEnabled
                            - category
                            - pricingModel
                            - pricing
                            - billingFrequency
                            - billingTiming
                          additionalProperties: false
                        - type: object
                          description: >-
                            A minimum commitment: the least that the plan bills
                            in a charge period. When the charges of the plan
                            with the same billing frequency total less, the
                            charge bills the difference. A plan has at most one
                            for each billing frequency.
                          properties:
                            category:
                              type: string
                              description: 'The category of the charge: minimum_commitment.'
                              enum:
                                - minimum_commitment
                            id:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the plan charge in our
                                system.
                            position:
                              type: integer
                              minimum: 0
                              description: >-
                                The position of the charge in the plan, from 0,
                                in the order that the billing app shows.
                            itemId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the item that the
                                charge bills. The line items of the charge name
                                the same item.
                            productId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the product that the
                                charge belongs to.
                            name:
                              type: string
                              minLength: 1
                              description: The name of the charge, as the invoices show it.
                              examples:
                                - Mensalidade
                            isCustomNameEnabled:
                              type: boolean
                              description: >-
                                Whether the charge has a name of its own. When
                                false, the name of the charge is the name of its
                                resource, of its license or of its item.
                            billingFrequency:
                              type: object
                              description: >-
                                How often the charge bills: each charge period
                                of the charge lasts count units, the charge
                                counts its charge periods from the contract
                                start, and it bills each charge period once.
                                Aira accepts 1 or 2 weeks and 1, 3, 6 or 12
                                months, and a prorated charge bills every week
                                or every month.
                              properties:
                                unit:
                                  type: string
                                  enum:
                                    - month
                                    - week
                                  description: >-
                                    The unit of the billing frequency: month or
                                    week. Every charge of a plan has the same
                                    unit.
                                count:
                                  type: integer
                                  minimum: 1
                                  description: >-
                                    The number of units in each charge period of
                                    the charge.
                              required:
                                - unit
                                - count
                              additionalProperties: false
                            pricingModel:
                              type: string
                              description: The pricing model of the charge, always fixed.
                              enum:
                                - fixed
                            pricing:
                              type: object
                              description: >-
                                The price of a fixed charge or of a minimum
                                commitment.
                              properties:
                                model:
                                  description: 'The pricing model of the price: fixed.'
                                  enum:
                                    - fixed
                                amount:
                                  type: integer
                                  minimum: 0
                                  description: >-
                                    The amount that the charge bills in each
                                    charge period, in cents, or the amount of
                                    one unit when the charge has a quantity. For
                                    a minimum commitment, the least that the
                                    charges of the plan with its billing
                                    frequency bill.
                                quantity:
                                  type: integer
                                  minimum: 1
                                  description: >-
                                    The number of units that a fixed charge
                                    bills in each charge period, when it has
                                    one, so that each charge period bills
                                    quantity times amount. A minimum commitment
                                    has none.
                              required:
                                - model
                                - amount
                              additionalProperties: false
                          required:
                            - id
                            - position
                            - itemId
                            - productId
                            - name
                            - isCustomNameEnabled
                            - category
                            - pricingModel
                            - pricing
                            - billingFrequency
                          additionalProperties: false
                        - type: object
                          description: >-
                            A usage-based charge: a charge on the usage of a
                            resource in its charge period, priced by its pricing
                            model.
                          properties:
                            category:
                              type: string
                              description: 'The category of the charge: usage_based.'
                              enum:
                                - usage_based
                            id:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the plan charge in our
                                system.
                            position:
                              type: integer
                              minimum: 0
                              description: >-
                                The position of the charge in the plan, from 0,
                                in the order that the billing app shows.
                            itemId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the item that the
                                charge bills. The line items of the charge name
                                the same item.
                            productId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the product that the
                                charge belongs to.
                            name:
                              type: string
                              minLength: 1
                              description: The name of the charge, as the invoices show it.
                              examples:
                                - Mensalidade
                            isCustomNameEnabled:
                              type: boolean
                              description: >-
                                Whether the charge has a name of its own. When
                                false, the name of the charge is the name of its
                                resource, of its license or of its item.
                            billingFrequency:
                              type: object
                              description: >-
                                How often the charge bills: each charge period
                                of the charge lasts count units, the charge
                                counts its charge periods from the contract
                                start, and it bills each charge period once.
                                Aira accepts 1 or 2 weeks and 1, 3, 6 or 12
                                months, and a prorated charge bills every week
                                or every month.
                              properties:
                                unit:
                                  type: string
                                  enum:
                                    - month
                                    - week
                                  description: >-
                                    The unit of the billing frequency: month or
                                    week. Every charge of a plan has the same
                                    unit.
                                count:
                                  type: integer
                                  minimum: 1
                                  description: >-
                                    The number of units in each charge period of
                                    the charge.
                              required:
                                - unit
                                - count
                              additionalProperties: false
                            pricingModel:
                              type: string
                              enum:
                                - per_unit
                                - per_package
                                - percentage
                                - tiered_per_unit
                                - tiered_percentage
                                - tiered_fixed
                                - advanced
                              description: >-
                                The pricing model of the charge, the same as
                                pricing.model. per_unit, per_package and
                                tiered_per_unit price a resource in units,
                                percentage and tiered_percentage price a
                                resource in money, and tiered_fixed and advanced
                                price either.
                            pricing:
                              type: object
                              description: >-
                                The price of a usage-based or license-based
                                charge, by pricing model. Its model is the
                                pricingModel of the charge.
                              discriminator:
                                propertyName: model
                              oneOf:
                                - type: object
                                  description: >-
                                    Per unit: each unit of the charge period
                                    past the included quantity costs unitPrice.
                                    A charge on a resource in money cannot have
                                    it.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        per_unit.
                                      enum:
                                        - per_unit
                                    includedQuantity:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The number of units of each charge
                                        period that the charge does not bill,
                                        when it has one.
                                    unitPrice:
                                      type: string
                                      pattern: ^\d+(\.\d{1,6})?$
                                      description: >-
                                        The price of one unit, as a decimal
                                        string.
                                      examples:
                                        - '0.25'
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - unitPrice
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Per package: the units of the charge period
                                    past the included quantity bill packagePrice
                                    for each package of packageSize units that
                                    they start. A charge on a resource in money
                                    cannot have it.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        per_package.
                                      enum:
                                        - per_package
                                    includedQuantity:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The number of units of each charge
                                        period that the charge does not bill,
                                        when it has one.
                                    packageSize:
                                      type: integer
                                      minimum: 1
                                      description: The number of units in one package.
                                    packagePrice:
                                      type: string
                                      pattern: ^\d+(\.\d{1,6})?$
                                      description: >-
                                        The price of one package, as a decimal
                                        string.
                                      examples:
                                        - '50.00'
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - packageSize
                                    - packagePrice
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Percentage: the charge bills a percentage of
                                    the usage of its resource in the charge
                                    period. Only a charge on a resource in money
                                    has it.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        percentage.
                                      enum:
                                        - percentage
                                    percentage:
                                      type: string
                                      pattern: ^(100(\.0{1,6})?|\d{1,2}(\.\d{1,6})?)$
                                      description: >-
                                        The percentage of the usage that the
                                        charge bills, as a decimal string from 0
                                        to 100.
                                      examples:
                                        - '2.5'
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - percentage
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Tiered per unit: the tiers of the charge
                                    price its units, and each tier prices them
                                    per unit. A charge on a resource in money
                                    cannot have it.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        tiered_per_unit.
                                      enum:
                                        - tiered_per_unit
                                    tierMode:
                                      enum:
                                        - progressive
                                        - volume
                                      description: >-
                                        How the tiers price the quantity:
                                        progressive splits it across the tiers,
                                        and volume prices all of it at the tier
                                        that it reaches.
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - tierMode
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Tiered percentage: the tiers of the charge
                                    price its usage, and each tier bills a
                                    percentage of it. Only a charge on a
                                    resource in money has it.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        tiered_percentage.
                                      enum:
                                        - tiered_percentage
                                    tierMode:
                                      enum:
                                        - progressive
                                        - volume
                                      description: >-
                                        How the tiers price the quantity:
                                        progressive splits it across the tiers,
                                        and volume prices all of it at the tier
                                        that it reaches.
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - tierMode
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Tiered fixed: the tier that the whole
                                    quantity reaches bills its flat amount. When
                                    the last tier has an end, unitOverage or
                                    percentageOverage prices the quantity past
                                    it, and a charge never has both.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        tiered_fixed.
                                      enum:
                                        - tiered_fixed
                                    tierMode:
                                      enum:
                                        - progressive
                                        - volume
                                      description: >-
                                        Always volume, because the tier that the
                                        whole quantity reaches bills its flat
                                        amount.
                                    unitOverage:
                                      type: object
                                      description: >-
                                        The price of the units past the last
                                        tier, for a charge on a resource in
                                        units or on a license, when the charge
                                        has one.
                                      properties:
                                        excessUnitPrice:
                                          type: string
                                          pattern: ^\d+(\.\d{1,6})?$
                                          description: >-
                                            The price of one unit past the last
                                            tier, as a decimal string.
                                          examples:
                                            - '0.30'
                                      required:
                                        - excessUnitPrice
                                      additionalProperties: false
                                    percentageOverage:
                                      type: object
                                      description: >-
                                        The percentage of the usage past the
                                        last tier that the charge bills, for a
                                        charge on a resource in money, when the
                                        charge has one.
                                      properties:
                                        excessPercentage:
                                          type: string
                                          pattern: ^(100(\.0{1,6})?|\d{1,2}(\.\d{1,6})?)$
                                          description: >-
                                            The percentage of the usage past the
                                            last tier that the charge bills, as a
                                            decimal string from 0 to 100.
                                          examples:
                                            - '1.5'
                                      required:
                                        - excessPercentage
                                      additionalProperties: false
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - tierMode
                                  not:
                                    required:
                                      - unitOverage
                                      - percentageOverage
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Advanced: tiers of mixed types price the
                                    quantity. The tiers of a charge on a
                                    resource in units are per_unit, per_package
                                    or flat, and those of a charge on a resource
                                    in money are percentage or flat. A charge
                                    priced before the other pricing models
                                    existed has it too.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        advanced.
                                      enum:
                                        - advanced
                                    tierMode:
                                      enum:
                                        - progressive
                                        - volume
                                      description: >-
                                        How the tiers price the quantity:
                                        progressive splits it across the tiers,
                                        and volume prices all of it at the tier
                                        that it reaches.
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - tierMode
                                  additionalProperties: false
                            resourceId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the resource whose
                                usage the charge prices.
                            currencyUnit:
                              type: object
                              description: >-
                                The credit unit that the charge is priced in, or
                                null when the charge bills money. A charge
                                priced in a credit unit decreases the balance of
                                a credit pool in that unit and bills no money.
                              properties:
                                id:
                                  type: string
                                  format: uuid
                                  description: >-
                                    The unique identifier of the currency unit
                                    in our system.
                                name:
                                  type: string
                                  description: The name of the currency unit.
                                  examples:
                                    - Real
                                code:
                                  type: string
                                  description: The short code of the currency unit.
                                  examples:
                                    - BRL
                              required:
                                - id
                                - name
                                - code
                              additionalProperties: false
                              nullable: true
                            tiers:
                              type: array
                              items:
                                type: object
                                description: >-
                                  A price tier of the charge: a band of
                                  quantity, from one number to another, with its
                                  own price. The first tier starts at 0 or 1,
                                  and each tier starts at the to of the tier
                                  before it plus 1.
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                    description: >-
                                      The unique identifier of the tier in our
                                      system.
                                  position:
                                    type: integer
                                    minimum: 0
                                    description: >-
                                      The position of the tier in the charge,
                                      from 0, from the lowest band to the
                                      highest.
                                  from:
                                    type: integer
                                    minimum: 0
                                    description: >-
                                      The first quantity of the band, which the
                                      band includes: a number of units of the
                                      resource or of the license, or of cents
                                      for a resource in money.
                                  to:
                                    type: integer
                                    minimum: 0
                                    nullable: true
                                    description: >-
                                      The last quantity of the band, which the
                                      band includes, in the unit of from, or
                                      null when the band has no end. The last
                                      tier has an end only on a charge with the
                                      pricing model tiered_fixed and an overage.
                                  pricing:
                                    type: object
                                    description: >-
                                      The price of the quantity that falls in
                                      the tier, by type: per_unit, percentage,
                                      per_package or flat.
                                    discriminator:
                                      propertyName: type
                                    oneOf:
                                      - type: object
                                        description: >-
                                          Per unit: each unit in the tier costs
                                          unitPrice. A charge on a resource in
                                          money cannot have it.
                                        properties:
                                          type:
                                            description: 'The type of the tier price: per_unit.'
                                            enum:
                                              - per_unit
                                          unitPrice:
                                            type: string
                                            pattern: ^\d+(\.\d{1,6})?$
                                            description: >-
                                              The price of one unit in the tier, as a
                                              decimal string.
                                            examples:
                                              - '0.20'
                                          fixedPrice:
                                            type: string
                                            pattern: ^\d+(\.\d{1,6})?$
                                            nullable: true
                                            description: >-
                                              An amount that the tier bills on top of
                                              its units when the tier applies, as a
                                              decimal string, or null when it has
                                              none. Only a tier of a charge with the
                                              pricing model tiered_per_unit has an
                                              amount other than zero.
                                            examples:
                                              - '10.00'
                                        required:
                                          - type
                                          - unitPrice
                                          - fixedPrice
                                        additionalProperties: false
                                      - type: object
                                        description: >-
                                          Percentage: the tier bills a percentage
                                          of the usage that falls in it. Only a
                                          charge on a resource in money has it.
                                        properties:
                                          type:
                                            description: 'The type of the tier price: percentage.'
                                            enum:
                                              - percentage
                                          percentage:
                                            type: string
                                            pattern: ^(100(\.0{1,6})?|\d{1,2}(\.\d{1,6})?)$
                                            description: >-
                                              The percentage of the usage in the tier
                                              that the tier bills, as a decimal string
                                              from 0 to 100.
                                            examples:
                                              - '1.5'
                                        required:
                                          - type
                                          - percentage
                                        additionalProperties: false
                                      - type: object
                                        description: >-
                                          Per package: the units in the tier bill
                                          packagePrice for each package of
                                          packageSize units that they start. A
                                          charge on a resource in money cannot
                                          have it.
                                        properties:
                                          type:
                                            description: 'The type of the tier price: per_package.'
                                            enum:
                                              - per_package
                                          packageSize:
                                            type: integer
                                            minimum: 1
                                            description: The number of units in one package.
                                          packagePrice:
                                            type: string
                                            pattern: ^\d+(\.\d{1,6})?$
                                            description: >-
                                              The price of one package, as a decimal
                                              string.
                                            examples:
                                              - '45.00'
                                        required:
                                          - type
                                          - packageSize
                                          - packagePrice
                                        additionalProperties: false
                                      - type: object
                                        description: >-
                                          Flat: the tier bills one amount,
                                          whatever the quantity that falls in it.
                                        properties:
                                          type:
                                            description: 'The type of the tier price: flat.'
                                            enum:
                                              - flat
                                          amount:
                                            type: string
                                            pattern: ^\d+(\.\d{1,6})?$
                                            description: >-
                                              The amount that the tier bills, as a
                                              decimal string.
                                            examples:
                                              - '199.90'
                                        required:
                                          - type
                                          - amount
                                        additionalProperties: false
                                required:
                                  - id
                                  - position
                                  - from
                                  - to
                                  - pricing
                                additionalProperties: false
                              description: >-
                                The price tiers of the charge, from the lowest
                                band to the highest, for the pricing models
                                tiered_per_unit, tiered_percentage, tiered_fixed
                                and advanced, or an empty list for the other
                                pricing models.
                          required:
                            - id
                            - position
                            - itemId
                            - productId
                            - name
                            - isCustomNameEnabled
                            - category
                            - pricingModel
                            - pricing
                            - billingFrequency
                            - resourceId
                            - currencyUnit
                            - tiers
                          additionalProperties: false
                        - type: object
                          description: >-
                            A license-based charge: a charge on the balance of a
                            license in its charge period, read by its billing
                            model and priced by its pricing model.
                          properties:
                            category:
                              type: string
                              description: 'The category of the charge: license_based.'
                              enum:
                                - license_based
                            id:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the plan charge in our
                                system.
                            position:
                              type: integer
                              minimum: 0
                              description: >-
                                The position of the charge in the plan, from 0,
                                in the order that the billing app shows.
                            itemId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the item that the
                                charge bills. The line items of the charge name
                                the same item.
                            productId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the product that the
                                charge belongs to.
                            name:
                              type: string
                              minLength: 1
                              description: The name of the charge, as the invoices show it.
                              examples:
                                - Mensalidade
                            isCustomNameEnabled:
                              type: boolean
                              description: >-
                                Whether the charge has a name of its own. When
                                false, the name of the charge is the name of its
                                resource, of its license or of its item.
                            billingFrequency:
                              type: object
                              description: >-
                                How often the charge bills: each charge period
                                of the charge lasts count units, the charge
                                counts its charge periods from the contract
                                start, and it bills each charge period once.
                                Aira accepts 1 or 2 weeks and 1, 3, 6 or 12
                                months, and a prorated charge bills every week
                                or every month.
                              properties:
                                unit:
                                  type: string
                                  enum:
                                    - month
                                    - week
                                  description: >-
                                    The unit of the billing frequency: month or
                                    week. Every charge of a plan has the same
                                    unit.
                                count:
                                  type: integer
                                  minimum: 1
                                  description: >-
                                    The number of units in each charge period of
                                    the charge.
                              required:
                                - unit
                                - count
                              additionalProperties: false
                            pricingModel:
                              type: string
                              enum:
                                - per_unit
                                - per_package
                                - tiered_per_unit
                                - tiered_fixed
                              description: >-
                                The pricing model of the charge, the same as
                                pricing.model: per_unit, per_package,
                                tiered_per_unit or tiered_fixed. No percentage
                                applies, because the balance of a license is a
                                count, not an amount of money.
                            pricing:
                              type: object
                              description: >-
                                The price of a usage-based or license-based
                                charge, by pricing model. Its model is the
                                pricingModel of the charge.
                              discriminator:
                                propertyName: model
                              oneOf:
                                - type: object
                                  description: >-
                                    Per unit: each unit of the charge period
                                    past the included quantity costs unitPrice.
                                    A charge on a resource in money cannot have
                                    it.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        per_unit.
                                      enum:
                                        - per_unit
                                    includedQuantity:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The number of units of each charge
                                        period that the charge does not bill,
                                        when it has one.
                                    unitPrice:
                                      type: string
                                      pattern: ^\d+(\.\d{1,6})?$
                                      description: >-
                                        The price of one unit, as a decimal
                                        string.
                                      examples:
                                        - '0.25'
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - unitPrice
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Per package: the units of the charge period
                                    past the included quantity bill packagePrice
                                    for each package of packageSize units that
                                    they start. A charge on a resource in money
                                    cannot have it.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        per_package.
                                      enum:
                                        - per_package
                                    includedQuantity:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The number of units of each charge
                                        period that the charge does not bill,
                                        when it has one.
                                    packageSize:
                                      type: integer
                                      minimum: 1
                                      description: The number of units in one package.
                                    packagePrice:
                                      type: string
                                      pattern: ^\d+(\.\d{1,6})?$
                                      description: >-
                                        The price of one package, as a decimal
                                        string.
                                      examples:
                                        - '50.00'
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - packageSize
                                    - packagePrice
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Percentage: the charge bills a percentage of
                                    the usage of its resource in the charge
                                    period. Only a charge on a resource in money
                                    has it.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        percentage.
                                      enum:
                                        - percentage
                                    percentage:
                                      type: string
                                      pattern: ^(100(\.0{1,6})?|\d{1,2}(\.\d{1,6})?)$
                                      description: >-
                                        The percentage of the usage that the
                                        charge bills, as a decimal string from 0
                                        to 100.
                                      examples:
                                        - '2.5'
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - percentage
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Tiered per unit: the tiers of the charge
                                    price its units, and each tier prices them
                                    per unit. A charge on a resource in money
                                    cannot have it.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        tiered_per_unit.
                                      enum:
                                        - tiered_per_unit
                                    tierMode:
                                      enum:
                                        - progressive
                                        - volume
                                      description: >-
                                        How the tiers price the quantity:
                                        progressive splits it across the tiers,
                                        and volume prices all of it at the tier
                                        that it reaches.
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - tierMode
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Tiered percentage: the tiers of the charge
                                    price its usage, and each tier bills a
                                    percentage of it. Only a charge on a
                                    resource in money has it.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        tiered_percentage.
                                      enum:
                                        - tiered_percentage
                                    tierMode:
                                      enum:
                                        - progressive
                                        - volume
                                      description: >-
                                        How the tiers price the quantity:
                                        progressive splits it across the tiers,
                                        and volume prices all of it at the tier
                                        that it reaches.
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - tierMode
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Tiered fixed: the tier that the whole
                                    quantity reaches bills its flat amount. When
                                    the last tier has an end, unitOverage or
                                    percentageOverage prices the quantity past
                                    it, and a charge never has both.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        tiered_fixed.
                                      enum:
                                        - tiered_fixed
                                    tierMode:
                                      enum:
                                        - progressive
                                        - volume
                                      description: >-
                                        Always volume, because the tier that the
                                        whole quantity reaches bills its flat
                                        amount.
                                    unitOverage:
                                      type: object
                                      description: >-
                                        The price of the units past the last
                                        tier, for a charge on a resource in
                                        units or on a license, when the charge
                                        has one.
                                      properties:
                                        excessUnitPrice:
                                          type: string
                                          pattern: ^\d+(\.\d{1,6})?$
                                          description: >-
                                            The price of one unit past the last
                                            tier, as a decimal string.
                                          examples:
                                            - '0.30'
                                      required:
                                        - excessUnitPrice
                                      additionalProperties: false
                                    percentageOverage:
                                      type: object
                                      description: >-
                                        The percentage of the usage past the
                                        last tier that the charge bills, for a
                                        charge on a resource in money, when the
                                        charge has one.
                                      properties:
                                        excessPercentage:
                                          type: string
                                          pattern: ^(100(\.0{1,6})?|\d{1,2}(\.\d{1,6})?)$
                                          description: >-
                                            The percentage of the usage past the
                                            last tier that the charge bills, as a
                                            decimal string from 0 to 100.
                                          examples:
                                            - '1.5'
                                      required:
                                        - excessPercentage
                                      additionalProperties: false
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - tierMode
                                  not:
                                    required:
                                      - unitOverage
                                      - percentageOverage
                                  additionalProperties: false
                                - type: object
                                  description: >-
                                    Advanced: tiers of mixed types price the
                                    quantity. The tiers of a charge on a
                                    resource in units are per_unit, per_package
                                    or flat, and those of a charge on a resource
                                    in money are percentage or flat. A charge
                                    priced before the other pricing models
                                    existed has it too.
                                  properties:
                                    model:
                                      description: >-
                                        The pricing model of the price:
                                        advanced.
                                      enum:
                                        - advanced
                                    tierMode:
                                      enum:
                                        - progressive
                                        - volume
                                      description: >-
                                        How the tiers price the quantity:
                                        progressive splits it across the tiers,
                                        and volume prices all of it at the tier
                                        that it reaches.
                                    fixedAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        An amount that the charge adds in each
                                        charge period on top of its priced
                                        quantity, in cents, when it has one.
                                    minimumAmount:
                                      type: integer
                                      minimum: 0
                                      description: >-
                                        The least that the charge bills in a
                                        charge period, in cents, when it has
                                        one: when the priced quantity plus
                                        fixedAmount comes to less, the charge
                                        bills this amount.
                                  required:
                                    - model
                                    - tierMode
                                  additionalProperties: false
                            licenseId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the license whose
                                balance the charge bills.
                            billingModel:
                              type: string
                              enum:
                                - in_full
                                - proration
                              description: >-
                                How the charge reads the balance of its license
                                in a charge period: in_full bills the last
                                balance, and proration weighs each balance by
                                the days that it was in effect.
                            tiers:
                              type: array
                              items:
                                type: object
                                description: >-
                                  A price tier of the charge: a band of
                                  quantity, from one number to another, with its
                                  own price. The first tier starts at 0 or 1,
                                  and each tier starts at the to of the tier
                                  before it plus 1.
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                    description: >-
                                      The unique identifier of the tier in our
                                      system.
                                  position:
                                    type: integer
                                    minimum: 0
                                    description: >-
                                      The position of the tier in the charge,
                                      from 0, from the lowest band to the
                                      highest.
                                  from:
                                    type: integer
                                    minimum: 0
                                    description: >-
                                      The first quantity of the band, which the
                                      band includes: a number of units of the
                                      resource or of the license, or of cents
                                      for a resource in money.
                                  to:
                                    type: integer
                                    minimum: 0
                                    nullable: true
                                    description: >-
                                      The last quantity of the band, which the
                                      band includes, in the unit of from, or
                                      null when the band has no end. The last
                                      tier has an end only on a charge with the
                                      pricing model tiered_fixed and an overage.
                                  pricing:
                                    type: object
                                    description: >-
                                      The price of the quantity that falls in
                                      the tier, by type: per_unit, percentage,
                                      per_package or flat.
                                    discriminator:
                                      propertyName: type
                                    oneOf:
                                      - type: object
                                        description: >-
                                          Per unit: each unit in the tier costs
                                          unitPrice. A charge on a resource in
                                          money cannot have it.
                                        properties:
                                          type:
                                            description: 'The type of the tier price: per_unit.'
                                            enum:
                                              - per_unit
                                          unitPrice:
                                            type: string
                                            pattern: ^\d+(\.\d{1,6})?$
                                            description: >-
                                              The price of one unit in the tier, as a
                                              decimal string.
                                            examples:
                                              - '0.20'
                                          fixedPrice:
                                            type: string
                                            pattern: ^\d+(\.\d{1,6})?$
                                            nullable: true
                                            description: >-
                                              An amount that the tier bills on top of
                                              its units when the tier applies, as a
                                              decimal string, or null when it has
                                              none. Only a tier of a charge with the
                                              pricing model tiered_per_unit has an
                                              amount other than zero.
                                            examples:
                                              - '10.00'
                                        required:
                                          - type
                                          - unitPrice
                                          - fixedPrice
                                        additionalProperties: false
                                      - type: object
                                        description: >-
                                          Percentage: the tier bills a percentage
                                          of the usage that falls in it. Only a
                                          charge on a resource in money has it.
                                        properties:
                                          type:
                                            description: 'The type of the tier price: percentage.'
                                            enum:
                                              - percentage
                                          percentage:
                                            type: string
                                            pattern: ^(100(\.0{1,6})?|\d{1,2}(\.\d{1,6})?)$
                                            description: >-
                                              The percentage of the usage in the tier
                                              that the tier bills, as a decimal string
                                              from 0 to 100.
                                            examples:
                                              - '1.5'
                                        required:
                                          - type
                                          - percentage
                                        additionalProperties: false
                                      - type: object
                                        description: >-
                                          Per package: the units in the tier bill
                                          packagePrice for each package of
                                          packageSize units that they start. A
                                          charge on a resource in money cannot
                                          have it.
                                        properties:
                                          type:
                                            description: 'The type of the tier price: per_package.'
                                            enum:
                                              - per_package
                                          packageSize:
                                            type: integer
                                            minimum: 1
                                            description: The number of units in one package.
                                          packagePrice:
                                            type: string
                                            pattern: ^\d+(\.\d{1,6})?$
                                            description: >-
                                              The price of one package, as a decimal
                                              string.
                                            examples:
                                              - '45.00'
                                        required:
                                          - type
                                          - packageSize
                                          - packagePrice
                                        additionalProperties: false
                                      - type: object
                                        description: >-
                                          Flat: the tier bills one amount,
                                          whatever the quantity that falls in it.
                                        properties:
                                          type:
                                            description: 'The type of the tier price: flat.'
                                            enum:
                                              - flat
                                          amount:
                                            type: string
                                            pattern: ^\d+(\.\d{1,6})?$
                                            description: >-
                                              The amount that the tier bills, as a
                                              decimal string.
                                            examples:
                                              - '199.90'
                                        required:
                                          - type
                                          - amount
                                        additionalProperties: false
                                required:
                                  - id
                                  - position
                                  - from
                                  - to
                                  - pricing
                                additionalProperties: false
                              description: >-
                                The price tiers of the charge, from the lowest
                                band to the highest, for the pricing models
                                tiered_per_unit and tiered_fixed, or an empty
                                list for the other pricing models.
                          required:
                            - id
                            - position
                            - itemId
                            - productId
                            - name
                            - isCustomNameEnabled
                            - category
                            - pricingModel
                            - pricing
                            - billingFrequency
                            - licenseId
                            - billingModel
                            - tiers
                          additionalProperties: false
                        - type: object
                          description: >-
                            A custom plan charge: a charge whose price comes
                            from code that Aira writes for the tenant, from the
                            custom charge definition that the charge follows and
                            from the parameter values of the charge. It bills in
                            arrears, in money.
                          properties:
                            category:
                              type: string
                              description: 'The category of the charge: custom.'
                              enum:
                                - custom
                            id:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the plan charge in our
                                system.
                            position:
                              type: integer
                              minimum: 0
                              description: >-
                                The position of the charge in the plan, from 0,
                                in the order that the billing app shows.
                            itemId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the item that the
                                charge bills. The line items of the charge name
                                the same item.
                            productId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the product that the
                                charge belongs to.
                            name:
                              type: string
                              minLength: 1
                              description: The name of the charge, as the invoices show it.
                              examples:
                                - Mensalidade
                            isCustomNameEnabled:
                              type: boolean
                              description: >-
                                Whether the charge has a name of its own. When
                                false, the name of the charge is the name of its
                                resource, of its license or of its item.
                            billingFrequency:
                              type: object
                              description: >-
                                How often the charge bills: each charge period
                                of the charge lasts count units, the charge
                                counts its charge periods from the contract
                                start, and it bills each charge period once.
                                Aira accepts 1 or 2 weeks and 1, 3, 6 or 12
                                months, and a prorated charge bills every week
                                or every month.
                              properties:
                                unit:
                                  type: string
                                  enum:
                                    - month
                                    - week
                                  description: >-
                                    The unit of the billing frequency: month or
                                    week. Every charge of a plan has the same
                                    unit.
                                count:
                                  type: integer
                                  minimum: 1
                                  description: >-
                                    The number of units in each charge period of
                                    the charge.
                              required:
                                - unit
                                - count
                              additionalProperties: false
                            pricingModel:
                              type: string
                              description: The pricing model of the charge, always custom.
                              enum:
                                - custom
                            pricing:
                              type: object
                              description: >-
                                The price of a custom plan charge: the parameter
                                values that the code that Aira writes for the
                                tenant turns into an amount.
                              properties:
                                model:
                                  description: 'The pricing model of the price: custom.'
                                  enum:
                                    - custom
                                parameters:
                                  type: object
                                  additionalProperties: true
                                  description: >-
                                    The parameter values of the charge, by the
                                    keys of the parameter schema of its custom
                                    charge definition.
                              required:
                                - model
                                - parameters
                              additionalProperties: false
                            customChargeDefinitionId:
                              type: string
                              format: uuid
                              description: >-
                                The unique identifier of the custom charge
                                definition that the charge follows.
                            chosenResourceIds:
                              type: array
                              items:
                                type: string
                                format: uuid
                              description: >-
                                The unique identifiers of the resources that the
                                charge chose as its inputs, from the input
                                resources of its custom charge definition.
                            chosenLicenseIds:
                              type: array
                              items:
                                type: string
                                format: uuid
                              description: >-
                                The unique identifiers of the licenses that the
                                charge chose as its inputs, from the input
                                licenses of its custom charge definition.
                          required:
                            - id
                            - position
                            - itemId
                            - productId
                            - name
                            - isCustomNameEnabled
                            - category
                            - pricingModel
                            - pricing
                            - billingFrequency
                            - customChargeDefinitionId
                            - chosenResourceIds
                            - chosenLicenseIds
                          additionalProperties: false
                required:
                  - id
                  - planInstanceId
                  - planVersionId
                  - versionNumber
                  - isActive
                  - planInstanceVersionReason
                  - metadata
                  - customFields
                  - createdAt
                  - planCharges
                additionalProperties: false
        '400':
          description: >-
            The request cannot succeed as sent.


            - `json_schema_validation_error`: a path parameter breaks the schema
            of the endpoint.

            - `mixed_billing_frequency_family`: the billing frequencies of the
            plan charges of the restored version are in weeks and the billing
            schedule of the contract of the plan instance repeats every month,
            or the reverse.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - json_schema_validation_error
                      - mixed_billing_frequency_family
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                json_schema_validation_error:
                  value:
                    message: '''id'' must match format "uuid"'
                    code: json_schema_validation_error
                mixed_billing_frequency_family:
                  value:
                    message: >-
                      the billing frequencies of the plan charges of the
                      restored version are in weeks and the billing schedule of
                      the contract of the plan instance repeats every month, or
                      the reverse
                    code: mixed_billing_frequency_family
        '401':
          description: >-
            The request carries no API key.


            - `no_authorization`: the request carries no API key in the
            `X-API-KEY` header.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - no_authorization
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                no_authorization:
                  value:
                    message: No authorization provided
                    code: no_authorization
        '403':
          description: >-
            The API key cannot call the endpoint.


            - `bad_auth`: the API key does not hold the role that the endpoint
            requires.

            - `invalid_api_key`: the API key does not exist.

            - `deactivated_api_key`: the API key is deactivated.

            - `revoked_api_key`: the API key is revoked.

            - `expired_api_key`: the API key is past its expiry date.

            - `ip_not_allowed`: the tenant does not allow the IP of the request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - bad_auth
                      - invalid_api_key
                      - deactivated_api_key
                      - revoked_api_key
                      - expired_api_key
                      - ip_not_allowed
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                bad_auth:
                  value:
                    message: role plan_instance_versions:write can not be satisfied
                    code: bad_auth
                invalid_api_key:
                  value:
                    message: Invalid API key
                    code: invalid_api_key
                deactivated_api_key:
                  value:
                    message: Deactivated API key
                    code: deactivated_api_key
                revoked_api_key:
                  value:
                    message: Revoked API key
                    code: revoked_api_key
                expired_api_key:
                  value:
                    message: Expired API key
                    code: expired_api_key
                ip_not_allowed:
                  value:
                    message: IP not allowed
                    code: ip_not_allowed
        '404':
          description: >-
            A record that the request names does not exist in the tenant.


            - `plan_instance_version_not_found`: no plan instance version of the
            tenant has the `id`.

            - `plan_instance_not_found`: the plan instance of the plan instance
            version was deleted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      A sentence for a person that says what failed. It can
                      change, so a system compares the code instead.
                  code:
                    type: string
                    description: >-
                      The identifier of the error, which a system compares to
                      decide what to do. It never changes.
                    enum:
                      - plan_instance_version_not_found
                      - plan_instance_not_found
                  details:
                    oneOf:
                      - type: object
                        additionalProperties: true
                      - type: array
                    description: >-
                      The data of the error, when it has any, such as the fields
                      that failed the validation.
                  causations:
                    type: array
                    description: >-
                      The errors that caused this one, when several did, each
                      with its own message, code and details.
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                          description: A sentence for a person that says what failed.
                        code:
                          type: string
                          description: The identifier of the error.
                        details:
                          type: object
                          additionalProperties: true
                          description: The data of the error, when it has any.
                      required:
                        - message
                        - code
                      additionalProperties: false
                required:
                  - message
                  - code
                additionalProperties: false
              examples:
                plan_instance_version_not_found:
                  value:
                    message: plan instance version not found
                    code: plan_instance_version_not_found
                plan_instance_not_found:
                  value:
                    message: plan instance not found
                    code: plan_instance_not_found
components:
  securitySchemes:
    ApiKey:
      type: apiKey
      description: API Key Authentication.
      name: X-API-KEY
      in: header

````

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