Skip to main content
POST
/
stores
/
{storeId}
/
products
/
{productId}
/
variants
Create variant
curl --request POST \
  --url https://api.komerza.com/stores/{storeId}/products/{productId}/variants \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "cost": 50000,
  "minimumQuantity": 1073741824,
  "maximumQuantity": 1073741823,
  "order": 1073741824,
  "type": 0,
  "stock": 1073741823,
  "deliveryTypes": [
    "<string>"
  ],
  "stockMode": 0,
  "dynamicUrl": "<string>",
  "deliveryMessage": "<string>",
  "subscriptionPeriod": "<string>"
}
'
{
  "success": true,
  "message": "<string>",
  "code": "<string>",
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "dateCreated": "2023-11-07T05:31:56Z",
    "name": "<string>",
    "productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "storeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "cost": 50000,
    "deliveryTypes": [
      "<string>"
    ],
    "files": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "dateCreated": "2023-11-07T05:31:56Z",
        "friendlyName": "<string>",
        "ipAddress": "<string>",
        "userId": "<string>"
      }
    ],
    "minimumQuantity": 123,
    "maximumQuantity": 123,
    "order": 123,
    "imageNames": [
      "<string>"
    ],
    "stock": 123,
    "stockMode": 0,
    "customFields": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "dateCreated": "2023-11-07T05:31:56Z",
        "variantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "label": "<string>",
        "identifier": "<string>",
        "type": "<string>",
        "isRequired": true,
        "options": [
          {
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "dateCreated": "2023-11-07T05:31:56Z",
            "customFieldId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "label": "<string>",
            "value": "<string>",
            "order": 1073741823
          }
        ],
        "placeholder": "<string>",
        "hint": "<string>"
      }
    ],
    "dynamicUrl": "<string>",
    "deliveryMessage": "<string>",
    "metadata": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Your API key goes here

Path Parameters

storeId
string<uuid>
required

The store’s unique identifier.

productId
string<uuid>
required

The product’s unique identifier.

Body

The form containing the variant’s initial data.

The form used to create a product variant.

name
string
required

The display name of the variant.

Required string length: 3 - 128
cost
number<double>
required

The cost of the variant (non-negative).

Required range: 0 <= x <= 100000
minimumQuantity
integer<int32>
required

Minimum quantity allowed per order (at least 1).

Required range: 1 <= x <= 2147483647
maximumQuantity
integer<int32>
required

Maximum quantity allowed per order. Set to -1 for unlimited.

Required range: -1 <= x <= 2147483647
order
integer<int32>
required

Sort order for display (at least 1).

Required range: 1 <= x <= 2147483647
type
enum<integer>
required

The type of product that is being sold

Available options:
0,
1
stock
integer<int32>
required

Stock quantity available (non-negative).

Required range: 0 <= x <= 2147483647
deliveryTypes
string[]
required

Enabled delivery types. Valid values: license_keys, dynamic, keyauth, instructions, files.

stockMode
enum<integer>
required

The stock calculation modes that are used

Available options:
0,
1,
2
dynamicUrl
string<uri> | null

URL for dynamic fulfillment (when using the "dynamic" delivery type).

Maximum string length: 2048
deliveryMessage
string | null

Optional message shown on delivery.

Maximum string length: 4096
subscriptionPeriod
string<date-span> | null

Subscription billing period. Null for one-time products.

Response

The object was successfully created.

Represents a default generic response for API endpoints.

success
boolean
required

Indicates whether the operation or response was successful.

message
string | null

A descriptive message providing additional context or information about the response.

code
string | null

The error code (if there was an error) to use when referencing the error

data
object

Represents a configurable variant associated with a product, containing various properties such as pricing, stock, delivery options, and custom fields.