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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# Reactivar suscripción

> Devuelve una suscripción cancelada o completada al estado ACTIVE, conservando la misma suscripción y su historial.

Usa este endpoint para campañas de recuperación de clientes. Al llamarlo, una suscripción `CANCELED` o `COMPLETED`
vuelve a `ACTIVE` (o a `TRIALING` cuando una fase de prueba cubre el ciclo reactivado),
conservando el mismo `id` y todo su historial de pagos. Nunca se crea una suscripción sucesora
y esta llamada nunca define `previous_subscription_id`. La llamada en sí no genera ningún cobro.

> [!NOTE]
>
> **Solo organizaciones en la lista de permitidos**
>
> La reactivación se habilita por organización y esto se verifica antes que el estado de la suscripción. Si
> tus llamadas devuelven `409` `"Subscription reactivation is not enabled for this organization."`,
> contacta a tu representante de Yuno para que la habilite.

## Qué suscripciones se pueden reactivar

| `status` actual | Resultado |
| - | - |
| `CANCELED` | Se reactiva. |
| `COMPLETED` | Se reactiva, si quedan ciclos de facturación. Consulta [Cuando se agotan los ciclos de facturación](#when-the-billing-cycles-are-used-up) más abajo. |
| Cualquier otro estado | `409` `INVALID_SUBSCRIPTION_STATUS`, con el estado actual en `current_status`. Una suscripción `PAUSED` se reanuda con [Reanudar suscripción](https://docs.y.uno/es/reference/subscriptions/resume-subscription.md). |

```json 409 — status is not CANCELED or COMPLETED theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "code": "INVALID_SUBSCRIPTION_STATUS",
  "messages": [
    "Only a CANCELED or COMPLETED subscription can be reactivated."
  ],
  "current_status": "ACTIVE"
}
```

Una suscripción cuyo `availability.finish_at` ya pasó se rechaza con `400`
`INVALID_DATE`, sin importar su estado:

```json 400 — availability window already closed theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "code": "INVALID_DATE",
  "messages": [
    "The subscription can not be resume due to a conflict with the availability dates. Please update availability dates and try again if you want to keep using the subscription"
  ]
}
```

## Cuando se agotan los ciclos de facturación

Una suscripción `COMPLETED` que usó todos los ciclos de `billing_cycles.total` se rechaza con `409`
`INVALID_SUBSCRIPTION_STATUS`:

```json 409 — no billing cycles left theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "code": "INVALID_SUBSCRIPTION_STATUS",
  "messages": [
    "The subscription exhausted its 1 billing cycles. Send billing_cycles.total greater than 1 in the reactivate body."
  ],
  "current_status": "COMPLETED"
}
```

Envía `billing_cycles.total` con un valor mayor al actual para subir el límite y
reactivar en la misma llamada. Esto no crea una sucesora: sube el límite **en la misma
suscripción**, conservando su `id` y su historial intactos:

```json Raise the limit and reactivate theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "billing_cycles": { "total": 24 }
}
```

Al enviar `billing_cycles.total`:

| Condición | Resultado |
| - | - |
| No es mayor que el total actual | `400` `BAD_REQUEST`: `"billing_cycles.total must be greater than the current total (N)."` |
| La suscripción no tiene ningún límite de ciclos de facturación | `400` `BAD_REQUEST`: `"billing_cycles.total cannot be set on a subscription without a billing cycle limit."` |
| No es un entero positivo | `400` `BAD_REQUEST`: `"billing_cycles.total must be a positive integer."` |

Enviar `billing_cycles.total` para una suscripción que aún tiene ciclos disponibles se acepta de la misma
manera: sube el límite, no está restringido a suscripciones agotadas. Un
`billing_cycles.total: null` explícito se trata igual que omitir el campo: el total actual se mantiene
sin cambios.

## Elegir la próxima fecha de facturación

`billing_cycle_behavior` es el mismo eje que se usa al reanudar y en los cambios de plan.

```json KEEP (default, or omitted) theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{ "billing_cycle_behavior": "KEEP" }

// billing_cycles.next_at -> unchanged while it is still in the future,
// otherwise rolled forward to its next future occurrence
```

```json RESTART theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{ "billing_cycle_behavior": "RESTART" }

// billing_cycles.next_at -> the reactivation instant plus the subscription's frequency
// frequency.monthly_billing_day -> stamped to the day of the reactivation,
// on a monthly subscription that had none
```

En ambos casos la llamada no genera ningún cobro. Un valor no válido devuelve `400` `BAD_REQUEST`:
`"billing_cycle_behavior must be one of KEEP, RESTART."` Reactivar no tiene validación propia en el gateway:
el mismo texto vuelve sin cambios a través del gateway.

> [!NOTE]
>
> **RESTART y el día de facturación mensual**
>
> En una suscripción mensual que no tenía definido `frequency.monthly_billing_day`, `RESTART` lo fija
> al día de la reactivación, la misma regla que aplican Actualizar suscripción y Reanudar suscripción. Una
> suscripción que ya declara un día de facturación lo conserva.

## El método de pago

El método de pago almacenado se revalida antes de reactivar la suscripción. Si ya no
está inscrito, la llamada devuelve `400` `PAYMENT_METHOD_STATUS_INVALID` y la suscripción no se
modifica: la verificación del método de pago se ejecuta antes de escribir el estado:

```json 400 — payment method no longer enrolled theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "code": "PAYMENT_METHOD_STATUS_INVALID",
  "messages": [
    "The payment method is a state that does not allow payments to be made."
  ]
}
```

## Qué borra la reactivación

Al reactivar una suscripción se borra lo siguiente:

* `cancellation_time`
* `cancellation_source`
* `ending_time`
* `reason`
* cualquier cancelación programada (`cancel_scheduled`)
* cualquier pausa programada para terminar por sí sola: una suscripción reactivada nunca conserva
  `pause_until`

El webhook `subscription.reactivate` se envía una sola vez y lleva la suscripción reactivada.

## Errores

| HTTP | `code` | Cuándo |
| - | - | - |
| `409` | `INVALID_SUBSCRIPTION_STATUS` | La reactivación no está habilitada para la organización. |
| `409` | `INVALID_SUBSCRIPTION_STATUS` | El estado de la suscripción no es `CANCELED` ni `COMPLETED`. |
| `409` | `INVALID_SUBSCRIPTION_STATUS` | La suscripción usó todos los ciclos de facturación de `billing_cycles.total` y la solicitud no lo subió. |
| `400` | `INVALID_DATE` | `availability.finish_at` ya pasó. |
| `400` | `BAD_REQUEST` | `billing_cycles.total` no es mayor que el total actual, se envía en una suscripción sin límite de ciclos o no es un entero positivo. |
| `400` | `BAD_REQUEST` | `billing_cycle_behavior` no es `KEEP` ni `RESTART`. |
| `400` | `BAD_REQUEST` | Una clave de nivel superior no reconocida, detectada por el propio binding JSON del gateway antes de que la llamada llegue al motor: `"Bad request"` |
| `400` | `BAD_REQUEST` | Una clave distinta de `total` dentro de `billing_cycles`, reenviada tal cual al motor y rechazada allí: `"Unknown field(s): foo."` |
| `400` | `PAYMENT_METHOD_STATUS_INVALID` | El método de pago almacenado ya no está inscrito. |
| `400` | `OPERATION_IN_PROCESS` | Otra escritura sobre la misma suscripción sigue en curso: `"Operation over the same subscription is already in process. Try again in a few seconds."` |


## OpenAPI

````yaml openapi/es/subscriptions/reactivate-subscription.json POST /subscriptions/{subscription_id}/reactivate
openapi: 3.1.0
info:
  title: subscription
  version: 1.0.2
servers:
  - url: https://api-sandbox.y.uno/v1
  - url: https://api.y.uno/v1
security:
  - sec0: []
    sec1: []
paths:
  /subscriptions/{subscription_id}/reactivate:
    post:
      summary: Reactivate Subscription
      operationId: reactivate-subscription
      parameters:
        - name: subscription_id
          in: path
          description: Identificador único de una suscripción.
          schema:
            type: string
          required: true
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                billing_cycle_behavior:
                  type: string
                  enum:
                    - KEEP
                    - RESTART
                  description: >-
                    RESTART reubica el próximo cobro en ahora más la frecuencia
                    de la suscripción (y registra frequency.monthly_billing_day
                    en una suscripción mensual que no tenía uno). KEEP u
                    omitido: el ancla almacenada no se modifica mientras siga en
                    el futuro; de lo contrario, avanza a su próxima ocurrencia
                    futura. En ambos casos la llamada no realiza ningún cobro.
                  example: RESTART
                billing_cycles:
                  type: object
                  description: >-
                    Aumenta el límite de ciclos de la suscripción para poder
                    reactivarla. Solo se permite el total anidado.
                  properties:
                    total:
                      type: integer
                      description: >-
                        Debe ser un entero positivo mayor que el
                        billing_cycles.total actual de la suscripción. Se
                        rechaza en una suscripción sin ningún límite de ciclos.
                        Un valor válido aumenta el límite en la misma
                        suscripción.
                      example: 12
            examples:
              RESTART:
                value:
                  billing_cycle_behavior: RESTART
              RAISE THE BILLING CYCLES LIMIT:
                value:
                  billing_cycles:
                    total: 12
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                REACTIVATE SUBSCRIPTION:
                  value:
                    id: 7304911d-5df9-429e-8488-ad41abea1a4c
                    name: SUB-111 merchant reactivate subject
                    account_id: 2404911d-5df9-429e-8488-ad41abea1a4b
                    country: CO
                    description: null
                    merchant_reference: pa-sub111-1789488115936-594232
                    status: ACTIVE
                    amount:
                      currency: COP
                      value: 45000
                    frequency:
                      type: MONTH
                      value: 1
                    billing_cycles:
                      total: 6
                      current: 2
                      paid: 0
                      next_at: '2026-10-15T16:01:56.709393Z'
                    customer_payer:
                      id: 3t04911d-5df9-429e-8488-ad41abea1a2c
                    payment_method:
                      type: CARD
                      vaulted_token: 6104911d-5df9-429e-8488-ad41abea1a4b
                      card:
                        installments: null
                        network_transaction_id: '615803391389209'
                        usage: USED
                    availability:
                      start_at: '2026-09-15T16:01:56.709393Z'
                      finish_at: null
                    retries:
                      retry_on_decline: false
                      amount: 6
                      strategy: SMART
                      schedule: null
                      stop_on_hard_decline: null
                      cancel_on_exhausted_retries: null
                    metadata: null
                    additional_data: null
                    trial_period:
                      billing_cycles: 1
                      amount:
                        value: 0
                        currency: ''
                    initial_payment_validation: false
                    reason: null
                    subscription_agreement_id: null
                    soft_descriptor: null
                    renewal_notification_days: null
                    cancellation_time: null
                    cancellation_source: null
                    ending_time: null
                    created_at: '2026-09-15T16:01:56.709393Z'
                    updated_at: '2026-09-15T16:01:58.115702Z'
                    pending_plan_change: null
                    current_period_start: '2026-09-15T16:01:56.709393Z'
                    current_period_end: '2026-10-15T16:01:56.709393Z'
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: 7304911d-5df9-429e-8488-ad41abea1a4c
                  name:
                    type: string
                    example: sub_001
                  description:
                    type: string
                    example: streaming service
                    nullable: true
                  account_id:
                    type: string
                    example: 2404911d-5df9-429e-8488-ad41abea1a4b
                  country:
                    type: string
                    description: El país de la suscripción (ISO 3166-1 alpha-2).
                    example: US
                  merchant_reference:
                    type: string
                    example: 001_marzo_23
                  soft_descriptor:
                    type: string
                    example: ACME SUBSCRIPTION
                    nullable: true
                  status:
                    type: string
                    example: ACTIVE
                  amount:
                    type: object
                    properties:
                      currency:
                        type: string
                        example: USD
                      value:
                        type: number
                        example: 12100
                        default: 0
                  frequency:
                    type: object
                    properties:
                      type:
                        type: string
                        example: MONTH
                      value:
                        type: integer
                        example: 1
                        default: 0
                      monthly_billing_day:
                        type: integer
                        nullable: true
                        description: >-
                          Día del mes al que se ancla la facturación en una
                          suscripción de frecuencia MONTH. Se establece con
                          RESTART (en Update, un cambio de plan, reanudar o
                          reactivar) o enviando el propio
                          frequency.monthly_billing_day de Update Subscription.
                          Solo está presente una vez establecido; está ausente,
                          no es null, antes de eso y en cualquier otro tipo de
                          frecuencia.
                        example: 15
                  billing_cycles:
                    type: object
                    properties:
                      total:
                        type: integer
                        example: 10
                        default: 0
                        nullable: true
                      current:
                        type: integer
                        example: 2
                        default: 0
                      next_at:
                        type: string
                        example: '2023-02-16T20:00:00.786342Z'
                      scheduling_date:
                        type: string
                        description: >-
                          Momento en que la instrucción de débito se entrega al
                          riel de Pix: `next_at` menos cuatro días. Solo está
                          presente en las suscripciones `PIX_AUTOMATIC` que Yuno
                          ejecuta, y solo cuando el margen de programación de
                          cuatro días está habilitado para la organización; en
                          cualquier otro caso está ausente, no es `null`. Solo
                          lectura. Consulta [Pix
                          Automático](/es/docs/payment-features/subscriptions/pix-automatico#the-scheduling-date).
                        example: '2026-11-27T00:00:00Z'
                      paid:
                        type: integer
                        description: >-
                          Cuántos ciclos se han pagado hasta ahora. Distinto de
                          `current`, que es el ciclo que se está facturando.
                  current_period_start:
                    type: string
                    nullable: true
                    description: >-
                      Inicio del período de facturación en el que está la
                      suscripción actualmente, una cadencia antes de
                      `current_period_end`. Dentro de una prueba o de cualquier
                      otra fase del plan, sigue la cadencia de esa fase. Una
                      suscripción terminal (`CANCELED` o `COMPLETED`) conserva
                      su ventana final en lugar de pasar a null. Es null solo
                      para una suscripción sin cadencia recurrente. Siempre se
                      devuelve junto con current_period_end.
                    example: '2023-01-16T20:00:00.912480Z'
                  current_period_end:
                    type: string
                    nullable: true
                    description: >-
                      Fin del período de facturación en el que está la
                      suscripción actualmente. Es igual a
                      billing_cycles.next_at. Siempre se devuelve junto con
                      current_period_start.
                    example: '2023-02-16T20:00:00.786342Z'
                  billing_date:
                    type: object
                    nullable: true
                    description: >-
                      Solo está presente en suscripciones facturadas en una
                      fecha fija en lugar de una frecuencia; es mutuamente
                      excluyente con `frequency`.
                    properties:
                      type:
                        type: string
                        example: DAY
                      day:
                        type: integer
                        example: 2
                  customer_payer:
                    type: object
                    properties:
                      id:
                        type: string
                        example: 3t04911d-5df9-429e-8488-ad41abea1a2c
                  payment_method:
                    type: object
                    properties:
                      type:
                        type: string
                        example: CARD
                      vaulted_token:
                        type: string
                        example: 6104911d-5df9-429e-8488-ad41abea1a4b
                      card:
                        type: object
                        properties:
                          installments:
                            type: integer
                            nullable: true
                          network_transaction_id:
                            type: string
                            nullable: true
                          usage:
                            type: string
                            example: FIRST
                        nullable: true
                  availability:
                    type: object
                    properties:
                      start_at:
                        type: string
                        example: '2024-01-16T00:00:00.786342Z'
                      finish_at:
                        type: string
                        example: '2024-05-26T20:00:00.786342Z'
                        nullable: true
                  retries:
                    type: object
                    nullable: true
                    description: >-
                      La política de reintentos que se aplica cuando se rechaza
                      un cobro recurrente. Consulta
                      [Reintentos](/es/docs/payment-features/subscriptions/retries).
                    properties:
                      retry_on_decline:
                        type: boolean
                        description: Indica si los cobros rechazados se reintentan o no.
                        example: true
                      amount:
                        type: integer
                        description: >-
                          Cuántos reintentos tiene un ciclo de facturación.
                          Limitado por la longitud del calendario de reintentos
                          de tu entorno (6 en producción).
                        example: 4
                      strategy:
                        type: string
                        description: >-
                          Cómo se decide el momento de cada reintento:
                          `DEFAULT`, `SMART` o `CUSTOM_SCHEDULE`. Trátalo como
                          un valor abierto: maneja los valores no reconocidos de
                          forma adecuada.
                        example: DEFAULT
                      schedule:
                        type: array
                        nullable: true
                        description: >-
                          El calendario por intento, que solo se define cuando
                          `strategy` es `CUSTOM_SCHEDULE`; en caso contrario es
                          `null`.
                        items:
                          type: object
                      stop_on_hard_decline:
                        type: boolean
                        nullable: true
                        description: >-
                          Cuando es true, un rechazo definitivo detiene los
                          reintentos del ciclo de facturación actual.
                      cancel_on_exhausted_retries:
                        type: boolean
                        nullable: true
                        description: >-
                          Cuando es true, la suscripción se cancela cuando
                          terminan los reintentos de un ciclo sin un pago
                          exitoso, con `cancellation_source` definido como
                          `RETRIES_EXHAUSTED`.
                      profile:
                        type: string
                        description: >-
                          La escalera de reintentos fija que sigue la
                          suscripción en lugar del calendario configurable.
                          Siempre es `PIX_AUTOMATIC`. Este campo y los tres
                          siguientes solo están presentes en las suscripciones
                          `PIX_AUTOMATIC` que ejecuta Yuno; están ausentes, no
                          son `null`, en cualquier otro método de pago. Consulta
                          [Pix
                          Automático](/es/docs/payment-features/subscriptions/pix-automatico#the-retry-ladder).
                        example: PIX_AUTOMATIC
                      max_attempts:
                        type: integer
                        description: >-
                          Cuántos reintentos ejecuta la escalera de Pix. Siempre
                          es 3, igual que el `amount` informado para estas
                          suscripciones.
                        example: 3
                      min_gap_hours:
                        type: integer
                        description: >-
                          Siempre 24: el intervalo entre las fechas de débito de
                          la escalera (`D`, `D+1`, `D+2`, `D+3`), no entre los
                          intentos de envío.
                        example: 24
                      until:
                        type: string
                        description: >-
                          Cuándo se detiene la escalera:
                          `billing_cycles.next_at` más 7 días. Se mueve con
                          `next_at` en cada renovación.
                      stopped:
                        type: boolean
                        description: >-
                          Solo está presente cuando la suscripción está en
                          PAST_DUE o tiene cancel_scheduled pendiente.
                      attempts_made:
                        type: integer
                        description: >-
                          Solo está presente cuando la suscripción está en
                          PAST_DUE o tiene cancel_scheduled pendiente.
                      outcome:
                        type: string
                        description: >-
                          RECOVERED, EXHAUSTED o ABANDONED. Solo está presente
                          cuando la suscripción está en PAST_DUE o tiene
                          cancel_scheduled pendiente.
                      next_retry_at:
                        type: string
                        description: >-
                          Solo está presente cuando la suscripción está en
                          PAST_DUE o tiene cancel_scheduled pendiente.
                  trial_period:
                    type: object
                    properties:
                      billing_cycles:
                        type: integer
                        example: 1
                        default: 0
                      amount:
                        type: object
                        properties:
                          value:
                            type: number
                            example: 0
                            default: 0
                          currency:
                            type: string
                            example: ''
                  metadata:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                          example: sub_ext_id
                        value:
                          type: string
                          example: AA001
                    nullable: true
                  additional_data:
                    type: object
                    nullable: true
                    description: >-
                      El enriquecimiento opcional de la orden enviada en la
                      creación, devuelto tal cual. Consulta [El objeto
                      Suscripción](/es/reference/subscriptions/the-subscription-object)
                      para ver su estructura completa.
                  initial_payment_validation:
                    type: boolean
                    description: >-
                      Indica si la suscripción esperó a que su primer pago fuera
                      exitoso antes de activarse. Es `false` por defecto.
                    example: false
                  reason:
                    type: string
                    nullable: true
                    description: >-
                      Motivo libre del estado actual de la suscripción, cuando
                      se registró uno; `null` en caso contrario.
                    example: merchant request
                  renewal_notification_days:
                    type: integer
                    nullable: true
                    description: >-
                      Cuántos días antes de la próxima fecha de facturación se
                      envía el webhook `subscription.close_to_renewal`. `null`
                      significa que no se envía ninguna notificación de
                      renovación.
                    example: 3
                  payments:
                    type: array
                    items:
                      type: string
                      example: 5104911d-5df9-229e-8468-bd41abea1a4s
                  subscription_agreement_id:
                    type: string
                    example: sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa
                    nullable: true
                  cancellation_time:
                    type: string
                    nullable: true
                    description: >-
                      Cuándo se canceló la suscripción. Solo se define una vez
                      que llega a `CANCELED`; `null` en caso contrario.
                    example: '2023-12-16T20:46:54.786342Z'
                  cancellation_source:
                    type: string
                    nullable: true
                    description: >-
                      Qué desencadenó la cancelación: `MERCHANT`, `SYSTEM`,
                      `PLAN_CHANGE` o `RETRIES_EXHAUSTED`. Solo se define una
                      vez que la suscripción llega a `CANCELED`; `null` en caso
                      contrario. Trátalo como un valor abierto: maneja los
                      valores no reconocidos de forma adecuada.
                    example: MERCHANT
                  ending_time:
                    type: string
                    nullable: true
                    description: >-
                      Cuándo se completó o expiró la suscripción. Solo se define
                      una vez que llega a `COMPLETED`; `null` en caso contrario.
                    example: '2024-12-16T20:46:54.786342Z'
                  plan_id:
                    type: string
                    description: >-
                      Solo está presente cuando la suscripción está vinculada a
                      un plan.
                    example: 00000000-0000-4000-8000-000000000001
                  plan_assigned_at:
                    type: string
                    description: >-
                      Solo está presente en suscripciones vinculadas a un plan.
                      El momento en que se asoció el plan: en la creación a
                      partir de un plan, en la migración a un plan o en un
                      cambio de plan.
                    example: '2023-12-16T20:46:54.786342Z'
                  previous_subscription_id:
                    type: string
                    description: >-
                      Solo está presente cuando esta suscripción se creó por un
                      cambio de plan (cambiar una suscripción existente a un
                      plan diferente).
                    nullable: true
                  phases:
                    type: array
                    description: >-
                      Las definiciones de fases del plan vinculado, tal como las
                      declara el plan, incluida la fase terminal `REGULAR`. Solo
                      está presente en suscripciones vinculadas a un plan que
                      tiene fases. Esta es la escalera propia del plan, no la
                      instantánea de este suscriptor: para lo que se fijó para
                      esta suscripción en la creación, usa `billing_phases`.
                    items:
                      type: object
                      properties:
                        order:
                          type: integer
                        name:
                          type: string
                        type:
                          type: string
                          description: '`TRIAL` o `REGULAR`.'
                        duration:
                          type: object
                          nullable: true
                          description: >-
                            Cuánto dura la fase. `null` en la fase terminal
                            `REGULAR`, que se ejecuta hasta que termina la
                            suscripción.
                          properties:
                            type:
                              type: string
                            value:
                              type: integer
                        frequency:
                          type: object
                          nullable: true
                          description: >-
                            Con qué frecuencia factura la fase. `null` en la
                            fase terminal `REGULAR`, que factura con la
                            frecuencia propia del plan.
                          properties:
                            type:
                              type: string
                            value:
                              type: integer
                        amount:
                          type: object
                          nullable: true
                          description: >-
                            El precio de la fase. `null` en la fase terminal
                            `REGULAR`, cuyo precio se resuelve a partir del plan
                            en cada facturación.
                          properties:
                            currency:
                              type: string
                            value:
                              type: number
                        total_payments:
                          type: integer
                          nullable: true
                        country_prices:
                          type: array
                          description: >-
                            Reemplazos del precio de la fase por país, vacío
                            cuando la fase no tiene ninguno.
                          items:
                            type: object
                            properties:
                              country:
                                type: string
                              amount:
                                type: object
                                properties:
                                  currency:
                                    type: string
                                  value:
                                    type: number
                  current_phase:
                    type: string
                    description: Solo está presente en suscripciones vinculadas a un plan.
                    example: REGULAR
                  current_phase_end:
                    type: string
                    nullable: true
                    description: >-
                      Cuándo la fase indicada por `current_phase` pasa a la
                      siguiente: para una suscripción en su prueba, cuándo
                      cambia al precio regular. Es el fin del último período de
                      facturación que cubre la fase, así que en el último
                      período de una prueba es igual a `current_period_end`. Es
                      null para una suscripción sin plan y para una que ya salió
                      de la escalera de fases.
                    example: '2023-03-16T20:00:00.786342Z'
                  billing_phases:
                    type: array
                    description: >-
                      Solo está presente en suscripciones vinculadas a un plan
                      cuyo plan tiene fases. Contiene únicamente las fases TRIAL
                      iniciales, capturadas en la creación; la fase terminal
                      REGULAR nunca se incluye, ya que su precio no se fija y se
                      resuelve a partir del plan en cada facturación.
                      `current_phase: "REGULAR"` es la señal de que la escalera
                      se agotó.
                    items:
                      type: object
                      properties:
                        order:
                          type: integer
                        type:
                          type: string
                          description: >-
                            Siempre TRIAL: la fase terminal REGULAR nunca está
                            en este arreglo.
                        name:
                          type: string
                        amount:
                          type: object
                          properties:
                            currency:
                              type: string
                            value:
                              type: number
                        frequency:
                          type: object
                          properties:
                            type:
                              type: string
                            value:
                              type: integer
                        start_cycle:
                          type: integer
                        end_cycle:
                          type: integer
                  pending_plan_change:
                    type: object
                    nullable: true
                    description: >-
                      El cambio de plan programado para el próximo ciclo de
                      facturación, o null cuando no hay ninguno pendiente.
                      Programa uno con el bloque `plan_change` en Update
                      Subscription.
                    properties:
                      plan_id:
                        type: string
                        description: El identificador del plan de destino.
                        example: 1904911d-5df9-429e-8488-ad41abea1a4d
                      plan_name:
                        type: string
                        description: El nombre del plan de destino.
                        example: Pro
                      direction:
                        type: string
                        enum:
                          - UPGRADE
                          - DOWNGRADE
                        description: >-
                          Indica si el plan de destino es una mejora o una
                          reducción de plan. Solo informativo.
                        example: UPGRADE
                      effective:
                        type: string
                        enum:
                          - NEXT_BILLING_CYCLE
                        description: Cuándo se aplica el cambio.
                        example: NEXT_BILLING_CYCLE
                      phases_behavior:
                        type: string
                        enum:
                          - START_FROM_REGULAR
                          - HONOR_PHASES
                        description: Qué ocurre cuando el plan de destino tiene fases.
                        example: START_FROM_REGULAR
                      applies_at:
                        type: string
                        description: >-
                          El evento de facturación en el que el cambio entrará
                          en vigor: la próxima fecha de facturación de la
                          suscripción.
                        example: '2023-02-16T20:00:00.786342Z'
                      requested_at:
                        type: string
                        description: Cuándo se programó el cambio.
                        example: '2023-01-20T10:12:31.786342Z'
                  created_at:
                    type: string
                    example: '2023-12-16T20:46:54.786342Z'
                  updated_at:
                    type: string
                    example: '2023-12-16T21:00:54.786342Z'
                  refund_rule:
                    type: object
                    description: >-
                      La regla de reembolso almacenada que se usa para resolver
                      un reembolso de cancelación CUSTOM cuando la solicitud de
                      cancelación no envía su propio refund_amount. Solo está
                      presente cuando hay una configurada; se omite, no es null,
                      en caso contrario. Disponible para las organizaciones
                      habilitadas; contacta a Yuno.
                    properties:
                      type:
                        type: string
                        enum:
                          - PERCENT
                          - FIXED
                        description: >-
                          PERCENT resuelve el reembolso como un porcentaje del
                          monto cobrado; FIXED lo resuelve como un monto fijo.
                        example: FIXED
                      percent:
                        type: number
                        description: >-
                          Obligatorio, y solo se permite, cuando type es PERCENT
                          (0-100).
                        example: 50
                      amount:
                        type: object
                        description: Obligatorio, y solo se permite, cuando type es FIXED.
                        properties:
                          value:
                            type: number
                            example: 10000
                          currency:
                            type: string
                            description: >-
                              Debe coincidir con la moneda propia de la
                              suscripción.
                            example: COP
                  pause_until:
                    type: string
                    description: >-
                      Cuándo está programado que la suscripción se reanude
                      automáticamente. Solo está presente en una suscripción
                      actualmente pausada con una duración (pause_cycles o
                      pause_until enviados al pausar); está ausente, no es null,
                      en cualquier otra lectura.
                    example: '2026-10-15T15:54:22.780166Z'
                  cancel_scheduled:
                    type:
                      - object
                      - 'null'
                    description: null cuando no hay ninguna cancelación pendiente.
                    properties:
                      mode:
                        type: string
                        example: AFTER_CYCLES
                      after_cycles:
                        type: integer
                        example: 3
                      at:
                        type: string
                      requested_at:
                        type: string
                      past_due_behavior:
                        type: string
                        example: EXHAUST_RETRIES
                  refund:
                    type:
                      - object
                      - 'null'
                    description: >-
                      null cuando refund fue NONE o se omitió. Está presente en
                      la respuesta de cancelación y en cada lectura posterior
                      una vez calculado.
                    properties:
                      mode:
                        type: string
                        example: PRORATED
                      amount:
                        type: object
                        properties:
                          currency:
                            type: string
                            example: USD
                          value:
                            type: number
                            example: 20
                      unused_days:
                        type: integer
                        example: 20
                      period_days:
                        type: integer
                        example: 30
                      basis:
                        type: object
                        properties:
                          billing_cycle:
                            type: integer
                            example: 4
                          charged_amount:
                            type: object
                            properties:
                              currency:
                                type: string
                                example: USD
                              value:
                                type: number
                                example: 30
                          payment_id:
                            type: string
                            description: >-
                              null para una cotización de fase de $0 sin un pago
                              capturado.
                          charged_at:
                            type: string
                            description: >-
                              null para una cotización de fase de $0 sin un pago
                              capturado.
                      execution:
                        type: string
                        example: MERCHANT
                      quoted_at:
                        type: string
                  unpaid_cycle:
                    type: object
                    description: >-
                      Solo está presente cuando el ciclo de facturación actual
                      está en PAST_DUE y no se ha liquidado.
                    properties:
                      cycle_number:
                        type: integer
                      amount:
                        type: object
                        properties:
                          currency:
                            type: string
                          value:
                            type: number
                      attempts:
                        type: integer
                      last_failure_code:
                        type: string
        '400':
          description: '400'
          content:
            application/json:
              examples:
                INVALID_DATE:
                  value:
                    code: INVALID_DATE
                    messages:
                      - >-
                        The subscription can not be resume due to a conflict
                        with the availability dates. Please update availability
                        dates and try again if you want to keep using the
                        subscription
                  summary: >-
                    availability.finish_at is in the past. Sourced from
                    checks/YunoHttpErrorCode-v1.45.0.kt (the enum's default
                    text, which says "resume" verbatim) — not exercised by a
                    live capture.
                billing_cycles.total BELOW THE CURRENT TOTAL:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - >-
                        billing_cycles.total must be greater than the current
                        total (12).
                billing_cycles.total WITHOUT A CYCLE LIMIT:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - >-
                        billing_cycles.total cannot be set on a subscription
                        without a billing cycle limit.
                INVALID BILLING CYCLE BEHAVIOR:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - billing_cycle_behavior must be one of KEEP, RESTART.
                  summary: >-
                    Identical through the gateway — reactivate has no
                    gateway-side validation of its own.
                PAYMENT METHOD NO LONGER ENROLLED:
                  value:
                    code: PAYMENT_METHOD_STATUS_INVALID
                    messages:
                      - >-
                        The payment method is a state that does not allow
                        payments to be made.
                  summary: >-
                    Sourced from checks/YunoHttpErrorCode-v1.45.0.kt — not
                    exercised by a live capture.
                UNKNOWN TOP-LEVEL KEY:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - Bad request
                  summary: >-
                    An unrecognized top-level key is caught by the gateway's own
                    JSON binding (DisallowUnknownFields) before the call reaches
                    the engine. The engine's own guard says "Unknown field(s):
                    foo." instead — see UNKNOWN KEY INSIDE billing_cycles below.
                UNKNOWN KEY INSIDE billing_cycles:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - 'Unknown field(s): foo.'
                  summary: >-
                    billing_cycles is a field the gateway forwards raw, so a key
                    nested inside it reaches the engine unfiltered and is
                    refused by the engine's own unknown-key guard.
        '409':
          description: '409'
          content:
            application/json:
              examples:
                NOT ENABLED FOR THIS ORGANIZATION:
                  value:
                    code: INVALID_SUBSCRIPTION_STATUS
                    messages:
                      - >-
                        Subscription reactivation is not enabled for this
                        organization.
                  summary: >-
                    Sourced from
                    checks/SubscriptionService-v1.45.0-pause-resume-reactivate-cancel.kt
                    — the stg allow-list is `.*`, so this could not be captured
                    live.
                NOT TERMINAL:
                  value:
                    code: INVALID_SUBSCRIPTION_STATUS
                    messages:
                      - >-
                        Only a CANCELED or COMPLETED subscription can be
                        reactivated.
                    current_status: ACTIVE
                BILLING CYCLES EXHAUSTED:
                  value:
                    code: INVALID_SUBSCRIPTION_STATUS
                    messages:
                      - >-
                        The subscription exhausted its 1 billing cycles. Send
                        billing_cycles.total greater than 1 in the reactivate
                        body.
                    current_status: COMPLETED
                  summary: >-
                    Engine-only capture (row 756) — no merchant capture reaches
                    an exhausted subscription in this run; the body shape is
                    identical to the merchant NOT TERMINAL case.
      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>

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.