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

# Update a subscription discount

> Used to update a subscription discount.



## OpenAPI

````yaml openapi-admin.json PATCH /subscriptions/{subscriptionId}/discounts/{discountId}
openapi: 3.1.0
info:
  title: Juo Admin API
  version: 1.0.0
  description: >-
    Programmatic access to subscription management for merchants.


    ## Core Resources


    - **Subscriptions** — the central entity. Belongs to a Customer, contains
    Items (product variants) and Discounts. Lifecycle: `active` → `paused` or
    `cancelled`; `paused` → `active` or `cancelled`; `cancelled` → `active` (via
    reactivate).

    - **Items** — subscription items (product variants) (quantity, price,
    billing/delivery policies).

    - **Discounts** — applied to subscriptions by discount code or manually
    (percentage or fixed amount, targeting subscription items or shipping).

    - **Customers** — customers who own subscriptions and payment methods.

    - **Products / Variants** — catalog products and variants that can be
    assigned to subscription plans.

    - **Schedules** — a read-only projection of upcoming billing orders, derived
    from subscription state, active schedule adjustments, and triggered
    workflows. **Schedule adjustments never modify the subscription** — they
    apply changes to upcoming orders matching the specified criteria (by cycle,
    date, or both), which may cover one or more orders. For permanent changes
    (billing frequency, items, payment method, delivery address), update the
    subscription directly.

    - **Workflows** — interactive customer-facing flows (retention, dunning,
    onboarding). Contain Steps connected by Transitions and produce Runs on each
    execution. Supports A/B experiment steps.


    ## Authentication


    Every request requires:

    - `X-Juo-Admin-Api-Key` header — the merchant's Admin API key.

    - `X-Tenant-ID` header — the store identifier (myshopify domain, e.g.
    `my-store.myshopify.com`).
servers:
  - url: https://api.juo.io/admin/v1
security:
  - AdminApiKey: []
  - BearerToken: []
tags:
  - name: subscriptions
    description: >-
      Recurring billing agreements with customers. Manage lifecycle (pause,
      resume, cancel, reactivate), items, and discounts.
  - name: customers
    description: Customers who own subscriptions. Create and update customer records.
  - name: products
    description: >-
      Products and variants linked to subscription plans. Manage catalog and
      plan assignments.
  - name: schedules
    description: >-
      Read-only view of upcoming billing orders generated from subscription
      state, schedule adjustments, and workflows. Use schedule adjustments for
      targeted changes to upcoming orders (scoped by cycle number, date, or
      both) — they never alter the subscription itself. For permanent changes
      (billing frequency, items, payment method), update the subscription
      directly.
  - name: workflows
    description: >-
      Interactive customer-facing flows for retention, dunning, and onboarding.
      Define steps, publish, and track execution runs and experiments.
paths:
  /subscriptions/{subscriptionId}/discounts/{discountId}:
    patch:
      tags:
        - subscriptions.discounts
      summary: Update a subscription discount
      description: >-
        Updates an existing discount on a subscription using merge-patch
        semantics. Can change the discount value and recurring cycle limit. The
        discount target type cannot be changed after creation.
      parameters:
        - schema:
            format: uuid
            type: string
          in: path
          name: subscriptionId
          required: true
          description: The subscription identifier
        - schema:
            format: uuid
            type: string
          in: path
          name: discountId
          required: true
          description: The subscription discount identifier
        - $ref: '#/components/parameters/TenantHeader'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                target:
                  anyOf:
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - shipping
                      required:
                        - type
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - line
                        selector:
                          anyOf:
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - all
                              required:
                                - type
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - some
                                lines:
                                  type: array
                                  items:
                                    format: uuid
                                    type: string
                              required:
                                - type
                                - lines
                      required:
                        - type
                        - selector
                value:
                  anyOf:
                    - type: object
                      properties:
                        amount:
                          exclusiveMinimum: 0
                          type: number
                        type:
                          type: string
                          enum:
                            - fixed-amount
                        appliesOnEachItem:
                          description: >-
                            When true, the amount will be proportionally split
                            among all the items.
                          type: boolean
                      required:
                        - amount
                        - type
                        - appliesOnEachItem
                    - type: object
                      properties:
                        percentage:
                          exclusiveMinimum: 0
                          maximum: 100
                          type: number
                        type:
                          type: string
                          enum:
                            - percentage
                      required:
                        - percentage
                        - type
                recurringCycleLimit:
                  minimum: 1
                  description: >-
                    The number of billing cycles for which this discount will be
                    applied. After the recurring cycle limit is met the discount
                    will be removed from the subscription.
                  type:
                    - 'null'
                    - integer
              required: []
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionDiscount'
        '400':
          description: >-
            Bad request — invalid input or violated business rule (e.g., wrong
            subscription status for the requested operation).
        '401':
          description: Unauthorized — missing, expired, or invalid API key.
        '403':
          description: Forbidden — authenticated but not permitted to access this resource.
        '404':
          description: >-
            Not found — the resource does not exist or belongs to a different
            tenant.
        '422':
          description: >-
            Unprocessable entity — well-formed request that fails semantic
            validation.
components:
  parameters:
    TenantHeader:
      name: X-Tenant-ID
      x-speakeasy-name-override: tenant
      x-speakeasy-globals-hidden: true
      in: header
      schema:
        type: string
      required: true
      description: >-
        Unique identifier of the tenant in the system (usually a store
        identifier)
  schemas:
    SubscriptionDiscount:
      type: object
      properties:
        id:
          format: uuid
          type: string
        resource:
          type: string
          enum:
            - subscription-discount
        title:
          minLength: 1
          description: >-
            The title of the discount shown to customers, typically displayed as
            a discount code.
          type:
            - 'null'
            - string
        target:
          anyOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - shipping
              required:
                - type
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - line
                selector:
                  anyOf:
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - all
                      required:
                        - type
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - some
                        lines:
                          type: array
                          items:
                            format: uuid
                            type: string
                      required:
                        - type
                        - lines
              required:
                - type
                - selector
        value:
          anyOf:
            - type: object
              properties:
                amount:
                  exclusiveMinimum: 0
                  type: number
                type:
                  type: string
                  enum:
                    - fixed-amount
                appliesOnEachItem:
                  description: >-
                    When true, the amount will be proportionally split among all
                    the items.
                  type: boolean
              required:
                - amount
                - type
                - appliesOnEachItem
            - type: object
              properties:
                percentage:
                  exclusiveMinimum: 0
                  maximum: 100
                  type: number
                type:
                  type: string
                  enum:
                    - percentage
              required:
                - percentage
                - type
        recurringCycleLimit:
          minimum: 1
          description: >-
            The number of billing cycles for which this discount will be
            applied. After the recurring cycle limit is met the discount will be
            removed from the subscription.
          type:
            - 'null'
            - integer
      required:
        - id
        - resource
        - title
        - target
        - value
        - recurringCycleLimit
      title: SubscriptionDiscount
  securitySchemes:
    AdminApiKey:
      type: apiKey
      name: X-Juo-Admin-Api-Key
      in: header
      description: >-
        Long-lived Admin API key issued from the Juo merchant portal. Pass as
        the `X-Juo-Admin-Api-Key` header.
    BearerToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Short-lived JWT minted via the merchant browser-session flow. Carries
        the authenticated staff identity so that API calls are attributed to the
        specific staff user in the activity log.

````