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

# Get the catalog

> Read an environment's whole catalog in one request, as the CLI pulls it.

Returns the environment's active plans, features and credit packs, each in the shape of its own list endpoint, with `creditsPerUsd` (null for abstract credits) and `models`, your own [AI model prices](https://docs.integrateledger.com/pricing/ai-credits.md), sorted by ID.

Needs the **Catalog** permission at Read.


## OpenAPI

````yaml openapi.json GET /v1/catalog
openapi: 3.1.0
info:
  title: Ledger API
  version: 0.1.0
servers:
  - url: https://api.integrateledger.com
    description: Hosted Ledger API
security: []
paths:
  /v1/catalog:
    get:
      tags:
        - Catalog
      summary: Get the catalog
      operationId: getCatalog
      responses:
        '200':
          description: >-
            The environment's active catalog: the plan, feature and add-on lists
            as GET /v1/plans, /v1/features and /v1/add-ons return them, the
            shared pool's creditsPerUsd, your model prices and the top-up
            bounds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Catalog'
        '401':
          description: Missing or invalid Ledger API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CatalogError'
        '403':
          $ref: '#/components/responses/InsufficientPermissions'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - ApiKey: []
      x-codeSamples:
        - lang: python
          label: Python SDK
          source: |-
            import os
            from integrateledger import ledger

            client = ledger(api_key=os.environ["LEDGER_API_KEY"])
            client.get_catalog()
        - lang: bash
          label: cURL
          source: |-
            curl --request GET 'https://api.integrateledger.com/v1/catalog' \
              -H "Authorization: Bearer $LEDGER_API_KEY"
        - lang: typescript
          label: TypeScript SDK
          source: >-
            import ledger from "integrateledger";


            const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? ""
            });

            await client.getCatalog();
