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

# Update Subscription

> Updates a subscription's fields, including retroactively adding stored credential usage data.

> [!WARNING]
>
> **Subscription Transition**
>
> The fields `billing_cycles` and `availability.finish_at` have an impact on each other. If both are completed during the subscription creation, it will transition to the `COMPLETED` state upon reaching the nearest event defined in these fields, whether it is the billing cycle or the corresponding `finish_at`. They are independent end conditions: whichever is reached first completes the subscription.
>
> When the `availability` object is included, `finish_at` is applied as sent: omit it or send it as `null` and any previously set end date is removed, so the subscription becomes open-ended and keeps renewing until it is canceled. This means that when you update `availability.start_at`, you must include `finish_at` in the same request if you want to keep the end date. `start_at` does not behave this way: omitting it leaves the current start date unchanged. Omitting the whole `availability` object leaves both dates unchanged.
>
> Note that `availability.start_at` can only be moved earlier on update. Sending a later date returns a 400 error: `The availability start date cannot be greater than the current availability start date`.

> [!NOTE]
>
> **Retroactive Credential Update**
>
> If you have existing subscriptions that are failing rebills because of missing credential usage (e.g. from an initial CIT payment), you can use this `PATCH` endpoint to set `payment_method.card.usage` retroactively to fix the issue.

> [!NOTE]
>
> **Scheduled Plan Changes**
>
> Use the `plan_change` block to move a subscription to another plan effective at its next billing cycle — no proration, no mid-cycle charge. The subscription must be `ACTIVE` or `TRIALING` and already on a plan; the target plan must be active and only one change can be pending at a time. Send `"plan_change": null` to undo a pending change; omitting the field never touches it. The pending change is returned as `pending_plan_change` on this endpoint and on the subscription object, and the `subscription.plan_change_scheduled`, `subscription.plan_change_canceled` and `subscription.plan_changed` webhooks track its lifecycle.
>
> `amount`, `frequency`, `billing_date` and `country` are managed by the plan and cannot be sent for a plan-linked subscription — combining any of them with `plan_change` returns `400`.

