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

# Create a Subscription Plan

> Use this API to create a new plan. Provide the planId, planName, and the plan type(PERIODIC/ON_DEMAND).



## OpenAPI

````yaml post /api/v2/subscription-plans
openapi: 3.0.0
info:
  title: Cashfree Subscription API
  description: >-
    Create and manage subscriptions and collect recurring payments from
    customers easily with Cashfree Subscriptions.
  version: v2
servers:
  - url: https://sandbox.cashfree.com
    description: Sandbox server
  - url: https://api.cashfree.com
    description: Production server
security: []
externalDocs:
  url: https://docs.cashfree.com/reference/postman-collection-1
  description: This url will have the information of all the APIs.
paths:
  /api/v2/subscription-plans:
    post:
      tags:
        - Subscription
      summary: Create a Subscription Plan
      description: >-
        Use this API to create a new plan. Provide the planId, planName, and the
        plan type(PERIODIC/ON_DEMAND).
      operationId: createSubscriptionPlan
      parameters:
        - name: X-Client-Id
          in: header
          required: true
          schema:
            type: string
            description: Client ID provided by Cashfree.
            example: asdf1234
        - name: X-Client-Secret
          in: header
          required: true
          schema:
            type: string
            description: Client Secret provided by Cashfree.
            example: qwer9876
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                planId:
                  type: string
                  description: Unique ID for the subscription plan.
                  example: '1682406696'
                planName:
                  type: string
                  description: Name of the subscription plan.
                  example: Plan 1682406656
                type:
                  type: string
                  description: The type of the subscription plan.
                  enum:
                    - PERIODIC
                    - ON_DEMAND
                  example: PERIODIC
                recurringAmount:
                  type: number
                  description: Recurring amount for the plan.
                  example: 10
                maxAmount:
                  type: number
                  description: Maximum amount for the plan.
                  example: 100
                intervals:
                  type: integer
                  description: Number of intervals for the periodic plan.
                  example: 1
                intervalType:
                  type: string
                  description: Interval type for the periodic plan.
                  enum:
                    - day
                    - week
                    - month
                    - year
                  example: month
      responses:
        '200':
          description: Subscription plan created successfully.
          content:
            application/json:
              examples:
                Periodic Plan:
                  value:
                    message: Plan created successfully
                    status: OK
                    data:
                      planId: '1682406696'
                      planName: Plan 1682406656
                      type: PERIODIC
                      currency: INR
                      amount: 10
                      maxAmount: 100
                      intervals: 1
                      intervalType: month
                      isActive: true
                      addedOn: '2023-04-25 13:50:17'
                On Demand Plan:
                  value:
                    message: Plan created successfully
                    status: OK
                    data:
                      planId: '1682222986'
                      planName: Plan 1682406656
                      type: ON_DEMAND
                      currency: INR
                      maxAmount: 100
                      isActive: true
                      addedOn: '2023-04-25 13:54:39'
        '400':
          description: Bad request due to invalid parameters or missing fields.
          content:
            application/json:
              examples:
                Invalid Plan ID:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: 'planId : allows only alpha numerics,dot,hyphen,underscore'
                Plan Already Exists:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: 'PlanId: 100 already exists'
                Missing Fields:
                  value:
                    status: ERROR
                    subCode: '400'
                    reason: >-
                      planId is missing in the request, planName is missing in
                      the request, type is missing in the request.
                Invalid Amount:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: Invalid Amount for Periodic Plan
                Invalid Interval Type:
                  value:
                    status: ERROR
                    subCode: '400'
                    message: Invalid Interval Type for Periodic Plan
                Payment Type Missing:
                  value:
                    status: ERROR
                    subCode: '400'
                    reason: paymentType is missing in the request.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: Status of the API call.
                    example: ERROR
                  message:
                    type: string
                    description: Error message.
                    example: Server encountered an unexpected condition.

````