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

# Update a plan

> Updates a plan. Marketing fields (name, `lookup_key`, trial days, `active`) can always be changed. **Price and billing interval are immutable once the plan has subscribers** — attempting to change them returns 400 (`plan_immutable`). To change a price, create a new plan and migrate subscribers with a plan change.




## OpenAPI

````yaml PATCH /v1/plans/{id}
openapi: 3.0.3
info:
  title: Plinth API
  version: 0.9.0
  description: >
    Recurring billing for Nigerian SaaS — card charging, bank transfers via
    virtual accounts,

    proration, dunning, and recovery in one API.


    All amounts are in **kobo** (1/100th of a Naira). ₦5,000 = `500000`.
servers:
  - url: https://api.useplinth.com
    description: Production
  - url: http://localhost:7331
    description: Local development
security:
  - BearerAuth: []
tags:
  - name: Sandbox
    description: Create an isolated sandbox environment for testing. No auth required.
  - name: Customers
    description: Who you are billing. One customer can have multiple subscriptions.
  - name: Plans
    description: Plan groups and the plans within them. Customers subscribe to plans.
  - name: Subscriptions
    description: The recurring billing relationship between a customer and a plan.
  - name: Virtual Accounts
    description: Dedicated bank account numbers for customers who pay by transfer.
  - name: Invoices
    description: Created at each billing cycle. Tracks what a customer owes for a period.
  - name: Webhooks
    description: >-
      Register endpoints that receive signed, retried events. See Receiving
      webhooks.
  - name: Admin
    description: Test clock control, billing tick, and suspense resolution. Test-mode only.
paths:
  /v1/plans/{id}:
    patch:
      tags:
        - Plans
      summary: Update a plan
      description: >
        Updates a plan. Marketing fields (name, `lookup_key`, trial days,
        `active`) can always be changed. **Price and billing interval are
        immutable once the plan has subscribers** — attempting to change them
        returns 400 (`plan_immutable`). To change a price, create a new plan and
        migrate subscribers with a plan change.
      operationId: update-plan
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          example: pln_01JABC...
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  maxLength: 100
                amount_minor:
                  type: integer
                  description: Only allowed if the plan has no subscribers.
                billing_interval:
                  type: string
                  enum:
                    - day
                    - week
                    - month
                    - year
                billing_interval_count:
                  type: integer
                trial_period_days:
                  type: integer
                lookup_key:
                  type: string
                  nullable: true
                  pattern: ^[a-z0-9_]+$
                active:
                  type: boolean
                  description: Set false to archive.
      responses:
        '200':
          description: Plan updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
        '400':
          description: Immutable field change rejected (plan has subscribers)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: >-
                  Cannot change amount on a plan that already has subscriptions.
                  Create a new plan and migrate subscribers instead.
components:
  schemas:
    Plan:
      type: object
      properties:
        object:
          type: string
          enum:
            - plan
        id:
          type: string
          example: pln_01JABC...
        plan_group_id:
          type: string
          example: pg_01JABC...
        name:
          type: string
          example: Pro
        amount_minor:
          type: string
          description: Amount in kobo as a string. ₦5,000 = "500000".
          example: '500000'
        interval:
          type: string
          enum:
            - day
            - week
            - month
            - year
          example: month
        interval_count:
          type: integer
          example: 1
        trial_period_days:
          type: integer
          example: 14
        lookup_key:
          type: string
          nullable: true
          description: >
            Stable, human-meaningful handle for the plan (e.g. "pro_monthly").
            Unique per tenant. Reference this instead of the UUID so your app
            doesn't hardcode environment-specific ids.
          example: pro_monthly
        active:
          type: boolean
          description: >
            `false` when the plan is archived — hidden from the default plan
            list and closed to new subscriptions. Existing subscribers keep
            billing.
          example: true
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
          example: Not found
        code:
          type: string
          example: not_found
      required:
        - error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        Use `sk_test_` keys for sandbox. Use `sk_live_` keys for production.
        Obtain your key from the dashboard.

````