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

# Create subscription

> Create a new subscription for a customer with a specific plan.



## OpenAPI

````yaml https://api.meteroid.com/api-docs/openapi.json post /api/v1/subscriptions
openapi: 3.1.0
info:
  title: meteroid
  description: ''
  license:
    name: LicenseRef-Proprietary
    identifier: LicenseRef-Proprietary
  version: 0.1.0
servers: []
security: []
tags:
  - name: Meteroid
    description: Meteroid API
  - name: Add-ons
  - name: Batch Jobs
  - name: Checkout Sessions
  - name: Connect
    description: Manage connected accounts (Express & Standard)
  - name: Coupons
  - name: Credit Notes
  - name: Customers
  - name: Entitlements
  - name: Events
  - name: Features
  - name: Invoices
  - name: Metrics
  - name: OAuth
    description: OAuth 2.0 token endpoints (public, client-credentials auth)
  - name: OAuth Apps
    description: Manage OAuth applications for Connect integrations
  - name: Plans
  - name: Product Families
  - name: Products
  - name: Subscriptions
  - name: Usage
paths:
  /api/v1/subscriptions:
    post:
      tags:
        - Subscriptions
      summary: Create subscription
      description: Create a new subscription for a customer with a specific plan.
      operationId: create_subscription
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionCreateRequest'
        required: true
      responses:
        '201':
          description: Subscription successfully created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionDetails'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
      security:
        - bearer_auth: []
