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

# Create variant

> Creates a variant on a product. Send an `Idempotency-Key` header to make a retry safe.



## OpenAPI

````yaml /openapi.json post /dev/v1/products/{id}/variants
openapi: 3.0.3
info:
  title: Shoppex Developer API
  description: Mintlify-compatible Developer API reference for Shoppex.
  version: 1.0.0
  contact:
    name: Shoppex Support
    email: support@shoppex.io
    url: https://shoppex.io
servers:
  - url: https://api.shoppex.io
security:
  - bearerAuth: []
paths:
  /dev/v1/products/{id}/variants:
    post:
      tags:
        - Products
      summary: Create variant
      description: >-
        Creates a variant on a product. Send an `Idempotency-Key` header to make
        a retry safe.
      operationId: postDevV1ProductsByIdVariants
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              example:
                title: New
                description: null
                price: 9
                price_modifier: null
                stock: 3
                stock_delimiter: null
                license_period: null
                file_id: 550e8400-e29b-41d4-a716-446655440000
                dynamic_webhook: https://example.com/variant-hook
                option_values:
                  region: eu
                is_default: false
                is_featured: true
                sort_order: 0
      responses:
        '201':
          description: Response for status 201
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - id
                      - uniqid
                      - product_uniqid
                      - file_id
                      - dynamic_webhook
                      - title
                      - description
                      - price
                      - price_modifier
                      - stock
                      - stock_delimiter
                      - license_period
                      - option_values
                      - is_default
                      - is_featured
                      - sort_order
                      - created_at
                      - updated_at
                    properties:
                      id:
                        type: string
                      uniqid:
                        type: string
                      product_uniqid:
                        type: string
                      file_id:
                        nullable: true
                        type: string
                      dynamic_webhook:
                        nullable: true
                        type: string
                      title:
                        type: string
                      description:
                        nullable: true
                        type: string
                      price:
                        type: number
                      price_modifier:
                        nullable: true
                        type: number
                      stock:
                        nullable: true
                        type: number
                      stock_delimiter:
                        nullable: true
                        type: string
                      license_period:
                        nullable: true
                        type: number
                        description: >-
                          Raw stored term in days. Kept for v1 compatibility;
                          prefer license_mode + license_period_days.
                      license_mode:
                        type: string
                        enum:
                          - LIFETIME
                          - PERIOD
                          - INHERIT
                      license_period_days:
                        nullable: true
                        type: number
                        description: Days for PERIOD, 0 for LIFETIME, null for INHERIT.
                      option_values:
                        description: Arbitrary JSON stored on the variant, or null.
                      is_default:
                        type: boolean
                      is_featured:
                        type: boolean
                      sort_order:
                        type: number
                      created_at:
                        type: number
                        description: Unix timestamp in seconds.
                      updated_at:
                        type: number
                        description: Unix timestamp in seconds.
                    additionalProperties: true
                additionalProperties: true
                example:
                  data:
                    id: variant_2
                    uniqid: variant_2
                    product_uniqid: prod_1
                    file_id: 550e8400-e29b-41d4-a716-446655440000
                    dynamic_webhook: https://example.com/variant-hook
                    title: New
                    description: null
                    price: 9
                    price_modifier: null
                    stock: 3
                    stock_delimiter: null
                    license_period: null
                    option_values:
                      region: eu
                    is_default: false
                    is_featured: true
                    sort_order: 0
                    created_at: 1711953600
                    updated_at: 1711953900
        '401':
          description: Response for status 401
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '403':
          description: Response for status 403
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '404':
          description: Response for status 404
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '422':
          description: Response for status 422
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '429':
          description: Response for status 429
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '500':
          description: Response for status 500
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
      deprecated: false
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Use your Shoppex API key in the Authorization header.

````