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

# Create a subscription plan

> Creates a reusable billing plan. Subscriptions are attached to a plan and inherit its interval, amount, and trial settings.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/subscriptions/plans
openapi: 3.0.0
info:
  title: PlugToPay API
  description: API to make payments easy in multiple gateways.
  version: 1.0.0
servers:
  - url: http://localhost:7701
    description: Test Server
security: []
paths:
  /api/v1/subscriptions/plans:
    post:
      tags:
        - Subscription Plans
      summary: Create a subscription plan
      description: >-
        Creates a reusable billing plan. Subscriptions are attached to a plan
        and inherit its interval, amount, and trial settings.
      operationId: aae912b400da256f0b393dfd78cf383e
      parameters:
        - $ref: '#/components/parameters/XClientId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              required:
                - name
                - amount
                - interval
              properties:
                name:
                  description: Display name for the plan (max 255 chars).
                  type: string
                  example: Basic Monthly
                description:
                  description: Optional description (max 1000 chars).
                  type: string
                  example: Access to all basic features.
                  nullable: true
                amount:
                  description: Plan price in cents (e.g. 2990 = R$29,90).
                  type: integer
                  example: 2990
                currency:
                  description: 3-letter ISO currency code. Defaults to BRL.
                  type: string
                  example: BRL
                  nullable: true
                interval:
                  description: Billing frequency.
                  type: string
                  enum:
                    - weekly
                    - monthly
                    - yearly
                  example: monthly
                interval_count:
                  description: >-
                    Number of intervals between charges (e.g. 3 + monthly =
                    every 3 months). Min 1, max 365.
                  type: integer
                  example: 1
                  nullable: true
                trial_period_days:
                  description: Free trial days before first charge (1–365).
                  type: integer
                  example: 7
                  nullable: true
                billing_day:
                  description: >-
                    Day of the month to charge (1–28). Defaults to the
                    subscription creation day.
                  type: integer
                  example: 5
                  nullable: true
                min_card_months:
                  description: >-
                    Minimum months the card must be valid at subscription
                    creation (1–120). Null or absent = no restriction.
                  type: integer
                  example: 3
                  nullable: true
              type: object
      responses:
        '201':
          description: Plan created
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/SubscriptionPlan'
                type: object
        '401':
          description: Unauthorized — Invalid API Key
        '422':
          description: Validation error
      security:
        - ApiKeyAuth: []
components:
  parameters:
    XClientId:
      name: x-client-id
      in: header
      description: Client identifier for the company in the request.
      required: true
      schema:
        type: string
        example: client_abc123
  schemas:
    SubscriptionPlan:
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          example: Basic Monthly
        description:
          type: string
          nullable: true
        amount:
          description: Plan price in cents
          type: integer
          example: 2990
        currency:
          type: string
          example: BRL
        interval:
          type: string
          enum:
            - weekly
            - monthly
            - yearly
          example: monthly
        interval_count:
          type: integer
          example: 1
          nullable: true
        trial_period_days:
          type: integer
          example: 7
          nullable: true
        billing_day:
          description: Day of the month to charge (1–28)
          type: integer
          example: 5
          nullable: true
        min_card_months:
          description: >-
            Minimum months the card must be valid at subscription creation; null
            = no restriction
          type: integer
          example: 3
          nullable: true
        is_active:
          type: boolean
          example: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Company API key. Send in the X-API-Key header.
      name: X-API-Key
      in: header

````