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

# Generate Variants

> Generate variants from the cartesian product of the product's option values.

Idempotent: a variant is keyed by its deterministic SKU, so re-running only
creates the combinations that don't yet exist. With ``prune=True`` variants
whose combination is no longer valid are removed (the last variant is kept).



## OpenAPI

````yaml https://api.vellaro.io/openapi.json post /api/v1/admin/products/{product_id}/variants/generate
openapi: 3.1.0
info:
  title: Vellaro API
  description: Vellaro 2026 — E-commerce API
  version: 0.1.0
servers:
  - url: https://api.vellaro.io
    description: Produzione
security: []
tags: []
paths:
  /api/v1/admin/products/{product_id}/variants/generate:
    post:
      tags:
        - admin
        - admin
      summary: Generate Variants
      description: >-
        Generate variants from the cartesian product of the product's option
        values.


        Idempotent: a variant is keyed by its deterministic SKU, so re-running
        only

        creates the combinations that don't yet exist. With ``prune=True``
        variants

        whose combination is no longer valid are removed (the last variant is
        kept).
      operationId: >-
        generate_variants_api_v1_admin_products__product_id__variants_generate_post
      parameters:
        - name: product_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Product Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateVariantsRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_GenerateVariantsResult_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    GenerateVariantsRequest:
      properties:
        base_sku:
          anyOf:
            - type: string
            - type: 'null'
          title: Base Sku
        base_price:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Base Price
        prune:
          type: boolean
          title: Prune
          default: false
      type: object
      title: GenerateVariantsRequest
    ApiResponse_GenerateVariantsResult_:
      properties:
        data:
          anyOf:
            - $ref: '#/components/schemas/GenerateVariantsResult'
            - type: 'null'
        meta:
          anyOf:
            - $ref: '#/components/schemas/PaginationMeta'
            - type: 'null'
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
      type: object
      title: ApiResponse[GenerateVariantsResult]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GenerateVariantsResult:
      properties:
        created:
          type: integer
          title: Created
        skipped:
          type: integer
          title: Skipped
        pruned:
          type: integer
          title: Pruned
        total:
          type: integer
          title: Total
      type: object
      required:
        - created
        - skipped
        - pruned
        - total
      title: GenerateVariantsResult
    PaginationMeta:
      properties:
        page:
          type: integer
          title: Page
        page_size:
          type: integer
          title: Page Size
        total:
          type: integer
          title: Total
        total_pages:
          type: integer
          title: Total Pages
      type: object
      required:
        - page
        - page_size
        - total
        - total_pages
      title: PaginationMeta
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````