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

# Edit Subscription

<Note>
  All editable fields can only be modified if the subscription is in one of: `TRIALING`, `ACTIVE`, `UNPAID`, `PAUSED`
</Note>


## OpenAPI

````yaml POST /subscription/edit
openapi: 3.0.1
info:
  title: xPay API Store
  description: ''
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.xpaycheckout.com
security:
  - basicAuth: []
paths:
  /subscription/edit:
    post:
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/edit-subs-request'
        required: true
      responses:
        '200':
          description: Subscription edited successfully
        '400':
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
        pattern: ^[a-zA-Z0-9\-_:\.]+$
      description: >-
        A unique key for making the request idempotent. Must match pattern:
        `^[a-zA-Z0-9\-_:\.]+$`. See [Idempotent
        Requests](/developer-resources/idempotency) for more details.
      example: KG5LxwFBepaKHyUD
  schemas:
    edit-subs-request:
      type: object
      required:
        - subscriptionId
      properties:
        subscriptionId:
          type: string
          description: Unique identifier of the subscription
          example: sub_fooBOwYsaK50AEfK
        newAmount:
          type: integer
          format: int64
          description: >-
            New recurring amount for the subscription, if changed. The amount in
            lowest count unit. e.g.: For USD 1, amount is 100 representing 100
            cents (The minimum amount should be greater than 1 USD).
          example: 1000
        newCycleCount:
          type: integer
          format: int64
          description: New number of billing cycles for the subscription, if changed.
          example: 6
        newNextPaymentDate:
          type: integer
          format: int64
          description: >-
            New next payment date in epoch milliseconds, if changed. Future
            payments will be deducted at the frequency interval defined in the
            subscription, calculated from the new next payment date.
          example: 1753104947000
        interval:
          type: string
          description: >-
            The interval group between subscriptions.


            ⚠️ Please note: When editing interval, `intervalCount` and
            `newNextPaymentDate` must also be provided.
          enum:
            - DAY
            - WEEK
            - MONTH
            - YEAR
          example: MONTH
        intervalCount:
          type: integer
          format: int64
          description: >-
            The number of intervals between subscription billings. For example,
            `interval = MONTH` and `intervalCount = 3` bills every 3 months.


            ⚠️ Please note: When editing intervalCount, `interval` and
            `newNextPaymentDate` must also be provided.
          example: 2
    Error:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          type: string
          example: bad_request
        errorDescription:
          type: string
          example: Failed to read request
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````