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

# Create a subscription discount

> Used to create a subscription discount.



## OpenAPI

````yaml openapi-customer.json POST /subscriptions/{subscriptionId}/discounts
openapi: 3.1.0
info:
  version: 8.15.0
  title: '@fastify/swagger'
servers:
  - url: https://api.juo.io/customer/v1
security:
  - DelegatedToken: []
  - AccessToken: []
paths:
  /subscriptions/{subscriptionId}/discounts:
    post:
      tags:
        - api.customer.v1
      description: Applies a discount code to a subscription
      parameters:
        - schema:
            format: uuid
            type: string
          in: path
          name: subscriptionId
          required: true
          description: The subscription identifier
        - $ref: '#/components/parameters/TenantHeader'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                code:
                  description: Discount code to apply
                  type: string
              required:
                - code
        required: true
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionDiscount'
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:
    DelegatedToken:
      type: apiKey
      name: X-Delegated-Token
      in: header
    AccessToken:
      type: http
      scheme: bearer

````