> ## 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.

# Update a plan

> Update a plan with its complete editable body. A changed plan creates a new version for future Checkouts.

Updates one current plan. Supply the full editable body: `name`, positive `monthlyCredits`, and `monthlyPriceCents` in USD cents. The `id` stays in the URL. Repeating the same values returns `changed: false`; changed values return `changed: true` and create a new plan version.

New customers use the new version for Checkout. Existing subscriptions retain the version they already reference; an update does not move or rebill them. A paid version syncs to the selected environment's Stripe account and reports `stripeSync`. Changing the price to `0` creates a free version that can be assigned without Checkout. An unknown or archived ID returns `404 not_found`, and invalid amounts return `400 invalid_request`.

Use [Get a plan](https://docs.integrateledger.com/api-reference/plans/get.md) first if you need the current editable values, and see [Catalog](https://docs.integrateledger.com/catalog.md) for versioning and [Upgrade a paid plan](https://docs.integrateledger.com/api-reference/billing/upgrade.md) for changing an active customer's subscription.


## OpenAPI

````yaml openapi.json PUT /v1/plans/{id}
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/plans/{id}:
    put:
      tags:
        - Plans
      summary: Update a plan
      operationId: updatePlan
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 100
            pattern: ^[a-zA-Z0-9_-]+$
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePlanInput'
      responses:
        '200':
          description: Plan updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlanMutation'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '401':
          description: Invalid Ledger API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '404':
          description: Item not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '409':
          description: Item ID already exists or add-on Checkout is pending
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
      security:
        - ApiKey: []
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >-
            curl --request PUT
            'https://api.integrateledger.com/v1/plans/starter' \
              -H "Authorization: Bearer $LEDGER_API_KEY" \
              -H 'Content-Type: application/json' \
              --data '{"name":"Starter","monthlyCredits":200,"monthlyPriceCents":2900}'
        - lang: python
          label: Python SDK (source only)
          source: >-
            import os

            from ledger_sdk import Ledger


            ledger = Ledger(api_key=os.environ["LEDGER_API_KEY"])

            ledger.update_plan("starter", name="Starter", monthly_credits=200,
            monthly_price_cents=2900)
        - lang: typescript
          label: TypeScript SDK (source only)
          source: >-
            import { Ledger } from "@ledger/sdk";


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

            await ledger.updatePlan({ id: "starter", body: { name: "Starter",
            monthlyCredits: 200, monthlyPriceCents: 2900 } });
components:
  schemas:
    UpdatePlanInput:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
        monthlyCredits:
          type: integer
          exclusiveMinimum: 0
          maximum: 2147483647
        monthlyPriceCents:
          type: integer
          minimum: 0
          maximum: 2147483647
      required:
        - name
        - monthlyCredits
        - monthlyPriceCents
      additionalProperties: false
    PlanMutation:
      type: object
      properties:
        item:
          $ref: '#/components/schemas/PlanItem'
        changed:
          type: boolean
        stripeSync:
          type: string
          enum:
            - synced
            - pending
            - failed
            - awaiting_connection
      required:
        - item
        - changed
    PlanItem:
      type: object
      properties:
        id:
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[a-zA-Z0-9_-]+$
        name:
          type: string
          minLength: 1
          maxLength: 120
        monthlyCredits:
          type: integer
          exclusiveMinimum: 0
          maximum: 2147483647
        monthlyPriceCents:
          type: integer
          minimum: 0
          maximum: 2147483647
        stripeSyncStatus:
          type: string
          nullable: true
          enum:
            - pending
            - synced
            - failed
            - null
      required:
        - id
        - name
        - monthlyCredits
        - monthlyPriceCents
      additionalProperties: false
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer

````

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