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

# Cancel Plan

> Cancels a plan and cascade-cancels every subscription currently linked to it.

<Danger>
  **Cascade cancellation is synchronous and immediate**

  Canceling a plan cancels every subscription on it right away — there's no way to cancel the plan without also canceling its subscribers. Check `affected_subscriptions` in the response to know how many were affected.

  Re-canceling an already-`CANCELED` plan is safe and re-runs the cascade — it returns `200` again, not an error. This is deliberate: it's the recovery path if a previous cascade partially failed to cancel some subscriptions, so retry a cancel call if you're unsure it fully completed. `INVALID_STATE` (`400`) is reserved for a plan status outside `ACTIVE`/`CANCELED`, which isn't currently reachable given those are the only two plan statuses.
</Danger>


## OpenAPI

````yaml openapi/plans/cancel-plan.json POST /plans/{plan_id}/status
openapi: 3.1.0
info:
  title: plans
  version: 1.0.0
servers:
  - url: https://api-sandbox.y.uno/v1
  - url: https://api.eu.y.uno/v1
security:
  - sec0: []
    sec1: []
paths:
  /plans/{plan_id}/status:
    post:
      summary: Cancel Plan
      description: >-
        The only supported status transition. Canceling a plan blocks new
        subscriptions AND synchronously cascade-cancels every subscription
        currently linked to it.
      operationId: cancel-plan
      parameters:
        - name: plan_id
          in: path
          description: The unique identifier of the plan.
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - status
              properties:
                status:
                  type: string
                  enum:
                    - CANCELED
            examples:
              Result:
                value:
                  status: CANCELED
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    id: 00000000-0000-4000-8000-000000000001
                    status: CANCELED
                    affected_subscriptions: 3
              schema:
                type: object
                properties:
                  id:
                    type: string
                  status:
                    type: string
                  affected_subscriptions:
                    type: integer
                    description: >-
                      The number of subscriptions that were cascade-canceled
                      along with the plan.
        '400':
          description: >-
            400. Reserved for a plan status outside ACTIVE/CANCELED — not
            currently reachable, since those are the plan's only two statuses
            today. Re-canceling an already-CANCELED plan does NOT hit this: it
            re-runs the cascade and returns 200.
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: INVALID_STATE
                    messages:
                      - >-
                        The subscription state does not support the action
                        requested.
                  summary: Result
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_STATE
                  messages:
                    type: array
                    items:
                      type: string
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: public-api-key
      x-default: <Your public-api-key>
    sec1:
      type: apiKey
      in: header
      name: private-secret-key
      x-default: <Your private-secret-key>

````