components:
  schemas:
    SubscriptionCreateRequest:
      type: object
      required:
        - plan_id
        - customer_id_or_alias
        - start_date
        - activation_condition
      properties:
        activation_condition:
          $ref: '#/components/schemas/SubscriptionActivationConditionEnum'
        add_ons:
          type: array
          items:
            $ref: '#/components/schemas/CreateSubscriptionAddOn'
        auto_advance_invoices:
          type: boolean
        billing_day_anchor:
          type:
            - integer
            - 'null'
          format: int32
          maximum: 32767
          minimum: 1
        charge_automatically:
          type: boolean
        coupon_codes:
          type: array
          items:
            type: string
        customer_id_or_alias:
          type: string
          format: CustomerId or customer alias
        end_date:
          type: string
          format: date
          examples:
            - '2025-11-01'
        invoice_memo:
          type: string
        net_terms:
          type: integer
          format: int32
          minimum: 0
        payment_methods_config:
          $ref: '#/components/schemas/PaymentMethodsConfig'
          description: >-
            Payment methods configuration. If not specified, inherits from the
            invoicing entity.
        plan_id:
          $ref: '#/components/schemas/PlanId'
        price_components:
          $ref: '#/components/schemas/CreateSubscriptionComponents'
        purchase_order:
          type:
            - string
            - 'null'
        skip_past_invoices:
          type: boolean
          description: >-
            Migration mode: when true with a past start_date, skip creating
            invoices for past cycles.

            The subscription will be set to the current billing period with
            correct cycle_index.
        start_date:
          type: string
          format: date
          examples:
            - '2024-11-01'
        trial_days:
          type: integer
          format: int32
          minimum: 0
        version:
          type: integer
          format: int32
    SubscriptionDetails:
      type: object
      required:
        - id
        - customer_id
        - customer_name
        - billing_day_anchor
        - currency
        - plan_id
        - plan_name
        - plan_version_id
        - plan_version
        - status
        - start_date
        - current_period_start
        - net_terms
        - mrr_cents
        - period
        - created_at
        - auto_advance_invoices
        - charge_automatically
        - components
        - add_ons
        - applied_coupons
      properties:
        activated_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When the subscription was activated (first payment or activation
            condition met)
        add_ons:
          type: array
          items:
            $ref: '#/components/schemas/SubscriptionAddOn'
        applied_coupons:
          type: array
          items:
            $ref: '#/components/schemas/AppliedCouponDetailed'
        auto_advance_invoices:
          type: boolean
        billing_day_anchor:
          type: integer
          format: int32
        billing_start_date:
          type:
            - string
            - 'null'
          format: date
          description: When billing started (after any trial period)
        charge_automatically:
          type: boolean
        checkout_url:
          type:
            - string
            - 'null'
        components:
          type: array
          items:
            $ref: '#/components/schemas/SubscriptionComponent'
        created_at:
          type: string
          format: date-time
          description: When the subscription was created
        currency:
          $ref: '#/components/schemas/Currency'
        current_period_end:
          type:
            - string
            - 'null'
          format: date
          description: Current billing period end date
        current_period_start:
          type: string
          format: date
          description: Current billing period start date
        customer_alias:
          type:
            - string
            - 'null'
        customer_id:
          $ref: '#/components/schemas/CustomerId'
        customer_name:
          type: string
        end_date:
          type:
            - string
            - 'null'
          format: date
          description: When the subscription ends (if set)
        entitlements:
          type: array
          items:
            $ref: '#/components/schemas/Entitlement'
        id:
          $ref: '#/components/schemas/SubscriptionId'
        invoice_memo:
          type:
            - string
            - 'null'
          description: Default memo for invoices
        minimum_commitment:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/MinimumCommitment'
              description: >-
                Materialized minimum-commitment floor on this subscription (plan
                snapshot or operator

                override). Read-only here — set it at creation, or change it via
                a subscription amendment.
        mrr_cents:
          type: integer
          format: int64
          description: Monthly recurring revenue in cents
          minimum: 0
        net_terms:
          type: integer
          format: int32
          description: Payment terms in days (0 = due on issue)
          minimum: 0
        payment_methods_config:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PaymentMethodsConfig'
        period:
          $ref: '#/components/schemas/BillingPeriodEnum'
          description: Billing period (monthly, annual, etc.)
        plan_id:
          $ref: '#/components/schemas/PlanId'
        plan_name:
          type: string
        plan_version:
          type: integer
          format: int32
          minimum: 0
        plan_version_id:
          $ref: '#/components/schemas/PlanVersionId'
        purchase_order:
          type:
            - string
            - 'null'
        start_date:
          type: string
          format: date
          description: >-
            When the subscription contract starts (benefits apply from this
            date)
        status:
          $ref: '#/components/schemas/SubscriptionStatusEnum'
        trial_duration:
          type:
            - integer
            - 'null'
          format: int32
          description: Trial duration in days
          minimum: 0
    RestErrorResponse:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
    SubscriptionActivationConditionEnum:
      type: string
      enum:
        - ON_START
        - ON_CHECKOUT
        - MANUAL
    CreateSubscriptionAddOn:
      type: object
      required:
        - add_on_id
      properties:
        add_on_id:
          $ref: '#/components/schemas/AddOnId'
        customization:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SubscriptionAddOnCustomization'
        quantity:
          type: integer
          format: int32
          minimum: 0
    PaymentMethodsConfig:
      oneOf:
        - $ref: '#/components/schemas/OnlinePaymentMethodConfig'
        - $ref: '#/components/schemas/BankTransferPaymentMethodConfig'
        - $ref: '#/components/schemas/ExternalPaymentMethodConfig'
      description: Online (card/direct debit), BankTransfer, or External.
      discriminator:
        propertyName: type
        mapping:
          bank_transfer:
            $ref: '#/components/schemas/BankTransferPaymentMethodConfig'
          external:
            $ref: '#/components/schemas/ExternalPaymentMethodConfig'
          online:
            $ref: '#/components/schemas/OnlinePaymentMethodConfig'
    PlanId:
      type: string
      format: MeteroidId
      examples:
        - plan_7n42DGM5Tflk9n8mt7Fhc7
    CreateSubscriptionComponents:
      type: object
      properties:
        extra_components:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ExtraComponent'
        overridden_components:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ComponentOverride'
        parameterized_components:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ComponentParameterization'
        remove_components:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/PriceComponentId'
    SubscriptionAddOn:
      type: object
      required:
        - name
        - period
        - fee
        - quantity
      properties:
        add_on_id:
          $ref: '#/components/schemas/AddOnId'
        fee:
          $ref: '#/components/schemas/SubscriptionFee'
        id:
          $ref: '#/components/schemas/SubscriptionAddOnId'
        name:
          type: string
        period:
          $ref: '#/components/schemas/SubscriptionFeeBillingPeriodEnum'
        quantity:
          type: integer
          format: int32
          minimum: 0
    AppliedCouponDetailed:
      type: object
      required:
        - coupon
        - applied_coupon
      properties:
        applied_coupon:
          $ref: '#/components/schemas/AppliedCoupon'
        coupon:
          $ref: '#/components/schemas/Coupon'
    SubscriptionComponent:
      type: object
      required:
        - name
        - period
        - fee
      properties:
        fee:
          $ref: '#/components/schemas/SubscriptionFee'
        name:
          type: string
        period:
          $ref: '#/components/schemas/SubscriptionFeeBillingPeriodEnum'
        price_component_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PriceComponentId'
        product_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/ProductId'
    Currency:
      type: string
      enum:
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BRL
        - BSD
        - BTN
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHF
        - CLP
        - CNH
        - CNY
        - COP
        - CRC
        - CUC
        - CUP
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ERN
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GHS
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HRK
        - HTG
        - HUF
        - IDR
        - ILS
        - INR
        - IQD
        - IRR
        - ISK
        - JMD
        - JOD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KPW
        - KRW
        - KWD
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - LYD
        - MAD
        - MDL
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MRU
        - MUR
        - MVR
        - MWK
        - MXN
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - OMR
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SDG
        - SEK
        - SGD
        - SHP
        - SLL
        - SOS
        - SRD
        - SSP
        - STD
        - STN
        - SVC
        - SYP
        - SZL
        - THB
        - TJS
        - TMT
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - UYU
        - UZS
        - VES
        - VND
        - VUV
        - WST
        - XAF
        - XCD
        - XOF
        - XPF
        - YER
        - ZAR
        - ZMW
        - ZWL
      examples:
        - EUR
    CustomerId:
      type: string
      format: MeteroidId
      examples:
        - cus_7n42DGM5Tflk9n8mt7Fhc7
    Entitlement:
      type: object
      description: >-
        A raw entitlement row attached to one entity (feature, plan version,
        add-on, or subscription).
      required:
        - id
        - feature_id
        - value
        - created_at
        - updated_at
      properties:
        created_at:
          type: string
          format: date-time
        feature_id:
          $ref: '#/components/schemas/FeatureId'
        id:
          $ref: '#/components/schemas/EntitlementId'
        updated_at:
          type: string
          format: date-time
        value:
          $ref: '#/components/schemas/EntitlementValue'
    SubscriptionId:
      type: string
      format: MeteroidId
      examples:
        - sub_7n42DGM5Tflk9n8mt7Fhc7
    MinimumCommitment:
      type: object
      required:
        - amount
        - scope
      properties:
        amount:
          type: string
          description: Decimal string in the plan currency, e.g. "100.00".
        scope:
          $ref: '#/components/schemas/MinimumCommitmentScope'
    BillingPeriodEnum:
      type: string
      enum:
        - MONTHLY
        - QUARTERLY
        - SEMIANNUAL
        - ANNUAL
    PlanVersionId:
      type: string
      format: MeteroidId
      examples:
        - plv_7n42DGM5Tflk9n8mt7Fhc7
    SubscriptionStatusEnum:
      type: string
      title: SubscriptionStatus
      enum:
        - PENDING_ACTIVATION
        - PENDING_CHARGE
        - TRIAL_ACTIVE
        - ACTIVE
        - TRIAL_EXPIRED
        - PAUSED
        - SUSPENDED
        - CANCELLED
        - COMPLETED
        - SUPERSEDED
        - ERRORED
    ErrorCode:
      type: string
      enum:
        - BAD_REQUEST
        - NOT_FOUND
        - CONFLICT
        - FORBIDDEN
        - UNAUTHORIZED
        - TOO_MANY_REQUESTS
        - INTERNAL_SERVER_ERROR
    AddOnId:
      type: string
      format: MeteroidId
      examples:
        - add_7n42DGM5Tflk9n8mt7Fhc7
    SubscriptionAddOnCustomization:
      oneOf:
        - $ref: '#/components/schemas/SubscriptionAddOnPriceOverride'
        - $ref: '#/components/schemas/SubscriptionAddOnParameterization'
      discriminator:
        propertyName: type
        mapping:
          PARAMETERIZATION:
            $ref: '#/components/schemas/SubscriptionAddOnParameterization'
          PRICE_OVERRIDE:
            $ref: '#/components/schemas/SubscriptionAddOnPriceOverride'
    OnlinePaymentMethodConfig:
      type: object
      properties:
        config:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OnlineMethodsConfig'
              description: If None, inherits all online providers from invoicing entity.
    BankTransferPaymentMethodConfig:
      type: object
      properties:
        account_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BankAccountId'
    ExternalPaymentMethodConfig:
      type: object
    ExtraComponent:
      type: object
      required:
        - name
        - product_ref
        - price_entry
      properties:
        name:
          type: string
        price_entry:
          $ref: '#/components/schemas/PriceEntry'
        product_ref:
          $ref: '#/components/schemas/ProductRef'
    ComponentOverride:
      type: object
      required:
        - component_id
        - name
        - price_entry
      properties:
        component_id:
          $ref: '#/components/schemas/PriceComponentId'
        name:
          type: string
        price_entry:
          $ref: '#/components/schemas/PriceEntry'
    ComponentParameterization:
      type: object
      required:
        - component_id
        - parameters
      properties:
        component_id:
          $ref: '#/components/schemas/PriceComponentId'
        parameters:
          $ref: '#/components/schemas/ComponentParameters'
    PriceComponentId:
      type: string
      format: MeteroidId
      examples:
        - price_7n42DGM5Tflk9n8mt7Fhc7
    SubscriptionFee:
      oneOf:
        - $ref: '#/components/schemas/RateFee'
        - $ref: '#/components/schemas/OneTimeFee'
        - $ref: '#/components/schemas/RecurringFee'
        - $ref: '#/components/schemas/CapacityFee'
        - $ref: '#/components/schemas/SlotFee'
        - $ref: '#/components/schemas/UsageFee'
      discriminator:
        propertyName: type
        mapping:
          CAPACITY:
            $ref: '#/components/schemas/CapacityFee'
          ONE_TIME:
            $ref: '#/components/schemas/OneTimeFee'
          RATE:
            $ref: '#/components/schemas/RateFee'
          RECURRING:
            $ref: '#/components/schemas/RecurringFee'
          SLOT:
            $ref: '#/components/schemas/SlotFee'
          USAGE:
            $ref: '#/components/schemas/UsageFee'
    SubscriptionAddOnId:
      type: string
      format: MeteroidId
      examples:
        - sub_add_7n42DGM5Tflk9n8mt7Fhc7
    SubscriptionFeeBillingPeriodEnum:
      type: string
      enum:
        - ONE_TIME
        - MONTHLY
        - QUARTERLY
        - SEMIANNUAL
        - ANNUAL
    AppliedCoupon:
      type: object
      required:
        - id
        - coupon_id
        - is_active
        - created_at
      properties:
        applied_amount:
          type:
            - string
            - 'null'
          format: decimal
        applied_count:
          type:
            - integer
            - 'null'
          format: int32
        coupon_id:
          $ref: '#/components/schemas/CouponId'
        created_at:
          type: string
          format: date-time
        id:
          $ref: '#/components/schemas/AppliedCouponId'
        is_active:
          type: boolean
        last_applied_at:
          type:
            - string
            - 'null'
          format: date-time
    Coupon:
      type: object
      required:
        - id
        - code
        - description
        - discount
        - reusable
        - disabled
      properties:
        code:
          type: string
        description:
          type: string
        disabled:
          type: boolean
        discount:
          $ref: '#/components/schemas/CouponDiscount'
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        id:
          $ref: '#/components/schemas/CouponId'
        recurring_value:
          type:
            - integer
            - 'null'
          format: int32
        redemption_limit:
          type:
            - integer
            - 'null'
          format: int32
        reusable:
          type: boolean
    ProductId:
      type: string
      format: MeteroidId
      examples:
        - prd_7n42DGM5Tflk9n8mt7Fhc7
    FeatureId:
      type: string
      format: MeteroidId
      examples:
        - feat_7n42DGM5Tflk9n8mt7Fhc7
    EntitlementId:
      type: string
      format: MeteroidId
      examples:
        - ent_7n42DGM5Tflk9n8mt7Fhc7
    EntitlementValue:
      oneOf:
        - $ref: '#/components/schemas/BooleanEntitlementValue'
        - $ref: '#/components/schemas/MeteredEntitlementValue'
      discriminator:
        propertyName: type
        mapping:
          BOOLEAN:
            $ref: '#/components/schemas/BooleanEntitlementValue'
          METERED:
            $ref: '#/components/schemas/MeteredEntitlementValue'
    MinimumCommitmentScope:
      oneOf:
        - $ref: '#/components/schemas/AllComponentsScope'
        - $ref: '#/components/schemas/ProductsScope'
      discriminator:
        propertyName: type
        mapping:
          all_components:
            $ref: '#/components/schemas/AllComponentsScope'
          products:
            $ref: '#/components/schemas/ProductsScope'
    SubscriptionAddOnPriceOverride:
      type: object
      required:
        - price_entry
      properties:
        name:
          type:
            - string
            - 'null'
        price_entry:
          $ref: '#/components/schemas/PriceEntry'
    SubscriptionAddOnParameterization:
      type: object
      properties:
        billing_period:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BillingPeriodEnum'
        committed_capacity:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        initial_slot_count:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
    OnlineMethodsConfig:
      type: object
      properties:
        card:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OnlineMethodConfig'
        direct_debit:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OnlineMethodConfig'
    BankAccountId:
      type: string
      format: MeteroidId
      examples:
        - ba_7n42DGM5Tflk9n8mt7Fhc7
    PriceEntry:
      oneOf:
        - $ref: '#/components/schemas/ExistingPriceRef'
        - $ref: '#/components/schemas/PriceInput'
      discriminator:
        propertyName: type
        mapping:
          EXISTING:
            $ref: '#/components/schemas/ExistingPriceRef'
          NEW:
            $ref: '#/components/schemas/PriceInput'
    ProductRef:
      oneOf:
        - $ref: '#/components/schemas/ExistingProductRef'
        - $ref: '#/components/schemas/NewProductRef'
      discriminator:
        propertyName: type
        mapping:
          EXISTING:
            $ref: '#/components/schemas/ExistingProductRef'
          NEW:
            $ref: '#/components/schemas/NewProductRef'
    ComponentParameters:
      type: object
      properties:
        billing_period:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BillingPeriodEnum'
        committed_capacity:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        initial_slot_count:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
    RateFee:
      type: object
      required:
        - rate
      properties:
        rate:
          type: string
          format: decimal
    OneTimeFee:
      type: object
      required:
        - rate
        - quantity
      properties:
        quantity:
          type: integer
          format: int32
          minimum: 0
        rate:
          type: string
          format: decimal
    RecurringFee:
      type: object
      required:
        - rate
        - quantity
        - billing_type
      properties:
        billing_type:
          $ref: '#/components/schemas/BillingTypeEnum'
        quantity:
          type: integer
          format: int32
          minimum: 0
        rate:
          type: string
          format: decimal
    CapacityFee:
      type: object
      required:
        - rate
        - included
        - overage_rate
        - metric_id
      properties:
        included:
          type: integer
          format: int64
          minimum: 0
        metric_id:
          $ref: '#/components/schemas/BillableMetricId'
        overage_rate:
          type: string
          format: decimal
        rate:
          type: string
          format: decimal
    SlotFee:
      type: object
      required:
        - unit
        - unit_rate
        - initial_slots
      properties:
        initial_slots:
          type: integer
          format: int32
          minimum: 0
        max_slots:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        min_slots:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        unit:
          type: string
        unit_rate:
          type: string
          format: decimal
    UsageFee:
      type: object
      required:
        - metric_id
        - model
      properties:
        metric_id:
          $ref: '#/components/schemas/BillableMetricId'
        model:
          $ref: '#/components/schemas/UsagePricingModel'
    CouponId:
      type: string
      format: MeteroidId
      examples:
        - cou_7n42DGM5Tflk9n8mt7Fhc7
    AppliedCouponId:
      type: string
      format: MeteroidId
      examples:
        - sub_cou_7n42DGM5Tflk9n8mt7Fhc7
    CouponDiscount:
      oneOf:
        - $ref: '#/components/schemas/PercentageDiscount'
        - $ref: '#/components/schemas/FixedDiscount'
      discriminator:
        propertyName: type
        mapping:
          FIXED:
            $ref: '#/components/schemas/FixedDiscount'
          PERCENTAGE:
            $ref: '#/components/schemas/PercentageDiscount'
    BooleanEntitlementValue:
      type: object
      required:
        - enabled
      properties:
        enabled:
          type: boolean
    MeteredEntitlementValue:
      type: object
      properties:
        enabled:
          type: boolean
          description: Per-entitlement kill switch. `false` means disabled.
        limit:
          type:
            - string
            - 'null'
          format: decimal
          description: Cap on usage. Null means unlimited.
        reset_period:
          $ref: '#/components/schemas/ResetPeriod'
    AllComponentsScope:
      type: object
      description: Every revenue line counts toward the floor.
    ProductsScope:
      type: object
      description: >-
        Only lines for the listed products count. A product is the identity
        shared by plan

        components, overrides and ad-hoc extras, so a subscription's billed set
        is matched uniformly.
      required:
        - product_ids
      properties:
        product_ids:
          type: array
          items:
            type: string
    OnlineMethodConfig:
      type: object
      required:
        - enabled
      properties:
        enabled:
          type: boolean
    ExistingPriceRef:
      type: object
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/PriceId'
    PriceInput:
      type: object
      required:
        - cadence
        - currency
        - pricing
      properties:
        cadence:
          $ref: '#/components/schemas/BillingPeriodEnum'
        currency:
          type: string
        pricing:
          $ref: '#/components/schemas/Pricing'
    ExistingProductRef:
      type: object
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/ProductId'
    NewProductRef:
      type: object
      required:
        - name
        - fee_type
        - fee_structure
      properties:
        fee_structure:
          $ref: '#/components/schemas/ProductFeeStructure'
        fee_type:
          $ref: '#/components/schemas/ProductFeeTypeEnum'
        name:
          type: string
    BillingTypeEnum:
      type: string
      enum:
        - ADVANCE
        - ARREARS
    BillableMetricId:
      type: string
      format: MeteroidId
      examples:
        - bm_7n42DGM5Tflk9n8mt7Fhc7
    UsagePricingModel:
      oneOf:
        - $ref: '#/components/schemas/PerUnitPricing'
        - $ref: '#/components/schemas/TieredPricing'
        - $ref: '#/components/schemas/VolumePricing'
        - $ref: '#/components/schemas/PackagePricing'
        - $ref: '#/components/schemas/MatrixPricing'
      discriminator:
        propertyName: type
        mapping:
          MATRIX:
            $ref: '#/components/schemas/MatrixPricing'
          PACKAGE:
            $ref: '#/components/schemas/PackagePricing'
          PER_UNIT:
            $ref: '#/components/schemas/PerUnitPricing'
          TIERED:
            $ref: '#/components/schemas/TieredPricing'
          VOLUME:
            $ref: '#/components/schemas/VolumePricing'
    PercentageDiscount:
      type: object
      required:
        - percentage
      properties:
        percentage:
          type: string
    FixedDiscount:
      type: object
      required:
        - currency
        - amount
      properties:
        amount:
          type: string
        currency:
          type: string
    ResetPeriod:
      oneOf:
        - $ref: '#/components/schemas/BillingCycleResetPeriod'
          description: >-
            Resets each time your subscription renews — anchored to your billing
            cycle.
        - $ref: '#/components/schemas/CalendarResetPeriod'
          description: >-
            Resets on calendar boundaries (e.g. the 1st of every month) — not
            tied to subscription start date.
        - $ref: '#/components/schemas/FixedWindowResetPeriod'
          description: >-
            Resets at regular intervals — anchored to your subscription's exact
            activation time.
        - $ref: '#/components/schemas/SlidingWindowResetPeriod'
          description: >-
            Always ends at now — e.g. 30 days means the last 30 days, old usage
            drops off automatically.
        - $ref: '#/components/schemas/NeverResetPeriod'
          description: >-
            Never resets — counts all usage since the subscription was
            activated.
      discriminator:
        propertyName: type
        mapping:
          BILLING_CYCLE:
            $ref: '#/components/schemas/BillingCycleResetPeriod'
          CALENDAR:
            $ref: '#/components/schemas/CalendarResetPeriod'
          FIXED_WINDOW:
            $ref: '#/components/schemas/FixedWindowResetPeriod'
          NEVER:
            $ref: '#/components/schemas/NeverResetPeriod'
          SLIDING_WINDOW:
            $ref: '#/components/schemas/SlidingWindowResetPeriod'
    PriceId:
      type: string
      format: MeteroidId
      examples:
        - pri_7n42DGM5Tflk9n8mt7Fhc7
    Pricing:
      oneOf:
        - $ref: '#/components/schemas/RatePricing'
        - $ref: '#/components/schemas/SlotPricing'
        - $ref: '#/components/schemas/CapacityPricing'
        - $ref: '#/components/schemas/UsagePricing'
        - $ref: '#/components/schemas/ExtraRecurringPricing'
        - $ref: '#/components/schemas/OneTimePricing'
      discriminator:
        propertyName: type
        mapping:
          CAPACITY:
            $ref: '#/components/schemas/CapacityPricing'
          EXTRA_RECURRING:
            $ref: '#/components/schemas/ExtraRecurringPricing'
          ONE_TIME:
            $ref: '#/components/schemas/OneTimePricing'
          RATE:
            $ref: '#/components/schemas/RatePricing'
          SLOT:
            $ref: '#/components/schemas/SlotPricing'
          USAGE:
            $ref: '#/components/schemas/UsagePricing'
    ProductFeeStructure:
      oneOf:
        - $ref: '#/components/schemas/RateFeeStructure'
        - $ref: '#/components/schemas/SlotFeeStructure'
        - $ref: '#/components/schemas/CapacityFeeStructure'
        - $ref: '#/components/schemas/UsageFeeStructure'
        - $ref: '#/components/schemas/ExtraRecurringFeeStructure'
        - $ref: '#/components/schemas/OneTimeFeeStructure'
      discriminator:
        propertyName: type
        mapping:
          CAPACITY:
            $ref: '#/components/schemas/CapacityFeeStructure'
          EXTRA_RECURRING:
            $ref: '#/components/schemas/ExtraRecurringFeeStructure'
          ONE_TIME:
            $ref: '#/components/schemas/OneTimeFeeStructure'
          RATE:
            $ref: '#/components/schemas/RateFeeStructure'
          SLOT:
            $ref: '#/components/schemas/SlotFeeStructure'
          USAGE:
            $ref: '#/components/schemas/UsageFeeStructure'
    ProductFeeTypeEnum:
      type: string
      enum:
        - RATE
        - SLOT
        - CAPACITY
        - USAGE
        - EXTRA_RECURRING
        - ONE_TIME
    PerUnitPricing:
      type: object
      required:
        - rate
      properties:
        rate:
          type: string
          format: decimal
    TieredPricing:
      type: object
      required:
        - tiers
      properties:
        block_size:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        tiers:
          type: array
          items:
            $ref: '#/components/schemas/TierRow'
    VolumePricing:
      type: object
      required:
        - tiers
      properties:
        block_size:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        tiers:
          type: array
          items:
            $ref: '#/components/schemas/TierRow'
    PackagePricing:
      type: object
      required:
        - block_size
        - rate
      properties:
        block_size:
          type: integer
          format: int64
          minimum: 0
        rate:
          type: string
          format: decimal
    MatrixPricing:
      type: object
      required:
        - rates
      properties:
        rates:
          type: array
          items:
            $ref: '#/components/schemas/MatrixRow'
    BillingCycleResetPeriod:
      type: object
      description: >-
        Resets each time your subscription renews — anchored to your billing
        cycle.
    CalendarResetPeriod:
      type: object
      description: >-
        Resets on calendar boundaries (e.g. the 1st of every month) — not tied
        to subscription start date.
      required:
        - unit
        - interval
      properties:
        interval:
          type: integer
          format: int32
          minimum: 0
        unit:
          $ref: '#/components/schemas/CalendarUnit'
    FixedWindowResetPeriod:
      type: object
      description: >-
        Resets at regular intervals — anchored to your subscription's exact
        activation time.
      required:
        - unit
        - interval
      properties:
        interval:
          type: integer
          format: int32
          minimum: 0
        unit:
          $ref: '#/components/schemas/CalendarUnit'
    SlidingWindowResetPeriod:
      type: object
      description: >-
        Always ends at now — e.g. 30 days means the last 30 days, old usage
        drops off automatically.
      required:
        - unit
        - interval
      properties:
        interval:
          type: integer
          format: int32
          minimum: 0
        unit:
          $ref: '#/components/schemas/CalendarUnit'
    NeverResetPeriod:
      type: object
      description: Never resets — counts all usage since the subscription was activated.
    RatePricing:
      type: object
      required:
        - rate
      properties:
        rate:
          type: string
          format: decimal
    SlotPricing:
      type: object
      required:
        - unit_rate
      properties:
        max_slots:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        min_slots:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        unit_rate:
          type: string
          format: decimal
    CapacityPricing:
      type: object
      required:
        - rate
        - included
        - overage_rate
      properties:
        included:
          type: integer
          format: int64
          minimum: 0
        overage_rate:
          type: string
          format: decimal
        rate:
          type: string
          format: decimal
    UsagePricing:
      type: object
      required:
        - model
      properties:
        model:
          $ref: '#/components/schemas/UsagePricingModel'
    ExtraRecurringPricing:
      type: object
      required:
        - unit_price
        - quantity
      properties:
        quantity:
          type: integer
          format: int32
          minimum: 0
        unit_price:
          type: string
          format: decimal
    OneTimePricing:
      type: object
      required:
        - unit_price
        - quantity
      properties:
        quantity:
          type: integer
          format: int32
          minimum: 0
        unit_price:
          type: string
          format: decimal
    RateFeeStructure:
      type: object
    SlotFeeStructure:
      type: object
      required:
        - slot_unit_name
        - upgrade_policy
        - downgrade_policy
      properties:
        downgrade_policy:
          $ref: '#/components/schemas/SlotDowngradePolicyEnum'
        slot_unit_name:
          type: string
        upgrade_policy:
          $ref: '#/components/schemas/SlotUpgradePolicyEnum'
    CapacityFeeStructure:
      type: object
      required:
        - metric_id
      properties:
        metric_id:
          $ref: '#/components/schemas/BillableMetricId'
    UsageFeeStructure:
      type: object
      required:
        - metric_id
        - model
      properties:
        metric_id:
          $ref: '#/components/schemas/BillableMetricId'
        model:
          $ref: '#/components/schemas/UsageModelEnum'
    ExtraRecurringFeeStructure:
      type: object
      required:
        - billing_type
      properties:
        billing_type:
          $ref: '#/components/schemas/ExtraRecurringBillingTypeEnum'
    OneTimeFeeStructure:
      type: object
    TierRow:
      type: object
      required:
        - first_unit
        - rate
        - flat_fee
        - flat_cap
      properties:
        first_unit:
          type: integer
          format: int64
          minimum: 0
        flat_cap:
          type: string
          format: decimal
        flat_fee:
          type: string
          format: decimal
        rate:
          type: string
          format: decimal
    MatrixRow:
      type: object
      required:
        - dimension1
        - per_unit_price
      properties:
        dimension1:
          $ref: '#/components/schemas/MatrixDimension'
        dimension2:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/MatrixDimension'
        per_unit_price:
          type: string
          format: decimal
    CalendarUnit:
      type: string
      enum:
        - HOUR
        - DAY
        - WEEK
        - MONTH
        - YEAR
    SlotDowngradePolicyEnum:
      type: string
      enum:
        - REMOVE_AT_END_OF_PERIOD
    SlotUpgradePolicyEnum:
      type: string
      enum:
        - PRORATED
    UsageModelEnum:
      type: string
      enum:
        - PER_UNIT
        - TIERED
        - VOLUME
        - PACKAGE
        - MATRIX
    ExtraRecurringBillingTypeEnum:
      type: string
      enum:
        - ADVANCE
        - ARREARS
    MatrixDimension:
      type: object
      required:
        - key
        - value
      properties:
        key:
          type: string
        value:
          type: string
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````