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

# Add a variant

> Used to add a variant to a product.



## OpenAPI

````yaml openapi-admin.json POST /products/{productId}/variants
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:
  /products/{productId}/variants:
    post:
      tags:
        - products
      summary: Add a variant to a product
      description: >-
        Creates and adds a new variant (e.g., size or color) to an existing
        product in the e-commerce platform.
      parameters:
        - schema:
            minLength: 1
            type: string
          in: path
          name: productId
          required: true
          description: The product identifier
        - $ref: '#/components/parameters/TenantHeader'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                price:
                  type: number
                compareAtPrice:
                  type: number
                sku:
                  type: string
                barcode:
                  type: string
                optionValues:
                  type: array
                  items:
                    type: object
                    properties:
                      optionName:
                        minLength: 1
                        type: string
                      name:
                        minLength: 1
                        type: string
                    required:
                      - optionName
                      - name
              required:
                - price
        required: true
      responses:
        '201':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductVariant'
        '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:
    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.

````