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

# Add a line to a plan

> Requires `write:billing`. Add a recurring product (e.g. another car's storage at $350/month) to a customer's existing plan. `amountCents` sets a custom price; a matching existing price is reused, otherwise one is created (hidden from the customer shop). Without `confirm`, nothing changes and the response has a plain-language `summary`, the plan `before` and `after`, and a `previewToken`. Calling again with the same arguments plus `confirm: true` and that `previewToken` applies the change. Takes effect with the next bill (no proration, nothing charged now). A stale token (the plan changed since the preview) is refused with 409; preview again.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/billing/subscriptions/{id}/add-item
openapi: 3.0.0
info:
  title: Car Storage Software API
  version: 1.2.0
  description: >-
    Team-scoped REST API for Car Storage Software. Authenticate with a team API
    key (`Authorization: Bearer <key>` or `x-api-key: <key>`) created under
    Settings → Integrations → API. Keys carry granular `read:*` / `write:*`
    scopes; read never implies write.
servers:
  - url: https://www.carstoragesoftware.com
security: []
paths:
  /api/v1/billing/subscriptions/{id}/add-item:
    post:
      tags:
        - Billing
      summary: Add a line to a plan
      description: >-
        Requires `write:billing`. Add a recurring product (e.g. another car's
        storage at $350/month) to a customer's existing plan. `amountCents` sets
        a custom price; a matching existing price is reused, otherwise one is
        created (hidden from the customer shop). Without `confirm`, nothing
        changes and the response has a plain-language `summary`, the plan
        `before` and `after`, and a `previewToken`. Calling again with the same
        arguments plus `confirm: true` and that `previewToken` applies the
        change. Takes effect with the next bill (no proration, nothing charged
        now). A stale token (the plan changed since the preview) is refused with
        409; preview again.
      parameters:
        - schema:
            type: string
            format: uuid
            description: Subscription id from `list_billing_subscriptions`.
          required: true
          description: Subscription id from `list_billing_subscriptions`.
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                productId:
                  type: string
                  format: uuid
                  description: Recurring product to add (from `list_billing_products`).
                amountCents:
                  type: integer
                  minimum: 0
                  maximum: 10000000
                  description: >-
                    Price per billing period in cents (e.g. 35000 = $350.00),
                    before tax and processing fees.
                priceId:
                  type: string
                  format: uuid
                  description: An existing price to use (alternative to `amountCents`).
                quantity:
                  type: integer
                  minimum: 1
                  maximum: 100
                carId:
                  type: string
                  format: uuid
                  description: Car this line bills for.
                confirm:
                  type: boolean
                  description: >-
                    Leave out (or false) to preview: nothing changes, and the
                    response has a `summary` and `previewToken`. With `confirm:
                    true` and that `previewToken`, the change is applied.
                previewToken:
                  type: string
                  maxLength: 100
                  description: >-
                    From the preview. Required with `confirm: true`; refused if
                    the plan or the change differs from what was previewed.
              required:
                - productId
      responses:
        '200':
          description: 'Preview (`applied: false`) or applied change (`applied: true`).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1BillingPlanChangeResult'
        '401':
          description: Missing, invalid, revoked, or expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: API key missing required scope, or API disabled for team.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: >-
            Payments aren't set up for this facility (no connected Stripe
            account).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: Request validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    V1BillingPlanChangeResult:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/V1BillingPlanChange'
      required:
        - data
    ApiError:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
        details:
          nullable: true
      required:
        - error
    V1BillingPlanChange:
      type: object
      properties:
        applied:
          type: boolean
          description: False for a preview (nothing changed); true once applied.
        summary:
          type: string
          description: Plain-language description to show the user before confirming.
        action:
          type: string
          description: Short form, e.g. `Add Valet at $50.00`.
        previewToken:
          type: string
          description: 'Pass back with `confirm: true` to apply exactly this change.'
        customerName:
          type: string
        currency:
          type: string
        interval:
          type: string
          description: Billing period, e.g. `month` or `3 months`.
        nextBillAt:
          type: string
          nullable: true
          description: When the change takes effect (next bill).
        before:
          type: object
          properties:
            lines:
              type: array
              items:
                type: object
                properties:
                  lineId:
                    type: string
                  productName:
                    type: string
                  unitAmountCents:
                    type: integer
                  quantity:
                    type: integer
                  carLabel:
                    type: string
                    nullable: true
                  change:
                    type: string
                    enum:
                      - added
                      - removed
                      - price_changed
                      - swapped_in
                      - swapped_out
                required:
                  - lineId
                  - productName
                  - unitAmountCents
                  - quantity
                  - carLabel
            totalCents:
              type: integer
          required:
            - lines
            - totalCents
        after:
          type: object
          properties:
            lines:
              type: array
              items:
                type: object
                properties:
                  lineId:
                    type: string
                  productName:
                    type: string
                  unitAmountCents:
                    type: integer
                  quantity:
                    type: integer
                  carLabel:
                    type: string
                    nullable: true
                  change:
                    type: string
                    enum:
                      - added
                      - removed
                      - price_changed
                      - swapped_in
                      - swapped_out
                required:
                  - lineId
                  - productName
                  - unitAmountCents
                  - quantity
                  - carLabel
            totalCents:
              type: integer
          required:
            - lines
            - totalCents
        newPriceWillBeCreated:
          type: boolean
        message:
          type: string
          description: Set once applied.
      required:
        - applied
        - summary
        - action
        - previewToken
        - customerName
        - currency
        - interval
        - nextBillAt
        - before
        - after
        - newPriceWillBeCreated
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Team API key from Settings → Integrations. Use `Authorization: Bearer
        <key>` or `x-api-key`.

````

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