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

# Generate Matrix

> Generate a variant matrix preview without persisting.

**Authentication Required**: Requires ``variant:write`` permission.

Accepts a dict of property_key to list of values and returns the
cross-product of all axis values as a preview array.



## OpenAPI

````yaml /openapi/merchantops-public.json post /api/products/{product_key}/variants/generate-matrix
openapi: 3.1.0
info:
  description: >-
    Public API for the MerchantOps product catalog, pricing, and publishing
    surface.
  title: MerchantOps API
  version: 1.0.0
servers:
  - description: Production
    url: https://api.merchantops.ai
security: []
paths:
  /api/products/{product_key}/variants/generate-matrix:
    post:
      tags:
        - Variants
      summary: Generate Matrix
      description: |-
        Generate a variant matrix preview without persisting.

        **Authentication Required**: Requires ``variant:write`` permission.

        Accepts a dict of property_key to list of values and returns the
        cross-product of all axis values as a preview array.
      operationId: generate_matrix
      parameters:
        - in: path
          name: product_key
          required: true
          schema:
            title: Product Key
            type: string
        - in: header
          name: authorization
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - in: header
          name: X-Organization-ID
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Organization-Id
        - in: cookie
          name: stytch_session
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Stytch Session
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MatrixGenerateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MatrixGenerateResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    MatrixGenerateRequest:
      description: Request model for generating a variant matrix preview.
      properties:
        axes:
          additionalProperties:
            items: {}
            type: array
          description: Property key to list of values for cross-product generation
          title: Axes
          type: object
        same_for_all_defaults:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          description: Default values for SameForAll properties
          title: Same For All Defaults
      required:
        - axes
      title: MatrixGenerateRequest
      type: object
    MatrixGenerateResponse:
      description: Response model for variant matrix preview.
      properties:
        preview:
          description: Preview array of variant dicts (not yet persisted)
          items:
            additionalProperties: true
            type: object
          title: Preview
          type: array
        total_count:
          description: Total number of variants in the preview
          title: Total Count
          type: integer
      required:
        - preview
        - total_count
      title: MatrixGenerateResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object

````