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

# Create a plan

> Creates a plan within a plan group. Amount is in kobo. Set `trial_period_days` to give new subscribers a free trial before the first charge. Set `lookup_key` to a stable handle (e.g. `pro_monthly`) so your app can reference the plan by role instead of by UUID.




## OpenAPI

````yaml POST /v1/plans
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:
    post:
      tags:
        - Plans
      summary: Create a plan
      description: >
        Creates a plan within a plan group. Amount is in kobo. Set
        `trial_period_days` to give new subscribers a free trial before the
        first charge. Set `lookup_key` to a stable handle (e.g. `pro_monthly`)
        so your app can reference the plan by role instead of by UUID.
      operationId: create-plan
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - plan_group_id
                - name
                - amount_minor
                - billing_interval
                - lookup_key
              properties:
                plan_group_id:
                  type: string
                  example: pg_01JABC...
                name:
                  type: string
                  maxLength: 100
                  example: Pro
                amount_minor:
                  type: integer
                  description: Price in kobo. ₦5,000 = 500000.
                  example: 500000
                billing_interval:
                  type: string
                  enum:
                    - day
                    - week
                    - month
                    - year
                  example: month
                billing_interval_count:
                  type: integer
                  default: 1
                  description: e.g., 3 months = interval "month" + count 3
                  example: 1
                trial_period_days:
                  type: integer
                  default: 0
                  example: 14
                lookup_key:
                  type: string
                  pattern: ^[a-z0-9_]+$
                  description: >
                    **Required.** Stable handle (lowercase letters, numbers,
                    underscores), unique per tenant. Reference this instead of
                    the UUID. Reusing an existing key returns 409.
                  example: pro_monthly
      responses:
        '201':
          description: Plan created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
              example:
                object: plan
                id: pln_01JABC...
                name: Pro
                amount_minor: '500000'
                lookup_key: pro_monthly
                created_at: '2026-06-01T00:00:00Z'
        '409':
          description: lookup_key already in use for another plan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
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.

````