> [!NOTE]
>
> **Immediate Plan Changes**
>
> Send `"effective": "IMMEDIATE"` inside `plan_change` to apply the move in this call instead of scheduling it: the subscription keeps its `id`, the new plan's price bills from the next charge, and — unlike a scheduled change — this works even in the final billing cycle. An immediate change while another change is pending returns `409 PLAN_CHANGE_ALREADY_SCHEDULED`; undo the pending one first with `"plan_change": null`.
>
> `billing_cycle_behavior` decides what happens to the billing anchor when the plan changes in place:
>
> * `KEEP` (default — omitting the field behaves identically) — the next charge date is untouched; only the price changes.
> * `RESTART` — the next charge re-anchors to the moment of the change plus the new plan's frequency. **Only the anchor resets**: billing cycle counters, the retry configuration and the subscription's status all survive. `RESTART` requires `effective: IMMEDIATE` and returns `400` with a scheduled change; `KEEP` alongside a scheduled change is accepted and simply schedules the change as usual — a scheduled change never moves the anchor anyway.
>
> An immediate change emits the `subscription.plan_changed` webhook at the moment of the call — `subscription.plan_change_scheduled` never fires for it, and `pending_plan_change` stays `null` throughout.
>
> `billing_cycle_behavior` is **write-only** — it is accepted on the request and never echoed in any response.
>
> On a monthly subscription created without an explicit `frequency.monthly_billing_day`, `RESTART` sets that field to the day of the restart, and every future renewal reads it — restarting on the 15th bills on the 15th from then on, not only for the next cycle. A subscription that already declares a billing day keeps it: the date does not move to the restart day, only the time of day is re-anchored. The value is returned on the subscription object, so it can be read back after the change. The same rule applies to `RESTART` on [Resume Subscription](https://docs.y.uno/reference/subscriptions/resume-subscription.md#keep-and-restart-compared) — it is one rule, on both endpoints.

> [!NOTE]
>
> **Restarting the Billing Cycle Without a Plan**
>
> For a subscription that is *not* linked to a plan, `billing_cycle_behavior` is available as a top-level field on this endpoint, typically combined with a `frequency` change in the same call — for example, moving a subscriber from monthly to yearly and restarting the cycle from today. The same `KEEP`/`RESTART` semantics apply, and on a subscription that has not started yet the re-anchored date clamps to its `availability.start_at`.
>
> Placement rules: on a plan-linked subscription the top-level field returns `400` (the anchor is managed through `plan_change`), and combining the top-level field with a `plan_change` block returns `400` — use `plan_change.billing_cycle_behavior` instead. A `PAUSED` subscription returns `409 INVALID_SUBSCRIPTION_STATUS`: a restart is accepted while the subscription is `ACTIVE`, `TRIALING` or `PAST_DUE` — or while it is still `CREATED`, where (unlike `plan_change`) the request is allowed and the re-anchored date clamps to `availability.start_at`. A top-level restart emits no webhook — read the new anchor from the subscription object.

### Plan change errors

Each of the `409` and `422` errors below carries a `current_status` field alongside `code` and `messages`, holding the subscription's status at the moment the request was rejected. The rejected request makes no change.

```json 409 Conflict theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "code": "PLAN_CHANGE_ALREADY_SCHEDULED",
  "messages": [
    "A plan change is already scheduled for this subscription. Undo it first with plan_change: null."
  ],
  "current_status": "ACTIVE"
}
```

| HTTP | `code` | When |
| - | - | - |
| `404` | `PLAN_NOT_FOUND` | The target plan does not exist or is not linked to this account. |
| `409` | `PLAN_CHANGE_ALREADY_SCHEDULED` | A change is already pending. Undo it first with `plan_change: null`. |
| `409` | `PLAN_CHANGE_ALREADY_APPLIED` | The `plan_change: null` undo arrived after the pending change had already taken effect at the renewal. |
| `409` | `TARGET_PLAN_NOT_ACTIVE` | The target plan is not active. |
| `409` | `SUBSCRIPTION_NOT_ON_A_PLAN` | The subscription is not on a plan. |
| `409` | `PLAN_CHANGE_NOT_AVAILABLE` | The subscription is in its final billing cycle, or its availability window ends before the next renewal. |
| `409` | `INVALID_SUBSCRIPTION_STATUS` | The subscription is `PAUSED`, `CREATED` or `ERROR`. |
| `422` | `SAME_PLAN` | The subscription is already on this plan. |

A `CANCELED` or `COMPLETED` subscription is rejected earlier with `400 INVALID_STATE`, which does not carry `current_status`.

Validation problems in the block itself — a missing `plan_id`, an unsupported `effective`, a target plan in another currency, or a `HONOR_PHASES` ladder longer than the remaining billing cycles — return `400 BAD_REQUEST` without `current_status`. The same applies to `billing_cycle_behavior` placement mistakes: `RESTART` without `effective: IMMEDIATE`, the top-level field combined with `plan_change`, or the top-level field on a plan-linked subscription each return `400 BAD_REQUEST` with a message naming the fix. Where an invalid `billing_cycle_behavior` **value** is caught depends on its position: the top-level field is rejected at the API edge as `400 INVALID_PARAMETERS` (`"The field 'billing_cycle_behavior' has an invalid value."`), while a bad value nested inside `plan_change` reaches the engine and returns `400 BAD_REQUEST` (e.g. `"RESET is invalid for plan_change.billing_cycle_behavior field"`) — treat both codes as validation failures.

One exception to the plan-change error table above: `PLAN_CHANGE_NOT_AVAILABLE` applies to *scheduled* changes only. An `IMMEDIATE` change does not need an upcoming cycle, so it is accepted in the final billing cycle.

## Setting a refund rule

`refund_rule` configures how a `CUSTOM` refund is sized when a later cancel request carries no `refund_amount` of its own. It is set here or on create, and sending `"refund_rule": null` clears it.

```json A share of the charged amount theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{ "refund_rule": { "type": "PERCENT", "percent": 50 } }
```

```json A flat amount theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{ "refund_rule": { "type": "FIXED", "amount": { "value": 10000, "currency": "COP" } } }
```

```json Clear the rule theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{ "refund_rule": null }
```

`PERCENT` and `FIXED` are exclusive — a rule carrying both `percent` and `amount` is rejected, and so is one carrying neither for its own `type`. A `FIXED` rule's `amount.currency` must equal the subscription's own currency; sending a mismatched one returns `400` `REFUND_RULE_CURRENCY_MISMATCH` — `"refund_rule.amount.currency USD must match the subscription currency COP."` (currencies vary with the request).

The same check applies when the update changes the subscription's own `amount.currency` while a `FIXED` rule in the old currency is still stored, without touching `refund_rule` in the same request — `400` `REFUND_RULE_CURRENCY_MISMATCH` — `"stored refund rule is FIXED in COP; send refund_rule in USD or refund_rule: null in the same request."` (naming the currencies involved). Resend the rule in the new currency, or clear it, in the same request that changes `amount.currency`.

After a clear, `refund_rule` is omitted from the subscription object on the response — never sent back as `null`.

See [Cancel Subscription](https://docs.y.uno/reference/subscriptions/cancel-subscription.md#custom) for how the rule is used, and [the Subscription object](https://docs.y.uno/reference/subscriptions/the-subscription-object.md) for the field reference. Available to organizations enabled for it; contact Yuno — for an organization that is not enabled, sending `refund_rule` (including `null`) is silently ignored, and nothing changes.


## OpenAPI

````yaml openapi/subscriptions/update-subscription.json PATCH /subscriptions/{subscription_id}
openapi: 3.1.0
info:
  title: Yuno Payments API
  version: 1.0.0
  description: >
    Yuno is a payment orchestration platform that connects merchants to multiple

    payment providers through a single API. Process payments, manage customers,

    handle subscriptions, and disburse payouts across Latin America, Asia, and
    beyond.
  contact:
    name: Yuno Support
    url: https://docs.y.uno
    email: support@y.uno
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - PublicApiKey: []
    PrivateSecretKey: []
tags:
  - name: AI Caller
  - name: Accounts (Banking Connectivity)
  - name: Checkout Builder
  - name: Checkout Sessions
  - name: Communications Campaigns
  - name: Conversion Rate
  - name: Customer Sessions Enrollment
  - name: Customers
  - name: Dry Run
  - name: Entities (Banking Connectivity)
  - name: Entity Onboarding (Banking Connectivity)
  - name: Entity Transfers (Banking Connectivity)
  - name: Fx Rates
  - name: Installments
  - name: Network Tokens
  - name: Organizations
  - name: Payment Links
  - name: Payment Methods Checkout
  - name: Payment Methods Direct Workflow
  - name: Payments
  - name: Payouts
  - name: Pci Proxy
  - name: Plans
  - name: Pre Debit Notifications
  - name: Recipients For Marketplace
  - name: Reporting
  - name: Reports
  - name: Sellers
  - name: Subscriptions
  - name: Three D Secure Setups
  - name: Transfers
  - name: Webhooks
paths:
  /subscriptions/{subscription_id}:
    patch:
      tags:
        - Subscriptions
      summary: Update Subscription
      operationId: update-subscription
      parameters:
        - name: subscription_id
          in: path
          description: The unique identifier of the subscription.
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: The subscription plan name (MAX 255; MIN 3).
                description:
                  type: string
                  description: The subscription plan description (MAX 255; MIN 3).
                account_id:
                  type: string
                  description: >-
                    The unique identifier of the account that will have the
                    subscription plan available to use (MAX 64 ; MIN 36).
                merchant_reference:
                  type: string
                  description: Identification of the subscription plan (MAX 255; MIN 3).
                soft_descriptor:
                  type: string
                  maxLength: 255
                  description: >-
                    Statement descriptor shown on the cardholder's bank
                    statement. Updating it changes the descriptor applied to
                    subsequent rebills generated by the subscription engine.
                    Length and formatting limits vary by provider (for example,
                    Unlimit truncates to 22 characters and Airwallex to 30).
                    Worldpay does not read this field; it builds the statement
                    narrative from `payment_description` instead.
                country:
                  type: string
                  description: The subscription's country.
                amount:
                  type: object
                  description: >-
                    Specifies the `amount` object, with the value of each
                    subscription payment and the used currency.
                  required:
                    - currency
                    - value
                  properties:
                    currency:
                      type: string
                      description: >-
                        The currency used to make the payment (MAX 3; MIN 3;
                        [ISO 4217](/reference/country-reference)).
                    value:
                      type: number
                      description: >-
                        The value of each payment of the subscription (multiple
                        of 0.0001).
                      format: float
                frequency:
                  type: object
                  description: >-
                    Specifies the `frequency` object. Defines the billing
                    frequency for the subscription. Including type and value.
                  required:
                    - type
                  properties:
                    type:
                      type: string
                      description: >-
                        The type of interval the subscription will have in time
                        (DAY, WEEK, MONTH). If not set, always MONTH by default.
                      enum:
                        - DAY
                        - WEEK
                        - MONTH
                    value:
                      type: integer
                      description: >-
                        The value between each interval the subscription will
                        have in time. The system will use the default value of 1
                        if not set.
                      format: int32
                    monthly_billing_day:
                      type: integer
                      description: >-
                        The day of the month when billing is processed. (MAX 31;
                        MIN 1). Only valid for MONTH frequency. If the
                        subscription has not started yet (availability.start_at
                        is in the future), the first billing still occurs at
                        availability.start_at and the billing day applies from
                        the second cycle onward; the resulting first billing
                        period may be shorter than a full cycle and is charged
                        in full.
                billing_cycles:
                  type: object
                  description: >-
                    Specifies the `billing_cycles` object. Defines the number of
                    charges associated to the subscription.
                  properties:
                    total:
                      type: integer
                      description: >-
                        The total number of billing cycles for the subscription
                        (MIN 1). On update it must also be greater than or equal
                        to the current `billing_cycles.current`. A value below
                        either limit is rejected with a `400` error. Sending
                        `null`, or omitting this field, leaves the current value
                        unchanged; clearing a previously set cycle limit is not
                        supported.
                      format: int32
                      minimum: 1
                customer_payer:
                  type: object
                  description: >-
                    Specifies the `customer_payer` object to identify the
                    customer.
                  properties:
                    id:
                      type: string
                      description: >-
                        The unique identifier of the customer (MAX 255; MIN 3).
                        Send it only to change the customer of the subscription.
                    ip_address:
                      type: string
                      maxLength: 45
                      example: 203.0.113.7
                      description: >-
                        IP address of the payer at the initial
                        customer-initiated payment (IPv4 or IPv6, up to 45
                        characters). Sending it replaces the stored value, which
                        is sent on every renewal; omitting it (or sending an
                        empty value) leaves the stored value unchanged, and it
                        cannot be cleared. A value that is not a valid IPv4 or
                        IPv6 address returns `400 BAD_REQUEST` ("The
                        customer_payer.ip_address must be a valid IPv4 or IPv6
                        address."). Only stored and returned for organizations
                        enabled for this feature.
                payment_method:
                  type: object
                  description: >-
                    Specifies the `payment_method` object. Supported types are
                    `CARD` and `PAYPAL_ENROLLMENT`. When you send
                    `payment_method`, `type` and `vaulted_token` are required,
                    even if you only change `card.usage`.
                  properties:
                    type:
                      type: string
                      description: Payment method type.
                      enum:
                        - CARD
                    vaulted_token:
                      type: string
                      description: >-
                        The vaulted token (UUID, MAX: 64; MIN: 36). Required
                        whenever `payment_method` is sent.
                    card:
                      type: object
                      description: Specifies the card object.
                      properties:
                        usage:
                          type: string
                          description: >-
                            Indicates whether this stored credential is being
                            used for the first time (FIRST) or has been used
                            before (USED). Required if a CIT payment was created
                            before the subscription — without it, rebills are
                            treated as CITs and may be declined.
                          enum:
                            - FIRST
                            - USED
                  required:
                    - type
                    - vaulted_token
                availability:
                  type: object
                  description: >-
                    Specifies the `availability` object. Defines a date interval
                    based on starting and ending dates when the subscription is
                    available to use. If this object is omitted from the
                    request, the availability dates are left unchanged. When it
                    is included, omitting `finish_at` (or sending it as `null`)
                    removes any previously set end date; omitting `start_at`
                    leaves the current start date unchanged.
                  properties:
                    start_at:
                      type: string
                      description: >-
                        The start date that the subscription plan will be
                        available to use. If not set, the subscription is
                        available from the moment it is created. On update,
                        omitting this field leaves the current start date
                        unchanged, and the start date can only be moved earlier:
                        sending a later date returns a 400 error.
                      format: date-time
                    finish_at:
                      type:
                        - string
                        - 'null'
                      description: >-
                        The end date until the subscription will be available to
                        use. When the `availability` object is included in the
                        request, omit this field or send `null` to clear a
                        previously set end date: the subscription becomes
                        open-ended and keeps renewing until it is canceled. Send
                        a date-time to set or update the end date. Note that
                        `availability.finish_at` and `billing_cycles.total` are
                        independent end conditions: whichever is reached first
                        completes the subscription.
                      format: date-time
                retries:
                  type: object
                  description: >-
                    The retries configuration to apply going forward. Accepts
                    the same object as Create Subscription — including strategy
                    and schedule — except cancel_on_exhausted_retries, which is
                    create-only. Changes apply the next time retries are
                    scheduled: a billing cycle already running its retries
                    finishes on the configuration it started with, and the
                    update takes effect from the next cycle.
                  properties:
                    retry_on_decline:
                      type: boolean
                      description: >-
                        If we should retry a payment or not after a first
                        decline. False by default.
                    amount:
                      type: integer
                      description: >-
                        The number of retries the subscription will attempt, for
                        the DEFAULT and SMART strategies. The maximum equals
                        your environment's configured retry schedule length — 6
                        in production; a higher value is rejected with 400 (Max
                        retries attempts exceeded). With CUSTOM_SCHEDULE the
                        amount is derived from the length of the schedule array
                        instead.
                      format: int32
                    strategy:
                      type: string
                      description: >-
                        The retry strategy. Allowed values: DEFAULT (the fixed
                        retry schedule), SMART (machine-learning-based retry
                        timing, applied from the second retry onward) or
                        CUSTOM_SCHEDULE (uses the per-attempt schedule array you
                        provide). Sending a schedule without a strategy implies
                        CUSTOM_SCHEDULE.
                      enum:
                        - DEFAULT
                        - SMART
                        - CUSTOM_SCHEDULE
                    schedule:
                      type: array
                      description: >-
                        Per-attempt retry schedule; replaces the stored schedule
                        as a whole. Up to 7 attempts, attempt numbers must run
                        sequentially from 1, and each delay_seconds must be
                        between 1 and 604800 (7 days). Sending it implies
                        strategy CUSTOM_SCHEDULE and sets the retry amount to
                        the schedule length.
                      items:
                        properties:
                          attempt:
                            type: number
                            description: Number of the retry attempt
                          delay_seconds:
                            type: number
                            description: >-
                              Specifies the amount of seconds between each
                              retry.
                        type: object
                    stop_on_hard_decline:
                      type: boolean
                      description: >-
                        When true, the retry schedule stops for the current
                        billing cycle after a hard decline. On its own, the
                        subscription remains ACTIVE and billing advances to the
                        next cycle; no subscription is canceled or paused and no
                        subscription webhook is emitted. If
                        cancel_on_exhausted_retries is also true, the
                        subscription is canceled instead.
                    cancel_on_exhausted_retries:
                      type: boolean
                      description: >-
                        Create-only: this flag cannot be changed after the
                        subscription is created — sending a value different from
                        the one stored on the subscription returns 400 (The
                        field 'retries.cancel_on_exhausted_retries' can only be
                        set when the subscription is created); echoing the
                        current value is accepted. When true, the subscription
                        is canceled once retries for a billing cycle end without
                        a successful payment, instead of remaining ACTIVE and
                        advancing to the next cycle. cancellation_source is set
                        to RETRIES_EXHAUSTED and a single SUBSCRIPTION.CANCEL
                        webhook is emitted. Defaults to false. The cancellation
                        itself is final, so Retry Subscription is rejected
                        afterwards.
                plan_change:
                  type:
                    - object
                    - 'null'
                  description: >-
                    Moves the subscription to another plan. `effective:
                    NEXT_BILLING_CYCLE` (the default) schedules the change for
                    the next renewal — no proration, no mid-cycle charge.
                    `effective: IMMEDIATE` applies the change in place, in this
                    call: the subscription keeps its `id`, the new plan's price
                    bills from the next charge, and `billing_cycle_behavior`
                    decides what happens to the billing anchor. The subscription
                    must be ACTIVE or TRIALING and already on a plan; the target
                    plan must be ACTIVE. For scheduled changes only one can be
                    pending at a time — send `"plan_change": null` to undo it
                    before it applies (an IMMEDIATE change while another is
                    pending returns 409). `amount`, `frequency`, `billing_date`
                    and `country` are managed by the plan and cannot be sent for
                    a plan-linked subscription — combining any of them with
                    `plan_change` returns 400.
                  required:
                    - plan_id
                  properties:
                    plan_id:
                      type: string
                      description: >-
                        The identifier of the target plan. Required. The target
                        plan must be ACTIVE and priced in the subscription's
                        currency.
                    effective:
                      type: string
                      enum:
                        - NEXT_BILLING_CYCLE
                        - IMMEDIATE
                      description: >-
                        When the change applies. NEXT_BILLING_CYCLE (default):
                        the current cycle bills the current plan's price, the
                        next one bills the new plan's. IMMEDIATE: the
                        subscription moves to the target plan in this call -
                        unlike a scheduled change, this also works in the final
                        billing cycle.
                    phases_behavior:
                      type: string
                      enum:
                        - START_FROM_REGULAR
                        - HONOR_PHASES
                      description: >-
                        What happens when the target plan has phases.
                        START_FROM_REGULAR (default) enters the regular phase
                        directly — no re-lived trials. HONOR_PHASES enters
                        through the target plan's phase schedule.
                    billing_cycle_behavior:
                      type: string
                      enum:
                        - KEEP
                        - RESTART
                      description: >-
                        What happens to the billing anchor when the plan changes
                        in place with `effective: IMMEDIATE`. KEEP (default —
                        omitting the field behaves identically): the next charge
                        date is untouched. RESTART: the next charge re-anchors
                        to the moment of the change plus the new plan's
                        frequency — the anchor alone resets; billing cycle
                        counters, the retry configuration and the subscription
                        status survive. RESTART requires `effective: IMMEDIATE`
                        and returns 400 with a scheduled change; KEEP alongside
                        a scheduled change is accepted and simply schedules the
                        change as usual. Write-only: this field is never echoed
                        in any response.
                billing_cycle_behavior:
                  type: string
                  enum:
                    - KEEP
                    - RESTART
                  description: >-
                    For subscriptions that are not linked to a plan: re-anchors
                    billing in the same way as
                    `plan_change.billing_cycle_behavior`, typically combined
                    with a `frequency` change in the same call (e.g. monthly to
                    yearly, restarting the cycle from today). KEEP (default):
                    the next charge date is untouched. RESTART: re-anchors the
                    next charge to now plus the (possibly updated) frequency;
                    the anchor alone resets — cycle counters, the retry
                    configuration and the subscription status survive. On a
                    subscription that has not started yet (CREATED — accepted
                    here, unlike `plan_change`), the anchor clamps to its start
                    date. Rules: cannot be combined with `plan_change` (400 —
                    use the nested field); on a plan-linked subscription this
                    field returns 400 (managed through `plan_change`); a PAUSED
                    subscription returns 409 INVALID_SUBSCRIPTION_STATUS.
                    Write-only: never echoed in any response.
                metadata:
                  type: object
                  description: >-
                    Set of key-value pairs that you can attach to an object.
                    This can be useful for storing additional information about
                    the object in a structured format. Individual keys can be
                    unset by posting an empty value to them. All keys can be
                    unset by posting an empty value to metadata.
                  properties:
                    key:
                      type: string
                      description: >-
                        Object title that represents the key-value pair inside
                        the metadata (MAX 48 ; MIN 1).
                    value:
                      type: string
                      description: Object value for the key defined  (MAX 512 ; MIN 1).
                refund_rule:
                  type:
                    - object
                    - 'null'
                  description: >-
                    Configures the refund rule used to resolve a later CUSTOM
                    cancel refund when that cancel request sends no
                    refund_amount of its own. Available to organizations enabled
                    for it; contact Yuno. Send null to clear a previously
                    configured rule.
                  properties:
                    type:
                      type: string
                      enum:
                        - PERCENT
                        - FIXED
                      description: >-
                        PERCENT resolves the refund as a percentage of the
                        charged amount; FIXED resolves it to a fixed amount.
                      example: FIXED
                    percent:
                      type: number
                      description: >-
                        Required, and only allowed, when type is PERCENT
                        (0-100).
                      example: 50
                    amount:
                      type: object
                      description: Required, and only allowed, when type is FIXED.
                      properties:
                        value:
                          type: number
                          example: 10000
                        currency:
                          type: string
                          description: Must match the subscription's own currency.
                          example: COP
            examples:
              Update card usage:
                summary: >-
                  Mark the card as already used, so rebills are sent as
                  subsequent payments
                value:
                  payment_method:
                    type: CARD
                    vaulted_token: <current vaulted_token of the subscription>
                    card:
                      usage: USED
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                UPDATE SUBSCRIPTION:
                  value:
                    id: 0c7fed3e-ee0d-4d34-9547-778be4ec0798
                    name: Test Subscription
                    account_id: 493e9374-510a-4201-9e09-de669d75f256
                    country: US
                    description: Subscription Test
                    merchant_reference: subscription-ref-merchant-AA01
                    soft_descriptor: ACME SUBSCRIPTION
                    status: ACTIVE
                    amount:
                      currency: USD
                      value: 15000
                    frequency:
                      type: MONTH
                      value: 1
                    billing_cycles:
                      total: 12
                      current: 1
                      next_at: '2024-09-30T12:04:23.265393Z'
                    customer_payer:
                      id: a1d3b664-e32a-4508-9da1-9ede3e62a60c
                    payment_method:
                      type: CARD
                      vaulted_token: d4aa3586-def2-4705-b7cd-fe064bb764e6
                    availability:
                      start_at: '2024-09-30T12:04:23.265393Z'
                      finish_at: null
                    metadata: null
                    pending_plan_change:
                      plan_id: 1904911d-5df9-429e-8488-ad41abea1a4d
                      plan_name: Pro
                      direction: UPGRADE
                      effective: NEXT_BILLING_CYCLE
                      phases_behavior: START_FROM_REGULAR
                      applies_at: '2024-10-30T12:04:23.265372Z'
                      requested_at: '2024-09-30T12:04:23.265372Z'
                    created_at: '2024-09-30T12:04:23.265372Z'
                    updated_at: '2024-09-30T12:04:23.265372Z'
                    retries:
                      retry_on_decline: false
                      amount: 6
                      strategy: DEFAULT
                      schedule: null
                      stop_on_hard_decline: null
                      cancel_on_exhausted_retries: null
                    additional_data: null
                    trial_period:
                      billing_cycles: 1
                      amount:
                        value: 0
                        currency: USD
                    initial_payment_validation: false
                    reason: null
                    subscription_agreement_id: null
                    renewal_notification_days: null
                    cancellation_time: null
                    cancellation_source: null
                    ending_time: null
                    current_period_start: '2026-10-23T00:00:00Z'
                    current_period_end: '2026-11-23T00:00:00Z'
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: 0c7fed3e-ee0d-4d34-9547-778be4ec0798
                  name:
                    type: string
                    example: Test Subscription
                  account_id:
                    type: string
                    example: 493e9374-510a-4201-9e09-de669d75f256
                  country:
                    type: string
                    example: US
                  description:
                    type:
                      - string
                      - 'null'
                    example: Subscription Test
                  merchant_reference:
                    type: string
                    example: subscription-ref-merchant-AA01
                  soft_descriptor:
                    type:
                      - string
                      - 'null'
                    description: Soft descriptor.
                    example: ACME SUBSCRIPTION
                  status:
                    type: string
                    example: ACTIVE
                  amount:
                    type: object
                    properties:
                      currency:
                        type: string
                        example: USD
                      value:
                        type: number
                        example: 15000
                        default: 0
                  frequency:
                    type: object
                    properties:
                      type:
                        type: string
                        example: MONTH
                      value:
                        type: integer
                        example: 1
                        default: 0
                      monthly_billing_day:
                        type:
                          - integer
                          - 'null'
                        description: >-
                          The day of the month billing is anchored to on a
                          MONTH-frequency subscription — set by RESTART (on
                          Update, a plan change, resume or reactivate) or by
                          sending Update Subscription's own
                          frequency.monthly_billing_day. Present only once
                          stamped; absent, not null, before that and on every
                          other frequency type.
                        example: 15
                  billing_cycles:
                    type: object
                    properties:
                      total:
                        type:
                          - integer
                          - 'null'
                        example: 12
                        default: 0
                      current:
                        type: integer
                        example: 1
                        default: 0
                      next_at:
                        type: string
                        example: '2024-09-30T12:04:23.265393Z'
                      scheduling_date:
                        type: string
                        description: >-
                          When the debit instruction is handed to the Pix rail —
                          `next_at` minus four days. Only present on
                          `PIX_AUTOMATIC` subscriptions that Yuno executes, and
                          only where the four-day scheduling lead is enabled for
                          the organization; absent, not `null`, otherwise.
                          Read-only. See [Pix
                          Automático](/docs/payment-features/subscriptions/pix-automatico#the-scheduling-date).
                        example: '2026-11-27T00:00:00Z'
                      paid:
                        type: integer
                        description: >-
                          How many cycles have been paid so far. Distinct from
                          `current`, which is the cycle being billed.
                  customer_payer:
                    type: object
                    properties:
                      id:
                        type: string
                        example: a1d3b664-e32a-4508-9da1-9ede3e62a60c
                      ip_address:
                        type: string
                        maxLength: 45
                        example: 203.0.113.7
                        description: >-
                          IP address of the payer stored for renewals. Returned
                          only on single-subscription responses (create,
                          retrieve, update, pause, resume, reactivate and
                          cancel) and only when one was supplied; never returned
                          on list items or in webhooks.
                  payment_method:
                    type: object
                    properties:
                      type:
                        type: string
                        example: CARD
                      vaulted_token:
                        type: string
                        example: d4aa3586-def2-4705-b7cd-fe064bb764e6
                      card:
                        type:
                          - object
                          - 'null'
                        properties:
                          installments:
                            type:
                              - integer
                              - 'null'
                          network_transaction_id:
                            type:
                              - string
                              - 'null'
                          usage:
                            type: string
                            example: FIRST
                  availability:
                    type: object
                    properties:
                      start_at:
                        type: string
                        example: '2024-09-30T12:04:23.265393Z'
                      finish_at: {}
                  metadata: {}
                  pending_plan_change:
                    type:
                      - object
                      - 'null'
                    description: >-
                      The plan change scheduled for the next billing cycle, or
                      null when none is pending.
                    properties:
                      plan_id:
                        type: string
                        description: The identifier of the target plan.
                        example: 1904911d-5df9-429e-8488-ad41abea1a4d
                      plan_name:
                        type: string
                        description: The name of the target plan.
                        example: Pro
                      direction:
                        type: string
                        enum:
                          - UPGRADE
                          - DOWNGRADE
                        description: >-
                          Whether the target plan is an upgrade or a downgrade.
                          Informational only.
                        example: UPGRADE
                      effective:
                        type: string
                        enum:
                          - NEXT_BILLING_CYCLE
                        description: When the change applies.
                        example: NEXT_BILLING_CYCLE
                      phases_behavior:
                        type: string
                        enum:
                          - START_FROM_REGULAR
                          - HONOR_PHASES
                        description: What happens when the target plan has phases.
                        example: START_FROM_REGULAR
                      applies_at:
                        type: string
                        description: >-
                          The billing event the change will take effect on — the
                          subscription's next billing date.
                        example: '2024-10-30T12:04:23.265372Z'
                      requested_at:
                        type: string
                        description: When the change was scheduled.
                        example: '2024-09-30T12:04:23.265372Z'
                  created_at:
                    type: string
                    example: '2024-09-30T12:04:23.265372Z'
                  updated_at:
                    type: string
                    example: '2024-09-30T12:04:23.265372Z'
                  current_period_start:
                    type:
                      - string
                      - 'null'
                    description: >-
                      Start of the billing period the subscription is currently
                      in, one cadence before `current_period_end`. Inside a
                      trial or any other plan phase it follows that phase's
                      cadence. A terminal subscription (`CANCELED` or
                      `COMPLETED`) keeps its final window rather than going
                      null. Null only for a subscription with no recurring
                      cadence. Always returned together with current_period_end.
                    example: '2023-01-16T20:00:00.912480Z'
                  current_period_end:
                    type:
                      - string
                      - 'null'
                    description: >-
                      End of the billing period the subscription is currently
                      in. Equal to billing_cycles.next_at. Always returned
                      together with current_period_start.
                    example: '2023-02-16T20:00:00.786342Z'
                  billing_date:
                    type:
                      - object
                      - 'null'
                    description: >-
                      Only present on subscriptions billed on a fixed date
                      instead of a frequency; mutually exclusive with
                      `frequency`.
                    properties:
                      type:
                        type: string
                        example: DAY
                      day:
                        type: integer
                        example: 2
                  retries:
                    type:
                      - object
                      - 'null'
                    description: >-
                      The retry policy applied when a recurring charge is
                      declined. See
                      [Retries](/docs/payment-features/subscriptions/retries).
                    properties:
                      retry_on_decline:
                        type: boolean
                        description: Whether declined charges are retried at all.
                        example: true
                      amount:
                        type: integer
                        description: >-
                          How many retries a billing cycle gets. Capped by your
                          environment's retry schedule length (6 in production).
                        example: 4
                      strategy:
                        type: string
                        description: >-
                          How the timing of each retry is decided: `DEFAULT`,
                          `SMART` or `CUSTOM_SCHEDULE`. Treat as open-ended —
                          handle unrecognized values gracefully.
                        example: DEFAULT
                      schedule:
                        type:
                          - array
                          - 'null'
                        description: >-
                          The per-attempt schedule, only set when `strategy` is
                          `CUSTOM_SCHEDULE`; `null` otherwise.
                        items:
                          type: object
                      stop_on_hard_decline:
                        type:
                          - boolean
                          - 'null'
                        description: >-
                          When true, a hard decline stops the retries for the
                          current billing cycle.
                      cancel_on_exhausted_retries:
                        type:
                          - boolean
                          - 'null'
                        description: >-
                          When true, the subscription is canceled once a cycle's
                          retries end without a successful payment, with
                          `cancellation_source` set to `RETRIES_EXHAUSTED`.
                      profile:
                        type: string
                        description: >-
                          The fixed retry ladder the subscription follows
                          instead of the configurable schedule. Always
                          `PIX_AUTOMATIC`. This field and the three below are
                          only present on `PIX_AUTOMATIC` subscriptions that
                          Yuno executes; they are absent, not `null`, on every
                          other payment method. See [Pix
                          Automático](/docs/payment-features/subscriptions/pix-automatico#the-retry-ladder).
                        example: PIX_AUTOMATIC
                      max_attempts:
                        type: integer
                        description: >-
                          How many retries the Pix ladder runs. Always 3,
                          matching the `amount` reported for these
                          subscriptions.
                        example: 3
                      min_gap_hours:
                        type: integer
                        description: >-
                          Always 24 — the gap between the ladder's debit dates
                          (`D`, `D+1`, `D+2`, `D+3`), not between dispatch
                          attempts.
                        example: 24
                      until:
                        type: string
                        description: >-
                          When the ladder stops — `billing_cycles.next_at` plus
                          7 days. Moves with `next_at` at every renewal.
                      stopped:
                        type: boolean
                        description: >-
                          Present only when the subscription is PAST_DUE or has
                          cancel_scheduled pending.
                      attempts_made:
                        type: integer
                        description: >-
                          Present only when the subscription is PAST_DUE or has
                          cancel_scheduled pending.
                      outcome:
                        type: string
                        description: >-
                          RECOVERED, EXHAUSTED or ABANDONED. Present only when
                          the subscription is PAST_DUE or has cancel_scheduled
                          pending.
                      next_retry_at:
                        type: string
                        description: >-
                          Present only when the subscription is PAST_DUE or has
                          cancel_scheduled pending.
                  trial_period:
                    type: object
                    description: Trial period.
                    properties:
                      billing_cycles:
                        type: integer
                        example: 1
                        default: 0
                      amount:
                        type: object
                        properties:
                          value:
                            type: number
                            example: 0
                            default: 0
                          currency:
                            type: string
                            example: USD
                  additional_data:
                    type:
                      - object
                      - 'null'
                    description: >-
                      The optional order enrichment sent at creation, echoed
                      back. See [The Subscription
                      Object](/reference/subscriptions/the-subscription-object)
                      for its full shape.
                  initial_payment_validation:
                    type: boolean
                    description: >-
                      Whether the subscription waited for its first payment to
                      succeed before activating. `false` by default.
                    example: false
                  reason:
                    type:
                      - string
                      - 'null'
                    description: >-
                      Free-form reason for the subscription's current status,
                      when one was recorded; `null` otherwise.
                    example: merchant request
                  renewal_notification_days:
                    type:
                      - integer
                      - 'null'
                    description: >-
                      How many days before the next billing date the
                      `subscription.close_to_renewal` webhook is sent. `null`
                      means no renewal notification is sent.
                    example: 3
                  payments:
                    type: array
                    items:
                      type: string
                      example: 5104911d-5df9-229e-8468-bd41abea1a4s
                  subscription_agreement_id:
                    type:
                      - string
                      - 'null'
                    description: Subscription agreement id.
                    example: sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa
                  cancellation_time:
                    type:
                      - string
                      - 'null'
                    description: >-
                      When the subscription was canceled. Only set once it
                      reaches `CANCELED`; `null` otherwise.
                    example: '2023-12-16T20:46:54.786342Z'
                  cancellation_source:
                    type:
                      - string
                      - 'null'
                    description: >-
                      What triggered the cancellation: `MERCHANT`, `SYSTEM`,
                      `PLAN_CHANGE` or `RETRIES_EXHAUSTED`. Only set once the
                      subscription reaches `CANCELED`; `null` otherwise. Treat
                      as open-ended — handle unrecognized values gracefully.
                    example: MERCHANT
                  ending_time:
                    type:
                      - string
                      - 'null'
                    description: >-
                      When the subscription completed or expired. Only set once
                      it reaches `COMPLETED`; `null` otherwise.
                    example: '2024-12-16T20:46:54.786342Z'
                  plan_id:
                    type: string
                    description: Only present when the subscription is linked to a plan.
                    example: 00000000-0000-4000-8000-000000000001
                  plan_assigned_at:
                    type: string
                    description: >-
                      Only present on plan-linked subscriptions. The moment the
                      plan was attached — at creation from a plan, migration
                      onto a plan, or a plan change.
                    example: '2023-12-16T20:46:54.786342Z'
                  previous_subscription_id:
                    type:
                      - string
                      - 'null'
                    description: >-
                      Only present when this subscription was created by a plan
                      change (switching an existing subscription to a different
                      plan).
                  phases:
                    type: array
                    description: >-
                      The linked plan's phase definitions, as the plan declares
                      them — including the terminal `REGULAR` phase. Only
                      present on plan-linked subscriptions whose plan has
                      phases. This is the plan's own ladder, not this
                      subscriber's snapshot: for what was pinned for this
                      subscription at creation, use `billing_phases`.
                    items:
                      type: object
                      properties:
                        order:
                          type: integer
                        name:
                          type: string
                        type:
                          type: string
                          description: '`TRIAL` or `REGULAR`.'
                        duration:
                          type:
                            - object
                            - 'null'
                          description: >-
                            How long the phase lasts. `null` on the terminal
                            `REGULAR` phase, which runs until the subscription
                            ends.
                          properties:
                            type:
                              type: string
                            value:
                              type: integer
                        frequency:
                          type:
                            - object
                            - 'null'
                          description: >-
                            How often the phase bills. `null` on the terminal
                            `REGULAR` phase, which bills at the plan's own
                            frequency.
                          properties:
                            type:
                              type: string
                            value:
                              type: integer
                        amount:
                          type:
                            - object
                            - 'null'
                          description: >-
                            The phase price. `null` on the terminal `REGULAR`
                            phase, whose price resolves from the plan at every
                            billing.
                          properties:
                            currency:
                              type: string
                            value:
                              type: number
                        total_payments:
                          type:
                            - integer
                            - 'null'
                        country_prices:
                          type: array
                          description: >-
                            Per-country overrides of the phase price, empty when
                            the phase has none.
                          items:
                            type: object
                            properties:
                              country:
                                type: string
                              amount:
                                type: object
                                properties:
                                  currency:
                                    type: string
                                  value:
                                    type: number
                  current_phase:
                    type: string
                    description: Only present on plan-linked subscriptions.
                    example: REGULAR
                  current_phase_end:
                    type:
                      - string
                      - 'null'
                    description: >-
                      When the phase named by `current_phase` hands over to the
                      next one — for a subscription in its trial, when it
                      switches to the regular price. End of the last billing
                      period the phase covers, so on the final period of a trial
                      it equals `current_period_end`. Null for a subscription
                      with no plan and for one that already left the phase
                      ladder.
                    example: '2023-03-16T20:00:00.786342Z'
                  billing_phases:
                    type: array
                    description: >-
                      Only present on plan-linked subscriptions whose plan has
                      phases. Contains the leading TRIAL phases only,
                      snapshotted at creation — the terminal REGULAR phase is
                      never included, since its price isn't pinned and instead
                      resolves from the plan at every billing. `current_phase:
                      "REGULAR"` is how you know the ladder is exhausted.
                    items:
                      type: object
                      properties:
                        order:
                          type: integer
                        type:
                          type: string
                          description: >-
                            Always TRIAL — the terminal REGULAR phase is never
                            in this array.
                        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
                  refund_rule:
                    type: object
                    description: >-
                      The stored refund rule used to resolve a CUSTOM cancel
                      refund when the cancel request sends no refund_amount of
                      its own. Present only when one is configured; omitted, not
                      null, otherwise. Available to organizations enabled for
                      it; contact Yuno.
                    properties:
                      type:
                        type: string
                        enum:
                          - PERCENT
                          - FIXED
                        description: >-
                          PERCENT resolves the refund as a percentage of the
                          charged amount; FIXED resolves it to a fixed amount.
                        example: FIXED
                      percent:
                        type: number
                        description: >-
                          Required, and only allowed, when type is PERCENT
                          (0-100).
                        example: 50
                      amount:
                        type: object
                        description: Required, and only allowed, when type is FIXED.
                        properties:
                          value:
                            type: number
                            example: 10000
                          currency:
                            type: string
                            description: Must match the subscription's own currency.
                            example: COP
                  pause_until:
                    type: string
                    description: >-
                      When the subscription is scheduled to resume
                      automatically. Present only on a subscription currently
                      paused with a duration (pause_cycles or pause_until sent
                      at pause); absent, not null, on every other read.
                    example: '2026-10-15T15:54:22.780166Z'
                  cancel_scheduled:
                    type:
                      - object
                      - 'null'
                    description: null when no cancellation is pending.
                    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 when refund was NONE or omitted. Present on the
                      cancel response and on every later read once computed.
                    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 for a $0-phase quote with no captured
                              payment.
                          charged_at:
                            type: string
                            description: >-
                              null for a $0-phase quote with no captured
                              payment.
                      execution:
                        type: string
                        example: MERCHANT
                      quoted_at:
                        type: string
                  unpaid_cycle:
                    type: object
                    description: >-
                      Present only when the current billing cycle is PAST_DUE
                      and has not settled.
                    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:
                Result:
                  value:
                    code: INVALID_REQUEST
                    messages:
                      - Invalid request.
                PIX AUTOMATICO CADENCE NOT SUPPORTED:
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - >-
                        Pix Automático only supports weekly, monthly, quarterly,
                        half-yearly or yearly frequencies with value 1.
                PLAN CHANGE BEHAVIOR INVALID VALUE:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - >-
                        RESET is invalid for plan_change.billing_cycle_behavior
                        field
                  summary: >-
                    plan_change.billing_cycle_behavior accepts only KEEP or
                    RESTART.
                BEHAVIOR COMBINED WITH PLAN CHANGE:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - >-
                        The billing_cycle_behavior field cannot be combined with
                        plan_change; use plan_change.billing_cycle_behavior.
                  summary: >-
                    When you send plan_change, put the behaviour inside it
                    rather than at the top level.
                RESTART REQUIRES IMMEDIATE:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - >-
                        The plan_change.billing_cycle_behavior value RESTART
                        requires effective IMMEDIATE.
                  summary: >-
                    RESTART re-anchors the billing date, so it is only valid on
                    an immediate plan change.
                PLAN CHANGE ALREADY SCHEDULED:
                  value:
                    code: PLAN_CHANGE_ALREADY_SCHEDULED
                    messages:
                      - >-
                        A plan change is already scheduled for this
                        subscription. Undo it first with plan_change: null.
                  summary: Only one plan change may be pending at a time.
                REFUND RULE CURRENCY MISMATCH:
                  value:
                    code: REFUND_RULE_CURRENCY_MISMATCH
                    messages:
                      - >-
                        refund_rule.amount.currency USD must match the
                        subscription currency COP.
                  summary: >-
                    A FIXED refund_rule must be denominated in the
                    subscription's own currency.
                REFUND RULE PERCENT OUT OF RANGE:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - refund_rule.percent must be between 0 and 100.
      deprecated: false
components:
  securitySchemes:
    PublicApiKey:
      type: apiKey
      in: header
      name: public-api-key
      description: Public API key from Dashboard > Settings > API Keys
    PrivateSecretKey:
      type: apiKey
      in: header
      name: private-secret-key
      description: Private secret key (server-side only)

````

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