components:
  schemas:
    Catalog:
      type: object
      properties:
        environment:
          type: string
          enum:
            - sandbox
            - live
        creditsPerUsd:
          type:
            - integer
            - 'null'
          description: 'The shared pool''s credits per dollar. Null: abstract credits.'
        models:
          type: array
          items:
            $ref: '#/components/schemas/ModelPrice'
          description: Your own token prices, sorted by model ID.
        plans:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
                maxLength: 100
                pattern: ^[a-zA-Z0-9_-]+$
                description: >-
                  Your ID for the item: letters, numbers, `_` or `-`. It can't
                  be changed.
              previousIds:
                type: array
                items:
                  type: string
                description: >-
                  IDs the plan had before a rename, oldest first. They still
                  resolve to this plan.
              variantOf:
                type:
                  - string
                  - 'null'
                description: >-
                  The current ID of the base plan this one is a variant of, or
                  null.
              name:
                type: string
                minLength: 1
                maxLength: 120
                description: >-
                  Shown in the dashboard. Plan and credit pack names also appear
                  on Stripe Checkout.
              currencyOptions:
                type: object
                additionalProperties:
                  $ref: '#/components/schemas/CurrencyOption'
                description: >-
                  The plan in other currencies, by ISO 4217 code: its price and
                  overage terms in each one's minor units. An option prices
                  everything the plan's own currency does
                  (`currency_option_incomplete`). A customer's currency is set
                  at their first paid attach (attach's `currency`, else the
                  plan's own) and every later bill is in it. A plan whose items
                  have prices or overage prices takes no options
                  (`currency_options_items_not_supported`).
              currency:
                type: string
                pattern: ^[a-z]{3}$
                description: >-
                  The currency the plan's amounts are in (ISO 4217, lower case).
                  Defaults to the catalog's `currency`, or on POST /v1/plans the
                  workspace's (set by its last catalog publish, `usd` before
                  one). A change of currency is a new version. A customer's plan
                  changes stay in their currency (`currency_not_offered` for a
                  plan without a price in it).
              monthlyCredits:
                type: integer
                minimum: 0
                description: >-
                  Credits granted at the start of each allowance period (each
                  month, unless resetInterval is year). 0 for a plan with only
                  items, or with pay-as-you-go credits. At most 2,147,483,647:
                  $21,474.83 at 100,000 credits per dollar.
              billingInterval:
                type: string
                enum:
                  - month
                  - year
                  - one_off
              resetInterval:
                type: string
                enum:
                  - month
                  - year
                  - never
              priceCents:
                type: integer
                minimum: 0
                maximum: 2147483647
                description: Price in US cents per billing interval.
              monthlyPriceCents:
                type: integer
                minimum: 0
                maximum: 2147483647
                description: >-
                  The older name for priceCents, accepted on monthly plans only.
                  Listed for monthly plans.
              overageUnitAmountCents:
                type:
                  - integer
                  - 'null'
                maximum: 2147483647
                exclusiveMinimum: 0
                description: >-
                  Price in cents per overageBillingUnits credits used after the
                  plan's credits and packs run out. Null or omitted: no overage.
              overageBillingUnits:
                type: integer
                exclusiveMinimum: 0
                maximum: 2147483647
                description: Credits billed per overageUnitAmountCents. Defaults to 1.
              overageCapCents:
                type:
                  - integer
                  - 'null'
                minimum: 0
                maximum: 2147483647
                description: >-
                  Default monthly overage spend cap in cents. A customer's own
                  cap replaces it. Null or omitted: no cap.
              overageTiers:
                type:
                  - array
                  - 'null'
                items:
                  type: object
                  properties:
                    upTo:
                      type:
                        - integer
                        - 'null'
                      maximum: 2147483647
                      exclusiveMinimum: 0
                      description: >-
                        The band's last billed unit; null for the last band,
                        which has no limit.
                    unitAmountCents:
                      type: integer
                      maximum: 2147483647
                      exclusiveMinimum: 0
                      description: Price in cents per billed unit in this band.
                    flatAmountCents:
                      type: integer
                      minimum: 0
                      maximum: 2147483647
                      description: >-
                        A flat amount billed once the band is reached. Defaults
                        to 0.
                  required:
                    - upTo
                    - unitAmountCents
                  additionalProperties: false
                description: >-
                  Bands for the period's overage instead of one rate, over
                  billed units (overage rounded up to the billing units),
                  ascending, the last with upTo null. overageUnitAmountCents
                  must be sent as the first band's rate. The invoice bills one
                  line per band reached.
              overageTiersMode:
                type:
                  - string
                  - 'null'
                enum:
                  - graduated
                  - volume
                  - null
                description: >-
                  With overageTiers: `graduated` (the default) prices each
                  band's units at its rate; `volume` prices every unit at the
                  rate of the band the period's total reaches. Null or omitted
                  without tiers.
              rollover:
                $ref: '#/components/schemas/RolloverSettings'
              autoTopUp:
                $ref: '#/components/schemas/PlanAutoTopUp'
              ignorePastDue:
                type: boolean
              customOnly:
                type: boolean
              items:
                type: array
                items:
                  $ref: '#/components/schemas/PlanFeatureItem'
                description: What the plan includes of each feature. Empty for none.
              trial:
                type:
                  - object
                  - 'null'
                properties:
                  days:
                    type: integer
                  cardRequired:
                    type: boolean
                  onEnd:
                    type: string
                    enum:
                      - bill
                      - revert
                  credits:
                    type: integer
                    description: Credits granted to the pool for the trial.
                required:
                  - days
                  - cardRequired
                  - onEnd
                  - credits
                description: The plan's free trial, or null when it has none.
              group:
                type: string
                description: 'The plan''s product line: `default` unless set.'
              addOn:
                type: boolean
                description: Whether the plan is a recurring add-on.
              maxQuantity:
                type:
                  - integer
                  - 'null'
                description: >-
                  How many of an add-on one customer or entity may hold. Null:
                  1.
              entityGrants:
                type: string
                enum:
                  - own
                  - pooled
                description: >-
                  Where the plan's grants go when attached to an entity: `own`
                  or `pooled`.
              licenses:
                type: array
                items:
                  $ref: '#/components/schemas/PlanLicense'
                description: >-
                  Seats of other plans this plan sells, by seat plan;
                  seatPriceCents and maxSeats only when set. Empty for none.
              prepaid:
                type:
                  - object
                  - 'null'
                properties:
                  billingUnits:
                    type: integer
                    exclusiveMinimum: 0
                    maximum: 2147483647
                    description: >-
                      Units in one pack: what the customer buys at a time, such
                      as 1000. 1 or more.
                  unitAmountCents:
                    type: integer
                    maximum: 2147483647
                    exclusiveMinimum: 0
                    description: >-
                      Price in US cents of one pack per billing interval of the
                      plan, above 0.
                  maxQuantity:
                    type: integer
                    exclusiveMinimum: 0
                    maximum: 2147483647
                    description: >-
                      The most one customer may hold a period, the included
                      units counted. Above them, by whole packs
                      (`prepaid_max_below_included`,
                      `prepaid_max_not_multiple`). Omitted: no maximum.
                required:
                  - billingUnits
                  - unitAmountCents
                additionalProperties: false
                description: >-
                  The credit pool sold prepaid; maxQuantity only when set. Null:
                  none.
              controls:
                $ref: '#/components/schemas/PlanControlsOutput'
              version:
                type:
                  - integer
                  - 'null'
                exclusiveMinimum: 0
                description: >-
                  The version's number among the plan's versions: 1, 2, 3 in the
                  order they were made. Null only briefly after a deploy, until
                  Ledger numbers older versions.
              stripeSyncStatus:
                type:
                  - string
                  - 'null'
                enum:
                  - pending
                  - synced
                  - failed
                  - null
              versionLabel:
                type:
                  - string
                  - 'null'
              draft:
                allOf:
                  - $ref: '#/components/schemas/PlanDraftInput'
                  - type:
                      - object
                      - 'null'
                    properties:
                      billingInterval:
                        type: string
                        enum:
                          - month
                          - year
                          - one_off
                      resetInterval:
                        type: string
                        enum:
                          - month
                          - year
                          - never
                      priceCents:
                        type: integer
                        minimum: 0
                        maximum: 2147483647
                        description: Price in US cents per billing interval.
                      rollover:
                        $ref: '#/components/schemas/RolloverSettings'
                      autoTopUp:
                        $ref: '#/components/schemas/PlanAutoTopUp'
                      ignorePastDue:
                        type: boolean
                      customOnly:
                        type: boolean
                      items:
                        type: array
                        items:
                          $ref: '#/components/schemas/PlanFeatureItem'
                        description: >-
                          What the plan includes of each feature. Empty for
                          none.
                      trial:
                        type:
                          - object
                          - 'null'
                        properties:
                          days:
                            type: integer
                          cardRequired:
                            type: boolean
                          onEnd:
                            type: string
                            enum:
                              - bill
                              - revert
                          credits:
                            type: integer
                            description: Credits granted to the pool for the trial.
                        required:
                          - days
                          - cardRequired
                          - onEnd
                          - credits
                        description: The plan's free trial, or null when it has none.
                      group:
                        type: string
                        description: 'The plan''s product line: `default` unless set.'
                      addOn:
                        type: boolean
                        description: Whether the plan is a recurring add-on.
                      maxQuantity:
                        type:
                          - integer
                          - 'null'
                        description: >-
                          How many of an add-on one customer or entity may hold.
                          Null: 1.
                      entityGrants:
                        type: string
                        enum:
                          - own
                          - pooled
                        description: >-
                          Where the plan's grants go when attached to an entity:
                          `own` or `pooled`.
                      licenses:
                        type: array
                        items:
                          $ref: '#/components/schemas/PlanLicense'
                        description: >-
                          Seats of other plans this plan sells, by seat plan;
                          seatPriceCents and maxSeats only when set. Empty for
                          none.
                      prepaid:
                        type:
                          - object
                          - 'null'
                        properties:
                          billingUnits:
                            type: integer
                            exclusiveMinimum: 0
                            maximum: 2147483647
                            description: >-
                              Units in one pack: what the customer buys at a
                              time, such as 1000. 1 or more.
                          unitAmountCents:
                            type: integer
                            maximum: 2147483647
                            exclusiveMinimum: 0
                            description: >-
                              Price in US cents of one pack per billing interval
                              of the plan, above 0.
                          maxQuantity:
                            type: integer
                            exclusiveMinimum: 0
                            maximum: 2147483647
                            description: >-
                              The most one customer may hold a period, the
                              included units counted. Above them, by whole packs
                              (`prepaid_max_below_included`,
                              `prepaid_max_not_multiple`). Omitted: no maximum.
                        required:
                          - billingUnits
                          - unitAmountCents
                        additionalProperties: false
                        description: >-
                          The credit pool sold prepaid; maxQuantity only when
                          set. Null: none.
                      controls:
                        $ref: '#/components/schemas/PlanControlsOutput'
                      version:
                        type:
                          - integer
                          - 'null'
                        exclusiveMinimum: 0
                        description: >-
                          The version's number among the plan's versions: 1, 2,
                          3 in the order they were made. Null only briefly after
                          a deploy, until Ledger numbers older versions.
                      stripeSyncStatus:
                        type:
                          - string
                          - 'null'
                        enum:
                          - pending
                          - synced
                          - failed
                          - null
                      versionLabel:
                        type:
                          - string
                          - 'null'
                    required:
                      - billingInterval
                      - resetInterval
                      - priceCents
                      - rollover
                      - autoTopUp
                      - ignorePastDue
                      - customOnly
                      - items
                      - group
                      - addOn
                      - maxQuantity
                      - entityGrants
                      - version
                      - versionLabel
                    additionalProperties: false
                description: The plan's draft version, or null when it has none.
            required:
              - id
              - name
              - monthlyCredits
              - billingInterval
              - resetInterval
              - priceCents
              - rollover
              - autoTopUp
              - ignorePastDue
              - customOnly
              - items
              - group
              - addOn
              - maxQuantity
              - entityGrants
            additionalProperties: false
        features:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
                maxLength: 100
                pattern: ^[a-zA-Z0-9_-]+$
                description: >-
                  Your ID for the item: letters, numbers, `_` or `-`. It can't
                  be changed.
              name:
                type: string
                minLength: 1
                maxLength: 120
                description: >-
                  Shown in the dashboard. Plan and credit pack names also appear
                  on Stripe Checkout.
              type:
                type: string
                enum:
                  - credits
                  - metered
                  - held
                  - boolean
                  - ai_tokens
              creditCost:
                type:
                  - integer
                  - 'null'
                exclusiveMinimum: 0
                maximum: 2147483647
                description: Credits one successful use spends. Null unless credits.
              creditCostTiers:
                type: array
                items:
                  type: object
                  properties:
                    upTo:
                      type:
                        - integer
                        - 'null'
                    creditCost:
                      type: integer
                  required:
                    - upTo
                    - creditCost
                description: >-
                  The cost per use by the period's use count, graduated. Listed
                  only on a feature with tiers.
              balance:
                type: string
                enum:
                  - pool
                  - own
                description: '`ai_tokens` only: the balance it spends.'
              creditsPerUsd:
                type:
                  - integer
                  - 'null'
                description: >-
                  `ai_tokens` only: the own balance's credits per dollar. Null
                  on the pool, whose rate is the catalog's.
              markupPercent:
                type:
                  - number
                  - 'null'
                description: '`ai_tokens` only. Null: no feature markup.'
              providerMarkupPercent:
                type:
                  - object
                  - 'null'
                additionalProperties:
                  type: number
                description: '`ai_tokens` only. Null: none.'
              modelMarkupPercent:
                type:
                  - object
                  - 'null'
                additionalProperties:
                  type: number
                description: '`ai_tokens` only. Null: none.'
            required:
              - id
              - name
              - type
              - creditCost
            additionalProperties: false
        addOns:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
                maxLength: 100
                pattern: ^[a-zA-Z0-9_-]+$
                description: >-
                  Your ID for the item: letters, numbers, `_` or `-`. It can't
                  be changed.
              name:
                type: string
                minLength: 1
                maxLength: 120
                description: >-
                  Shown in the dashboard. Plan and credit pack names also appear
                  on Stripe Checkout.
              type:
                type: string
                enum:
                  - credit_pack
                description: 'The only add-on type: a one-time credit pack.'
              creditAmount:
                type: integer
                exclusiveMinimum: 0
                description: >-
                  Credits granted per purchase. They don't expire. At most
                  2,147,483,647: $21,474.83 at 100,000 credits per dollar.
              priceCents:
                type: integer
                maximum: 2147483647
                exclusiveMinimum: 0
                description: >-
                  Price per purchase in the pack's currency's minor units (cents
                  for usd).
              currency:
                type: string
                pattern: ^[a-z]{3}$
                description: >-
                  The pack's currency (ISO 4217, lower case). Defaults to the
                  catalog's `currency`, or the workspace's.
            required:
              - id
              - name
              - type
              - creditAmount
              - priceCents
            additionalProperties: false
        rewards:
          type: array
          items:
            $ref: '#/components/schemas/RewardInput'
          description: Active rewards as a catalog states them, with their catalog codes.
        referralPrograms:
          type: array
          items:
            $ref: '#/components/schemas/ReferralProgramInput'
          description: Active referral programs as a catalog states them.
        topUps:
          $ref: '#/components/schemas/TopUpSettings'
      required:
        - environment
        - creditsPerUsd
        - models
        - plans
        - features
        - addOns
        - rewards
        - referralPrograms
        - topUps
    CatalogError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
          description: >-
            What went wrong and what to do about it, for a person or an agent to
            read. Every Ledger error has one. The wording can change: branch on
            `error`, not on this text.
          example: >-
            No customer "user_123" exists in this environment. Create it with
            POST /v1/customers, or check that the API key is for the right
            environment.
        issues:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              message:
                type: string
            required:
              - path
              - message
      required:
        - error
    ModelPrice:
      type: object
      properties:
        id:
          type: string
          maxLength: 200
          pattern: ^[^/\s]+\/\S+$
          description: >-
            The model ID, `provider/model` as models.dev keys it: `custom/...`
            for your own model, or a listed model (such as "openai/gpt-4o") to
            override Ledger's price.
        inputUsdPerMTok:
          type: string
          description: >-
            US dollars per million tokens, as a decimal string with up to six
            decimals, such as "3" or "0.075".
        outputUsdPerMTok:
          type: string
          description: >-
            US dollars per million tokens, as a decimal string with up to six
            decimals, such as "3" or "0.075".
        cacheReadUsdPerMTok:
          type: string
          description: Defaults to the input price.
        cacheWriteUsdPerMTok:
          type: string
          description: Defaults to the input price.
        reasoningUsdPerMTok:
          type: string
          description: Defaults to the output price.
        audioInputUsdPerMTok:
          type: string
          description: Defaults to the input price.
        audioOutputUsdPerMTok:
          type: string
          description: Defaults to the output price.
      required:
        - id
        - inputUsdPerMTok
        - outputUsdPerMTok
      additionalProperties: false
    CurrencyOption:
      type: object
      properties:
        priceCents:
          type: integer
          minimum: 0
          maximum: 2147483647
          description: The plan's price per billing interval in this currency.
        overageUnitAmountCents:
          type:
            - integer
            - 'null'
          maximum: 2147483647
          exclusiveMinimum: 0
          description: >-
            The overage rate in this currency, per overageBillingUnits credits.
            Required when the plan prices overage.
        overageCapCents:
          type:
            - integer
            - 'null'
          minimum: 0
          maximum: 2147483647
          description: >-
            The default monthly overage cap in this currency. Required when the
            plan caps overage.
        overageTiers:
          type:
            - array
            - 'null'
          items:
            type: object
            properties:
              upTo:
                type:
                  - integer
                  - 'null'
                maximum: 2147483647
                exclusiveMinimum: 0
                description: >-
                  The band's last billed unit; null for the last band, which has
                  no limit.
              unitAmountCents:
                type: integer
                maximum: 2147483647
                exclusiveMinimum: 0
                description: Price in cents per billed unit in this band.
              flatAmountCents:
                type: integer
                minimum: 0
                maximum: 2147483647
                description: A flat amount billed once the band is reached. Defaults to 0.
            required:
              - upTo
              - unitAmountCents
            additionalProperties: false
          description: >-
            The overage bands in this currency: the plan's band boundaries with
            this currency's rates. Required when the plan's overage has bands.
      required:
        - priceCents
      additionalProperties: false
    RolloverSettings:
      type:
        - object
        - 'null'
      properties:
        maxCredits:
          type:
            - integer
            - 'null'
        maxPercent:
          type:
            - integer
            - 'null'
        periods:
          type:
            - integer
            - 'null'
          description: 'Allowance periods a rolled grant lasts. Null: until used.'
      required:
        - maxCredits
        - maxPercent
        - periods
      description: 'Rollover of unused allowance. Null: off.'
    PlanAutoTopUp:
      type:
        - object
        - 'null'
      properties:
        thresholdCredits:
          type: integer
        addOnId:
          type:
            - string
            - 'null'
        amountCents:
          type:
            - integer
            - 'null'
        maxPerPeriod:
          type: integer
        maxAmountCentsPerPeriod:
          type:
            - integer
            - 'null'
      required:
        - thresholdCredits
        - addOnId
        - amountCents
        - maxPerPeriod
        - maxAmountCentsPerPeriod
      description: 'The plan''s auto top-up default. Null: none.'
    PlanFeatureItem:
      type: object
      properties:
        featureId:
          type: string
          description: The feature's ID.
        included:
          type:
            - integer
            - 'null'
          description: >-
            Units per period (metered) or the most held at once (held). Null
            when unlimited, and for boolean and credits items.
        unlimited:
          type: boolean
        overageUnitAmountCents:
          type:
            - integer
            - 'null'
          description: >-
            Price in cents per overageBillingUnits units past `included`. Null:
            no overage.
        overageBillingUnits:
          type: integer
          description: Units billed per overageUnitAmountCents.
        overageTiers:
          type:
            - array
            - 'null'
          items:
            type: object
            properties:
              upTo:
                type:
                  - integer
                  - 'null'
              unitAmountCents:
                type: integer
              flatAmountCents:
                type: integer
            required:
              - upTo
              - unitAmountCents
              - flatAmountCents
        overageTiersMode:
          type:
            - string
            - 'null'
          enum:
            - graduated
            - volume
            - null
        price:
          type:
            - object
            - 'null'
          properties:
            model:
              type: string
              enum:
                - per_unit
                - measured
            billingUnits:
              type: integer
            unitAmountCents:
              type:
                - integer
                - 'null'
            tiers:
              type:
                - array
                - 'null'
              items:
                type: object
                properties:
                  upTo:
                    type:
                      - integer
                      - 'null'
                  unitAmountCents:
                    type: integer
                required:
                  - upTo
                  - unitAmountCents
            tiersMode:
              type:
                - string
                - 'null'
              enum:
                - graduated
                - volume
                - null
            includedQuantity:
              type: integer
            proration:
              type: object
              properties:
                onIncrease:
                  type: string
                  enum:
                    - next_invoice
                    - charge_now
                    - none
                onDecrease:
                  type: string
                  enum:
                    - next_invoice
                    - none
              required:
                - onIncrease
                - onDecrease
          required:
            - model
            - billingUnits
            - unitAmountCents
            - tiers
            - tiersMode
            - includedQuantity
            - proration
          description: >-
            A held item's price on the amount held, with its defaults. Null: not
            billed by count.
        trialIncluded:
          type:
            - integer
            - 'null'
          description: >-
            A metered item's units for the plan's trial. Null: `included`
            applies in the trial too.
        rollover:
          $ref: '#/components/schemas/RolloverSettings'
        prepaid:
          type:
            - object
            - 'null'
          properties:
            billingUnits:
              type: integer
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                Units in one pack: what the customer buys at a time, such as
                1000. 1 or more.
            unitAmountCents:
              type: integer
              maximum: 2147483647
              exclusiveMinimum: 0
              description: >-
                Price in US cents of one pack per billing interval of the plan,
                above 0.
            maxQuantity:
              type: integer
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                The most one customer may hold a period, the included units
                counted. Above them, by whole packs
                (`prepaid_max_below_included`, `prepaid_max_not_multiple`).
                Omitted: no maximum.
          required:
            - billingUnits
            - unitAmountCents
          additionalProperties: false
          description: >-
            A metered item's units sold in prepaid packs; maxQuantity only when
            set. Null: none.
      required:
        - featureId
        - included
        - unlimited
        - overageUnitAmountCents
        - overageBillingUnits
        - overageTiers
        - overageTiersMode
        - price
        - rollover
    PlanLicense:
      type: object
      properties:
        planId:
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[a-zA-Z0-9_-]+$
          description: >-
            The seat plan: the public ID of an active plan in this environment,
            not an add-on, a one-off plan or a plan with licenses of its own.
            Each seat gets its allowances.
        seatFeatureId:
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[a-zA-Z0-9_-]+$
          description: >-
            The held feature that counts the seats. No item on it, in this plan
            or the seat plan: the license holds the count.
        includedSeats:
          type: integer
          minimum: 0
          maximum: 2147483647
          description: Seats the plan's price includes. 0 or more.
        seatPriceCents:
          type: integer
          maximum: 2147483647
          exclusiveMinimum: 0
          description: >-
            Price in US cents per seat per billing interval of this plan, above
            0. Omitted: the seat plan's own price, read when Stripe syncs this
            version (changing the seat plan's price later doesn't reprice it);
            the seat plan must then bill at this plan's interval.
        maxSeats:
          type: integer
          minimum: 0
          maximum: 2147483647
          description: >-
            The most seats one customer may hold, at least includedSeats.
            Omitted: no maximum.
      required:
        - planId
        - seatFeatureId
        - includedSeats
      additionalProperties: false
      description: >-
        Seats of a seat plan this plan sells: Team is $40 a seat, each seat gets
        100 summaries a month. Attach sells seats with the plan (licenseSeats),
        and POST /v1/licenses/assign gives one to an entity.
    PlanControlsOutput:
      allOf:
        - $ref: '#/components/schemas/PlanControls'
        - type: object
          properties:
            usageLimits:
              type: array
              items:
                $ref: '#/components/schemas/UsageLimit'
              maxItems: 50
            usageAlerts:
              type: array
              items:
                $ref: '#/components/schemas/UsageAlert'
              maxItems: 50
            overage:
              type: array
              items:
                $ref: '#/components/schemas/OverageControl'
              maxItems: 50
          required:
            - usageLimits
            - usageAlerts
            - overage
          additionalProperties: false
      description: The plan's control entries, every kind listed.
    PlanDraftInput:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
          description: >-
            Shown in the dashboard. Plan and credit pack names also appear on
            Stripe Checkout.
        currencyOptions:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/CurrencyOption'
          description: >-
            The plan in other currencies, by ISO 4217 code: its price and
            overage terms in each one's minor units. An option prices everything
            the plan's own currency does (`currency_option_incomplete`). A
            customer's currency is set at their first paid attach (attach's
            `currency`, else the plan's own) and every later bill is in it. A
            plan whose items have prices or overage prices takes no options
            (`currency_options_items_not_supported`).
        currency:
          type: string
          pattern: ^[a-z]{3}$
          description: >-
            The currency the plan's amounts are in (ISO 4217, lower case).
            Defaults to the catalog's `currency`, or on POST /v1/plans the
            workspace's (set by its last catalog publish, `usd` before one). A
            change of currency is a new version. A customer's plan changes stay
            in their currency (`currency_not_offered` for a plan without a price
            in it).
        monthlyCredits:
          type: integer
          minimum: 0
          description: >-
            Credits granted at the start of each allowance period (each month,
            unless resetInterval is year). 0 for a plan with only items, or with
            pay-as-you-go credits. At most 2,147,483,647: $21,474.83 at 100,000
            credits per dollar.
        billingInterval:
          type: string
          enum:
            - month
            - year
            - one_off
          description: >-
            How often the plan bills: `month` (the default) or `year`. An annual
            plan is a separate plan from its monthly version.
        resetInterval:
          type: string
          enum:
            - month
            - year
            - never
          description: >-
            How often monthlyCredits and metered items are granted again:
            `month` (the default) or `year`. An annual plan that resets monthly
            grants its allowance every month of the year it was paid for.
        priceCents:
          type: integer
          minimum: 0
          maximum: 2147483647
          description: >-
            Price in US cents per billing interval: a year's price on an annual
            plan. 0 makes a free plan. Required unless monthlyPriceCents is
            sent.
        monthlyPriceCents:
          type: integer
          minimum: 0
          maximum: 2147483647
          description: >-
            The older name for priceCents, accepted on monthly plans only.
            Listed for monthly plans.
        overageUnitAmountCents:
          type:
            - integer
            - 'null'
          maximum: 2147483647
          exclusiveMinimum: 0
          description: >-
            Price in cents per overageBillingUnits credits used after the plan's
            credits and packs run out. Null or omitted: no overage.
        overageBillingUnits:
          type: integer
          exclusiveMinimum: 0
          maximum: 2147483647
          description: Credits billed per overageUnitAmountCents. Defaults to 1.
        overageCapCents:
          type:
            - integer
            - 'null'
          minimum: 0
          maximum: 2147483647
          description: >-
            Default monthly overage spend cap in cents. A customer's own cap
            replaces it. Null or omitted: no cap.
        overageTiers:
          type:
            - array
            - 'null'
          items:
            type: object
            properties:
              upTo:
                type:
                  - integer
                  - 'null'
                maximum: 2147483647
                exclusiveMinimum: 0
                description: >-
                  The band's last billed unit; null for the last band, which has
                  no limit.
              unitAmountCents:
                type: integer
                maximum: 2147483647
                exclusiveMinimum: 0
                description: Price in cents per billed unit in this band.
              flatAmountCents:
                type: integer
                minimum: 0
                maximum: 2147483647
                description: A flat amount billed once the band is reached. Defaults to 0.
            required:
              - upTo
              - unitAmountCents
            additionalProperties: false
          description: >-
            Bands for the period's overage instead of one rate, over billed
            units (overage rounded up to the billing units), ascending, the last
            with upTo null. overageUnitAmountCents must be sent as the first
            band's rate. The invoice bills one line per band reached.
        overageTiersMode:
          type:
            - string
            - 'null'
          enum:
            - graduated
            - volume
            - null
          description: >-
            With overageTiers: `graduated` (the default) prices each band's
            units at its rate; `volume` prices every unit at the rate of the
            band the period's total reaches. Null or omitted without tiers.
        rollover:
          type:
            - object
            - 'null'
          properties:
            maxCredits:
              type:
                - integer
                - 'null'
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                The most rolled-over credits (or units, on an item) live at
                once. Send this or maxPercent.
            maxPercent:
              type:
                - integer
                - 'null'
              minimum: 1
              maximum: 100
              description: >-
                The most rolled over as a percent of one period's allowance, 1
                to 100. Send this or maxCredits.
            periods:
              type:
                - integer
                - 'null'
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                How many allowance periods a rolled grant lasts. Defaults to 1
                (it ends with the next period); null keeps it until used.
          additionalProperties: false
          description: >-
            Unused monthlyCredits carried into the next allowance period, up to
            a maximum, and spent first. Null or omitted: they end with the
            period. A change publishes a new plan version.
        autoTopUp:
          type:
            - object
            - 'null'
          properties:
            thresholdCredits:
              type: integer
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                Buy when the shared balance's available credits fall below this.
                Above 0.
            addOnId:
              type:
                - string
                - 'null'
              minLength: 1
              maxLength: 100
              description: The credit pack to buy. Send this or amountCents.
            amountCents:
              type:
                - integer
                - 'null'
              exclusiveMinimum: 0
              maximum: 99999999
              description: >-
                Or an amount to buy, in cents, at the catalog's top-up rate.
                Within topUps.minCents and maxCents.
            maxPerPeriod:
              type: integer
              minimum: 1
              maximum: 31
              description: The most automatic top-ups per billing period, 1 to 31.
            maxAmountCentsPerPeriod:
              type:
                - integer
                - 'null'
              exclusiveMinimum: 0
              maximum: 99999999
              description: >-
                The most automatic top-ups may charge per billing period, in
                cents. Null or omitted: no money limit.
          required:
            - thresholdCredits
            - maxPerPeriod
          additionalProperties: false
          description: >-
            The plan's auto top-up default: below thresholdCredits, buy a credit
            pack or an amount with the saved card. A customer's own setting
            replaces it. A change publishes a new plan version.
        ignorePastDue:
          type: boolean
          description: >-
            While a subscriber's payment is past due, keep overage and renewal
            grants as if the plan were active. Applies to every version in
            place. A customer's own setting replaces it. Defaults to false.
        customOnly:
          type: boolean
          description: >-
            Only for custom deals: attach needs `customize` with this customer's
            terms, and a plain attach is refused `422 plan_requires_customize`.
            Applies to every version in place. Defaults to false.
        items:
          type: array
          items:
            $ref: '#/components/schemas/PlanItemInput'
          description: >-
            What the plan includes of each metered, held and boolean feature,
            and credits features it makes unlimited. At most one per feature. A
            change publishes a new plan version.
        trial:
          type:
            - object
            - 'null'
          properties:
            days:
              type: integer
              minimum: 1
              maximum: 365
              description: 'How long the trial lasts: 1 to 365 days.'
            cardRequired:
              type: boolean
              description: >-
                true (the default): the customer gives a card, Stripe holds the
                trial and bills at its end. false: no card and no Stripe
                subscription during the trial.
            onEnd:
              type: string
              enum:
                - bill
                - revert
              description: >-
                What happens when the trial ends: `bill` starts charging (the
                default with a card); `revert` goes back to the plan the
                customer had before, or to none (the default without a card).
            credits:
              type: integer
              minimum: 0
              maximum: 2147483647
              description: >-
                Credits granted to the pool for the trial. Defaults to
                monthlyCredits.
          required:
            - days
          additionalProperties: false
          description: >-
            A free trial when a customer first starts the plan, once per
            customer and plan. Not on a one-off plan (`trial_not_supported`).
            Null or omitted: no trial. A change publishes a new plan version.
        group:
          type: string
          pattern: ^[a-z0-9][a-z0-9_-]{0,59}$
          description: >-
            The plan's product line: `default` when omitted. A customer will
            hold one base plan per group; today upgrades and downgrades stay
            within the current plan's group. Add-ons have no group. A change
            publishes a new plan version. In a catalog, omitted means the
            default; on POST /v1/plans/{id}, omitted keeps the current version's
            value.
        addOn:
          type: boolean
          description: >-
            A recurring add-on, attached beside the customer's base plans: false
            when omitted. It recurs (no billingInterval one_off) and has no
            overage or group. Attach adds it to the customer's active paid plan
            of the same billing interval, prorated, and all its features apply.
            A change publishes a new plan version. In a catalog, omitted means
            the default; on POST /v1/plans/{id}, omitted keeps the current
            version's value.
        maxQuantity:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 2147483647
          description: >-
            Add-ons only: how many one customer or entity may hold. Null or
            omitted: 1. A change publishes a new plan version. In a catalog,
            omitted means the default; on POST /v1/plans/{id}, omitted keeps the
            current version's value.
        entityGrants:
          type: string
          enum:
            - own
            - pooled
          description: >-
            When the plan is attached to an entity: `own` (the default) grants
            its allowances to the entity alone; `pooled` adds them to the
            customer's shared pool. A change publishes a new plan version. In a
            catalog, omitted means the default; on POST /v1/plans/{id}, omitted
            keeps the current version's value.
        licenses:
          type: array
          items:
            $ref: '#/components/schemas/PlanLicense'
          description: >-
            Seats of other plans this plan sells, one license per seat plan. Not
            on an add-on or a one-off plan. A change publishes a new plan
            version. In a catalog, omitted means none; on POST /v1/plans/{id},
            omitted keeps the current version's licenses.
        prepaid:
          type:
            - object
            - 'null'
          properties:
            billingUnits:
              type: integer
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                Units in one pack: what the customer buys at a time, such as
                1000. 1 or more.
            unitAmountCents:
              type: integer
              maximum: 2147483647
              exclusiveMinimum: 0
              description: >-
                Price in US cents of one pack per billing interval of the plan,
                above 0.
            maxQuantity:
              type: integer
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                The most one customer may hold a period, the included units
                counted. Above them, by whole packs
                (`prepaid_max_below_included`, `prepaid_max_not_multiple`).
                Omitted: no maximum.
          required:
            - billingUnits
            - unitAmountCents
          additionalProperties: false
          description: >-
            The credit pool sold prepaid: credits past monthlyCredits in packs.
            Not on an add-on or a one-off plan. A change publishes a new plan
            version. In a catalog, omitted or null means none; on POST
            /v1/plans/{id}, omitted keeps the current version's and null removes
            it.
        controls:
          type:
            - object
            - 'null'
          properties:
            usageLimits:
              type: array
              items:
                $ref: '#/components/schemas/UsageLimit'
              maxItems: 50
              description: >-
                Caps over a window, applied in place to everyone on the plan (no
                new version).
            usageAlerts:
              type: array
              items:
                $ref: '#/components/schemas/UsageAlert'
              maxItems: 50
              description: >-
                usage_alert.triggered at thresholds, applied in place to
                everyone on the plan.
            overage:
              type: array
              items:
                $ref: '#/components/schemas/OverageControl'
              maxItems: 50
              description: >-
                Overage off, a free buffer, or record-only, per target. Money
                terms: a change publishes a new plan version.
          additionalProperties: false
          description: >-
            Usage limits, usage alerts and overage variants for everyone on the
            plan. Limits and alerts apply in place; overage entries publish a
            new plan version. A customer's or entity's own entry (POST
            /v1/customers/controls) replaces the plan's of the same key. In a
            catalog, omitted means none; on POST /v1/plans/{id}, omitted keeps
            the current controls.
        version:
          type:
            - integer
            - 'null'
          exclusiveMinimum: 0
          description: 'Read only: the version''s number as listed. Publish ignores it.'
        stripeSyncStatus:
          type:
            - string
            - 'null'
          enum:
            - pending
            - synced
            - failed
            - null
          description: 'Read only: listed, and ignored by publish.'
        versionLabel:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 60
          pattern: ^[a-zA-Z0-9._-]+$
          description: >-
            Your name for this version, such as 2026-q4: letters, numbers, `.`,
            `_` or `-`, not only digits. Unique among the plan's versions.
            Attach can name a version by it.
      required:
        - name
        - monthlyCredits
      additionalProperties: false
      description: >-
        The plan's next version, made but not sold: attach starts it only when
        named with planVersion, in Sandbox. Publish a catalog whose plan has the
        draft's terms (and no draft) to make it the active version.
    RewardInput:
      type: object
      properties:
        id:
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[a-zA-Z0-9_-]+$
          description: >-
            Your ID for the reward: letters, numbers, `_` or `-`. It can't be
            changed.
        name:
          type: string
          minLength: 1
          maxLength: 120
          description: Shown in the dashboard and as the coupon's name in Stripe.
        coupon:
          type: object
          properties:
            percentOff:
              type: number
              exclusiveMinimum: 0
              maximum: 100
              description: Percent off, above 0 and at most 100.
            amountOffCents:
              type: integer
              exclusiveMinimum: 0
              maximum: 2147483647
              description: A fixed amount off each discounted invoice, in US cents.
            duration:
              type: string
              enum:
                - once
                - repeating
                - forever
              description: >-
                `once`: the next invoice. `repeating`: every invoice for
                `durationMonths`. `forever`: until the subscription ends.
            durationMonths:
              type: integer
              minimum: 1
              maximum: 36
              description: '`repeating` only: 1 to 36 months.'
            planIds:
              type:
                - array
                - 'null'
              items:
                type: string
                minLength: 1
                maxLength: 100
              minItems: 1
              description: >-
                The paid plans it discounts, every version of each. Null: every
                paid plan, now and later. Usage (overage) and credit packs are
                never discounted.
          required:
            - duration
            - planIds
          additionalProperties: false
          description: >-
            What comes off: a percentage or an amount, for how long, on which
            plans. Send this or `grant`.
        grant:
          type: object
          properties:
            items:
              type: array
              items:
                $ref: '#/components/schemas/GrantItemInput'
              minItems: 1
              maxItems: 20
          required:
            - items
          additionalProperties: false
          description: >-
            What the customer gets instead: credits or a metered feature's
            units, granted when they redeem the code. Send this or `coupon`.
        maxRedemptions:
          type:
            - integer
            - 'null'
          exclusiveMinimum: 0
          maximum: 2147483647
          description: 'Redemptions across every code of the reward. Null: no limit.'
        redeemBy:
          type:
            - string
            - 'null'
          format: date-time
          description: No new redemptions after this time.
        oncePerCustomer:
          type: boolean
          description: >-
            A customer redeems the reward at most once, through any code.
            Defaults to true.
        promotionCodes:
          type: array
          items:
            $ref: '#/components/schemas/PromotionCodeInput'
          maxItems: 100
          description: >-
            The reward's catalog codes. Codes made with POST
            /v1/rewards/{rewardId}/promotion-codes are kept.
      required:
        - id
        - name
        - promotionCodes
      additionalProperties: false
    ReferralProgramInput:
      type: object
      properties:
        id:
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[a-zA-Z0-9_-]+$
          description: >-
            Your ID for the program: letters, numbers, `_` or `-`. It can't be
            changed.
        name:
          type: string
          minLength: 1
          maxLength: 120
          description: Shown in the dashboard.
        referrerRewardId:
          type: string
          minLength: 1
          maxLength: 100
          description: 'The reward the referrer gets: a coupon or a grant.'
        refereeRewardId:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 100
          description: >-
            The reward the new customer gets. Null or left out: only the
            referrer is rewarded.
        trigger:
          type: string
          enum:
            - signup
            - first_payment
          description: >-
            `signup`: both rewards when the referee redeems the code.
            `first_payment`: the referrer's reward (and a referee grant) when
            the referee first pays for a plan.
        planIds:
          type:
            - array
            - 'null'
          items:
            type: string
            minLength: 1
            maxLength: 100
          minItems: 1
          description: >-
            `first_payment` only: the paid plans whose first payment counts,
            every version of each. Null or left out: any paid plan.
        maxRewardsPerReferrer:
          type:
            - integer
            - 'null'
          exclusiveMinimum: 0
          maximum: 2147483647
          description: 'The most referrer rewards one referrer gets. Null: no limit.'
      required:
        - id
        - name
        - referrerRewardId
        - trigger
      additionalProperties: false
    TopUpSettings:
      type:
        - object
        - 'null'
      properties:
        minCents:
          type: integer
          exclusiveMinimum: 0
          maximum: 99999999
          description: The least one any-amount top-up may buy, in cents.
        maxCents:
          type: integer
          exclusiveMinimum: 0
          maximum: 99999999
          description: The most one any-amount top-up may buy, in cents.
        creditsPerUsd:
          type:
            - integer
            - 'null'
          exclusiveMinimum: 0
          maximum: 2147483647
          description: >-
            Credits one US dollar of top-up buys. Required for top-ups by amount
            on a credit pool that isn't in dollars.
      required:
        - minCents
        - maxCents
      additionalProperties: false
      description: 'Bounds for top-ups by amount. Null: customers can only buy credit packs.'
    InsufficientPermissionsError:
      type: object
      properties:
        error:
          type: string
          example: insufficient_permissions
        message:
          type: string
          description: >-
            What went wrong and what to do about it, for a person or an agent to
            read. Every Ledger error has one. The wording can change: branch on
            `error`, not on this text.
          example: >-
            No customer "user_123" exists in this environment. Create it with
            POST /v1/customers, or check that the API key is for the right
            environment.
        requiredScope:
          type: string
          example: customers:read
      required:
        - error
        - requiredScope
    RateLimitError:
      type: object
      properties:
        error:
          type: string
          example: rate_limited
        message:
          type: string
          description: >-
            What went wrong and what to do about it, for a person or an agent to
            read. Every Ledger error has one. The wording can change: branch on
            `error`, not on this text.
          example: >-
            No customer "user_123" exists in this environment. Create it with
            POST /v1/customers, or check that the API key is for the right
            environment.
      required:
        - error
    PlanControls:
      type: object
      properties:
        usageLimits:
          type: array
          items:
            $ref: '#/components/schemas/UsageLimit'
          maxItems: 50
          description: >-
            Caps over a window, applied in place to everyone on the plan (no new
            version).
        usageAlerts:
          type: array
          items:
            $ref: '#/components/schemas/UsageAlert'
          maxItems: 50
          description: >-
            usage_alert.triggered at thresholds, applied in place to everyone on
            the plan.
        overage:
          type: array
          items:
            $ref: '#/components/schemas/OverageControl'
          maxItems: 50
          description: >-
            Overage off, a free buffer, or record-only, per target. Money terms:
            a change publishes a new plan version.
      additionalProperties: false
    UsageLimit:
      type: object
      properties:
        featureId:
          type: string
          minLength: 1
          maxLength: 100
          description: >-
            A credits feature (counts uses: the track's quantity) or a metered
            feature (counts units). Send this or creditPool.
        creditPool:
          type: boolean
          description: >-
            Limit the shared credit pool: counts credits drawn by every credits
            feature, from grants and overage.
          const: true
        limit:
          type: integer
          exclusiveMinimum: 0
          maximum: 2147483647
          description: >-
            The most each window may use, above 0. A use that would pass it is
            refused whole with usage_limit_reached; one that lands on it is
            allowed.
        interval:
          type: string
          enum:
            - day
            - week
            - month
            - billing_period
          description: >-
            The window: a day, a week (from Monday in UTC), a month, or the
            billing period.
        anchor:
          type: string
          enum:
            - utc
            - billing_cycle
          description: >-
            Where windows start: `utc` calendar boundaries, or `billing_cycle`
            (from the subscription's billing anchor). Defaults to `utc` for day
            and week, `billing_cycle` for month. Ignored for billing_period.
        filter:
          type: object
          additionalProperties:
            anyOf:
              - type: string
                maxLength: 255
              - type: number
              - type: boolean
          description: >-
            Count only uses whose properties hold every pair. `true` and
            `"true"` differ; numbers compare as numbers.
      required:
        - limit
        - interval
      additionalProperties: false
    UsageAlert:
      type: object
      properties:
        featureId:
          type: string
          minLength: 1
          maxLength: 100
        creditPool:
          type: boolean
          const: true
        name:
          type: string
          minLength: 1
          maxLength: 100
          description: >-
            Unique per target on one level. A customer's alert replaces the
            plan's of the same name.
        type:
          type: string
          enum:
            - usage
            - usage_percentage
            - remaining
            - remaining_percentage
          description: >-
            usage: used this period crosses threshold upward. remaining: what's
            left crosses it downward. The _percentage forms are of the period's
            allowance (or of the usage limit).
        threshold:
          type: number
          exclusiveMinimum: 0
          maximum: 2147483647
        usageLimit:
          type: object
          properties:
            interval:
              type: string
              enum:
                - day
                - week
                - month
                - billing_period
            filter:
              type: object
              additionalProperties:
                anyOf:
                  - type: string
                    maxLength: 255
                  - type: number
                  - type: boolean
              description: >-
                Properties of this use, up to 20 keys (1 to 64 characters) with
                string, number or boolean values. Only matched against usage
                limit filters; not stored.
          required:
            - interval
          additionalProperties: false
          description: >-
            Alert on the window of this target's usage limit (same interval and
            filter) instead of the balance.
      required:
        - name
        - type
        - threshold
      additionalProperties: false
    OverageControl:
      type: object
      properties:
        featureId:
          type: string
          minLength: 1
          maxLength: 100
        creditPool:
          type: boolean
          const: true
        allowed:
          type: boolean
          description: >-
            false: no overage past the balance (a hard stop). Default: overage
            when the plan or item has an overage price. true without a price
            needs freeUnits.
        freeUnits:
          type: integer
          minimum: 0
          maximum: 2147483647
          description: >-
            Units (credits for the pool) past the balance each period that are
            recorded and never billed, before any priced overage.
        billOverage:
          type: boolean
          description: >-
            false: priced overage is recorded under the cap and never invoiced.
            Default true.
      additionalProperties: false
    PlanItemInput:
      type: object
      properties:
        featureId:
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[a-zA-Z0-9_-]+$
          description: The feature this item includes.
        included:
          type:
            - integer
            - 'null'
          minimum: 0
          description: >-
            For a metered feature, units granted each period; for a held
            feature, the most the customer may hold; for an AI feature with its
            own balance, credits of that balance each period. At most
            2,147,483,647. Leave out with unlimited, and for boolean, credits
            and pool AI features.
        unlimited:
          type: boolean
          description: >-
            No limit: uses are always allowed and never debited. The only field
            a credits or pool AI item takes, and it must be true there.
        overageUnitAmountCents:
          type:
            - integer
            - 'null'
          maximum: 2147483647
          exclusiveMinimum: 0
          description: >-
            Metered and own-balance AI items only: price in cents per
            overageBillingUnits units (credits, for AI) used past `included`,
            billed on the renewal invoice. Counts toward the customer's one
            overage cap. `included: 0` with a price is pay as you go. Null or
            omitted: no overage.
        overageBillingUnits:
          type: integer
          exclusiveMinimum: 0
          maximum: 2147483647
          description: Units billed per overageUnitAmountCents. Defaults to 1.
        overageTiers:
          type:
            - array
            - 'null'
          items:
            type: object
            properties:
              upTo:
                type:
                  - integer
                  - 'null'
                maximum: 2147483647
                exclusiveMinimum: 0
                description: >-
                  The band's last billed unit; null for the last band, which has
                  no limit.
              unitAmountCents:
                type: integer
                maximum: 2147483647
                exclusiveMinimum: 0
                description: Price in cents per billed unit in this band.
              flatAmountCents:
                type: integer
                minimum: 0
                maximum: 2147483647
                description: A flat amount billed once the band is reached. Defaults to 0.
            required:
              - upTo
              - unitAmountCents
            additionalProperties: false
          description: >-
            Bands for the period's overage instead of one rate, over billed
            units (overage rounded up to the billing units), ascending, the last
            with upTo null. overageUnitAmountCents must be sent as the first
            band's rate. The invoice bills one line per band reached.
        overageTiersMode:
          type:
            - string
            - 'null'
          enum:
            - graduated
            - volume
            - null
          description: >-
            With overageTiers: `graduated` (the default) prices each band's
            units at its rate; `volume` prices every unit at the rate of the
            band the period's total reaches. Null or omitted without tiers.
        price:
          $ref: '#/components/schemas/ItemPrice'
        trialIncluded:
          type:
            - integer
            - 'null'
          minimum: 0
          maximum: 2147483647
          description: >-
            Metered items only: units granted for the plan's trial instead of
            `included`. Null or omitted: `included`.
        rollover:
          type:
            - object
            - 'null'
          properties:
            maxCredits:
              type:
                - integer
                - 'null'
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                The most rolled-over credits (or units, on an item) live at
                once. Send this or maxPercent.
            maxPercent:
              type:
                - integer
                - 'null'
              minimum: 1
              maximum: 100
              description: >-
                The most rolled over as a percent of one period's allowance, 1
                to 100. Send this or maxCredits.
            periods:
              type:
                - integer
                - 'null'
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                How many allowance periods a rolled grant lasts. Defaults to 1
                (it ends with the next period); null keeps it until used.
          additionalProperties: false
          description: >-
            Metered items with included above 0 only: unused units carried into
            the next period, up to a maximum. Null or omitted: they end with the
            period.
        prepaid:
          type:
            - object
            - 'null'
          properties:
            billingUnits:
              type: integer
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                Units in one pack: what the customer buys at a time, such as
                1000. 1 or more.
            unitAmountCents:
              type: integer
              maximum: 2147483647
              exclusiveMinimum: 0
              description: >-
                Price in US cents of one pack per billing interval of the plan,
                above 0.
            maxQuantity:
              type: integer
              exclusiveMinimum: 0
              maximum: 2147483647
              description: >-
                The most one customer may hold a period, the included units
                counted. Above them, by whole packs
                (`prepaid_max_below_included`, `prepaid_max_not_multiple`).
                Omitted: no maximum.
          required:
            - billingUnits
            - unitAmountCents
          additionalProperties: false
          description: >-
            Metered items only, not unlimited: units past `included` sold in
            prepaid packs. Null or omitted: none.
      required:
        - featureId
      additionalProperties: false
    GrantItemInput:
      type: object
      properties:
        featureId:
          type: string
          minLength: 1
          maxLength: 100
          description: '`credits` for the shared credit pool, or a metered feature''s ID.'
        amount:
          type: integer
          exclusiveMinimum: 0
          maximum: 2147483647
          description: Credits, or the metered feature's units, above 0.
        expiresAfter:
          $ref: '#/components/schemas/GrantExpiresAfter'
      required:
        - featureId
        - amount
      additionalProperties: false
    PromotionCodeInput:
      type: object
      properties:
        code:
          type: string
          pattern: ^[A-Za-z0-9_-]{3,40}$
          description: >-
            What the customer types, such as `LAUNCH20`. Matched without case
            and stored in upper case. Unique among the environment's active
            codes.
        maxRedemptions:
          type:
            - integer
            - 'null'
          exclusiveMinimum: 0
          maximum: 2147483647
          description: 'How many times the code can be used. Null: no limit.'
        expiresAt:
          type:
            - string
            - 'null'
          format: date-time
          description: No new redemptions after this time.
        firstTimeOnly:
          type: boolean
          description: Only for a customer who has never paid for a plan or credit pack.
      required:
        - code
      additionalProperties: false
    ItemPrice:
      type:
        - object
        - 'null'
      properties:
        model:
          type: string
          enum:
            - per_unit
            - measured
          description: >-
            `per_unit`: billed per unit held (seats), in advance at the plan's
            interval, prorated when the count changes. `measured`: the amount
            held over each period, billed in arrears as unit-months (storage:
            100 GB for half a month is 50 GB-months), on the renewal invoice.
        billingUnits:
          type: integer
          maximum: 2147483647
          exclusiveMinimum: 0
          description: >-
            Measured prices: held units per billed unit, such as 1024 to bill a
            count in MB per GB-month. Defaults to 1.
        unitAmountCents:
          type:
            - integer
            - 'null'
          maximum: 2147483647
          exclusiveMinimum: 0
          description: >-
            Price in US cents per unit held, per billing interval. Leave out
            with tiers.
        tiers:
          type:
            - array
            - 'null'
          items:
            type: object
            properties:
              upTo:
                type:
                  - integer
                  - 'null'
                maximum: 2147483647
                exclusiveMinimum: 0
                description: >-
                  The band's last unit; null for the last band, which has no
                  limit.
              unitAmountCents:
                type: integer
                minimum: 0
                maximum: 2147483647
                description: Price in US cents per unit in this band.
            required:
              - upTo
              - unitAmountCents
            additionalProperties: false
          description: >-
            Bands instead of one unitAmountCents, ascending, the last with upTo
            null. A first band at 0 makes seats free.
        tiersMode:
          type:
            - string
            - 'null'
          enum:
            - graduated
            - volume
            - null
          description: >-
            With tiers: `graduated` (the default) prices each band's units at
            its rate; `volume` prices every unit at the rate of the band the
            count reaches.
        includedQuantity:
          type: integer
          minimum: 0
          maximum: 2147483647
          description: >-
            Units held free before unitAmountCents applies. Defaults to 0. With
            tiers, use a first band at 0.
        proration:
          type: object
          properties:
            onIncrease:
              type: string
              enum:
                - next_invoice
                - charge_now
                - none
              description: >-
                A rise in the count: prorated on the next invoice (the default),
                invoiced and charged now, or billed from the next period.
            onDecrease:
              type: string
              enum:
                - next_invoice
                - none
              description: >-
                A fall in the count: credited on the next invoice (the default),
                or not (the lower count bills from the next period).
          additionalProperties: false
      required:
        - model
      additionalProperties: false
    GrantExpiresAfter:
      type: object
      properties:
        days:
          type: integer
          minimum: 1
          maximum: 3650
        months:
          type: integer
          minimum: 1
          maximum: 120
      additionalProperties: false
      description: >-
        How long the granted units last from the redemption: `{ days }` or `{
        months }`. Left out: they never expire.
  responses:
    InsufficientPermissions:
      description: >-
        The API key works but lacks the permission this endpoint needs, named in
        requiredScope. See the API keys guide.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InsufficientPermissionsError'
    RateLimited:
      description: >-
        Too many requests. Wait Retry-After seconds, then retry. See the rate
        limits guide.
      headers:
        Retry-After:
          description: Seconds until a request is allowed again
          schema:
            type: integer
        RateLimit-Limit:
          description: 'The burst: requests allowed at once'
          schema:
            type: integer
        RateLimit-Remaining:
          description: Requests left right now
          schema:
            type: integer
        RateLimit-Reset:
          description: Seconds until the full burst is back
          schema:
            type: integer
        RateLimit-Policy:
          description: >-
            The sustained rate per second and the burst, such as
            200;w=1;burst=1000
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer

````

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