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

> Used to create a subscription item.



## OpenAPI

````yaml openapi-admin.json POST /subscriptions/{subscriptionId}/items
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}/items:
    post:
      tags:
        - subscriptions.items
      summary: Add an item to a subscription
      description: >-
        Adds a new subscription item (product variant) to a subscription.
        Optionally set a custom base price (applied before subscription
        discounts), quantity, and a recurring cycle limit (how many billing
        cycles the item appears). The variant must be part of a subscription
        plan.
      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:
                price:
                  minimum: 0
                  description: >-
                    Set a custom base price for the variant that will be used
                    before subscription discounts are applied. If not specified,
                    the variant's regular price will be used.
                  type: number
                variant:
                  minLength: 1
                  type: string
                quantity:
                  minimum: 1
                  description: Number of units ordered per billing cycle.
                  type: integer
                  example: 1
                recurringCycleLimit:
                  minimum: 1
                  description: >-
                    Maximum number of billing cycles this item remains on the
                    subscription. The item is automatically removed once this
                    limit is reached. Null means no limit.
                  type:
                    - 'null'
                    - integer
                  example: 3
              required:
                - variant
                - quantity
        required: true
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionItem'
        '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:
    SubscriptionItem:
      type: object
      properties:
        id:
          format: uuid
          description: Unique subscription item identifier (UUID).
          type: string
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        resource:
          type: string
          enum:
            - subscription-item
        title:
          minLength: 1
          description: Product title.
          type: string
          example: Monthly Coffee Blend
        subtitle:
          minLength: 1
          description: Variant title. Matches the variant title in most cases.
          type:
            - 'null'
            - string
          example: 250g / Ground
        quantity:
          minimum: 1
          description: Number of units ordered per billing cycle.
          type: integer
          example: 1
        totalPrice:
          minimum: 0
          description: >-
            Final item price per billing cycle including all applicable
            discounts.
          type: number
          example: 24.99
        recurringCycleLimit:
          minimum: 1
          description: >-
            Maximum number of billing cycles this item remains on the
            subscription. The item is automatically removed once this limit is
            reached. Null means no limit.
          type:
            - 'null'
            - integer
          example: 3
        canceledAt:
          format: date-time
          description: Cancellation date of the item.
          type:
            - 'null'
            - string
        billingPolicy:
          oneOf:
            - type: 'null'
            - type: object
              properties:
                interval:
                  anyOf:
                    - type: string
                      enum:
                        - DAY
                    - type: string
                      enum:
                        - WEEK
                    - type: string
                      enum:
                        - MONTH
                    - type: string
                      enum:
                        - YEAR
                intervalCount:
                  minimum: 1
                  maximum: 365
                  type: integer
                anchors:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        anyOf:
                          - type: string
                            enum:
                              - WEEKDAY
                          - type: string
                            enum:
                              - MONTHDAY
                          - type: string
                            enum:
                              - YEARDAY
                      day:
                        minimum: 1
                        maximum: 31
                        type: integer
                      month:
                        minimum: 1
                        maximum: 12
                        type:
                          - 'null'
                          - integer
                      cutoffDay:
                        minimum: 1
                        maximum: 31
                        type:
                          - 'null'
                          - integer
                    required:
                      - type
                      - day
                      - month
                      - cutoffDay
                minCycles:
                  minimum: 1
                  type:
                    - 'null'
                    - integer
                maxCycles:
                  minimum: 1
                  type:
                    - 'null'
                    - integer
              required:
                - interval
                - intervalCount
                - anchors
                - minCycles
                - maxCycles
              title: BillingPolicy
        deliveryPolicy:
          oneOf:
            - type: 'null'
            - type: object
              properties:
                interval:
                  anyOf:
                    - type: string
                      enum:
                        - DAY
                    - type: string
                      enum:
                        - WEEK
                    - type: string
                      enum:
                        - MONTH
                    - type: string
                      enum:
                        - YEAR
                intervalCount:
                  minimum: 1
                  maximum: 365
                  type: integer
                anchors:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        anyOf:
                          - type: string
                            enum:
                              - WEEKDAY
                          - type: string
                            enum:
                              - MONTHDAY
                          - type: string
                            enum:
                              - YEARDAY
                      day:
                        minimum: 1
                        maximum: 31
                        type: integer
                      month:
                        minimum: 1
                        maximum: 12
                        type:
                          - 'null'
                          - integer
                      cutoffDay:
                        minimum: 1
                        maximum: 31
                        type:
                          - 'null'
                          - integer
                    required:
                      - type
                      - day
                      - month
                      - cutoffDay
              required:
                - interval
                - intervalCount
                - anchors
              title: DeliveryPolicy
        customAttributes:
          description: >-
            Arbitrary key-value pairs attached to this subscription item. In the
            Customer API, attributes whose key starts with `_` are hidden and
            excluded.
          type: array
          items:
            type: object
            properties:
              key:
                minLength: 1
                type: string
              value:
                type: string
            required:
              - key
              - value
        variant:
          description: >-
            ProductVariant `id` when not expanded, or the full `ProductVariant`
            object when the field name is included in the `expand` query
            parameter. Can be null.
          anyOf:
            - minLength: 1
              type: string
            - $ref: '#/components/schemas/ProductVariant'
            - type: 'null'
        product:
          description: >-
            Product `id` when not expanded, or the full `Product` object when
            the field name is included in the `expand` query parameter. Can be
            null.
          anyOf:
            - minLength: 1
              type: string
            - $ref: '#/components/schemas/Product'
            - type: 'null'
      required:
        - id
        - resource
        - title
        - subtitle
        - quantity
        - totalPrice
        - recurringCycleLimit
        - canceledAt
        - billingPolicy
        - deliveryPolicy
        - customAttributes
        - variant
        - product
      title: SubscriptionItem
    ProductVariant:
      type: object
      properties:
        id:
          minLength: 1
          type: string
        title:
          minLength: 1
          type: string
        image:
          oneOf:
            - type: 'null'
            - type: object
              properties:
                id:
                  minLength: 1
                  type: string
                url:
                  format: uri
                  type: string
                altText:
                  minLength: 1
                  type:
                    - 'null'
                    - string
              required:
                - id
                - url
                - altText
        price:
          type: number
        purchaseOptions:
          type: array
          items:
            type: object
            properties:
              name:
                minLength: 1
                type: string
              price:
                type: number
              interval:
                type: object
                properties:
                  intervalCount:
                    type: number
                  interval:
                    type: string
                    enum:
                      - DAY
                      - MONTH
                      - WEEK
                      - YEAR
                required:
                  - intervalCount
                  - interval
            required:
              - name
              - price
              - interval
        product:
          description: >-
            Product `id` when not expanded, or the full `Product` object when
            the field name is included in the `expand` query parameter.
          anyOf:
            - minLength: 1
              type: string
            - $ref: '#/components/schemas/Product'
        planGroups:
          description: Subscription plan group IDs associated with this variant
          type: array
          items:
            minLength: 1
            type: string
      required:
        - id
        - title
        - image
        - price
        - purchaseOptions
        - product
        - planGroups
      title: ProductVariant
    Product:
      type: object
      properties:
        id:
          minLength: 1
          type: string
        title:
          minLength: 1
          type: string
        image:
          oneOf:
            - type: 'null'
            - type: object
              properties:
                id:
                  minLength: 1
                  type: string
                url:
                  format: uri
                  type: string
                altText:
                  minLength: 1
                  type:
                    - 'null'
                    - string
              required:
                - id
                - url
                - altText
        collections:
          type: array
          items:
            type: object
            properties:
              handle:
                minLength: 1
                type: string
            required:
              - handle
        planGroups:
          description: Subscription plan group IDs associated with this product
          type: array
          items:
            minLength: 1
            type: string
      required:
        - id
        - title
        - image
        - collections
        - planGroups
      title: Product
  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.

````