Create Variant
curl --request POST \
--url https://api.launchmystore.io/variants/bulk-add-variant/{product_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"variants": [
{}
],
"append": true,
"name": "<string>",
"value": "<string>",
"price": 123,
"discountPrice": 123,
"stock": 123,
"stockStatus": "<string>",
"skuId": "<string>",
"weight": 123,
"weightUnit": "<string>"
}
'import requests
url = "https://api.launchmystore.io/variants/bulk-add-variant/{product_id}"
payload = {
"variants": [{}],
"append": True,
"name": "<string>",
"value": "<string>",
"price": 123,
"discountPrice": 123,
"stock": 123,
"stockStatus": "<string>",
"skuId": "<string>",
"weight": 123,
"weightUnit": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
variants: [{}],
append: true,
name: '<string>',
value: '<string>',
price: 123,
discountPrice: 123,
stock: 123,
stockStatus: '<string>',
skuId: '<string>',
weight: 123,
weightUnit: '<string>'
})
};
fetch('https://api.launchmystore.io/variants/bulk-add-variant/{product_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.launchmystore.io/variants/bulk-add-variant/{product_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'variants' => [
[
]
],
'append' => true,
'name' => '<string>',
'value' => '<string>',
'price' => 123,
'discountPrice' => 123,
'stock' => 123,
'stockStatus' => '<string>',
'skuId' => '<string>',
'weight' => 123,
'weightUnit' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.launchmystore.io/variants/bulk-add-variant/{product_id}"
payload := strings.NewReader("{\n \"variants\": [\n {}\n ],\n \"append\": true,\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123,\n \"discountPrice\": 123,\n \"stock\": 123,\n \"stockStatus\": \"<string>\",\n \"skuId\": \"<string>\",\n \"weight\": 123,\n \"weightUnit\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.launchmystore.io/variants/bulk-add-variant/{product_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variants\": [\n {}\n ],\n \"append\": true,\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123,\n \"discountPrice\": 123,\n \"stock\": 123,\n \"stockStatus\": \"<string>\",\n \"skuId\": \"<string>\",\n \"weight\": 123,\n \"weightUnit\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/variants/bulk-add-variant/{product_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variants\": [\n {}\n ],\n \"append\": true,\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123,\n \"discountPrice\": 123,\n \"stock\": 123,\n \"stockStatus\": \"<string>\",\n \"skuId\": \"<string>\",\n \"weight\": 123,\n \"weightUnit\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"state": "success",
"message": "Variants added successfully",
"data": {
"variants": [
{
"varientId": "var_new123",
"productId": "prod_xyz789",
"name": "Size",
"value": "Large",
"price": 29.99,
"discountPrice": 39.99,
"stock": 100,
"skuId": "TSHIRT-BLUE-L",
"weight": 0.24,
"weightUnit": "kg"
}
]
}
}
Variants
Create Variant
Add variants to a product
POST
/
variants
/
bulk-add-variant
/
{product_id}
Create Variant
curl --request POST \
--url https://api.launchmystore.io/variants/bulk-add-variant/{product_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"variants": [
{}
],
"append": true,
"name": "<string>",
"value": "<string>",
"price": 123,
"discountPrice": 123,
"stock": 123,
"stockStatus": "<string>",
"skuId": "<string>",
"weight": 123,
"weightUnit": "<string>"
}
'import requests
url = "https://api.launchmystore.io/variants/bulk-add-variant/{product_id}"
payload = {
"variants": [{}],
"append": True,
"name": "<string>",
"value": "<string>",
"price": 123,
"discountPrice": 123,
"stock": 123,
"stockStatus": "<string>",
"skuId": "<string>",
"weight": 123,
"weightUnit": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
variants: [{}],
append: true,
name: '<string>',
value: '<string>',
price: 123,
discountPrice: 123,
stock: 123,
stockStatus: '<string>',
skuId: '<string>',
weight: 123,
weightUnit: '<string>'
})
};
fetch('https://api.launchmystore.io/variants/bulk-add-variant/{product_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.launchmystore.io/variants/bulk-add-variant/{product_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'variants' => [
[
]
],
'append' => true,
'name' => '<string>',
'value' => '<string>',
'price' => 123,
'discountPrice' => 123,
'stock' => 123,
'stockStatus' => '<string>',
'skuId' => '<string>',
'weight' => 123,
'weightUnit' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.launchmystore.io/variants/bulk-add-variant/{product_id}"
payload := strings.NewReader("{\n \"variants\": [\n {}\n ],\n \"append\": true,\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123,\n \"discountPrice\": 123,\n \"stock\": 123,\n \"stockStatus\": \"<string>\",\n \"skuId\": \"<string>\",\n \"weight\": 123,\n \"weightUnit\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.launchmystore.io/variants/bulk-add-variant/{product_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variants\": [\n {}\n ],\n \"append\": true,\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123,\n \"discountPrice\": 123,\n \"stock\": 123,\n \"stockStatus\": \"<string>\",\n \"skuId\": \"<string>\",\n \"weight\": 123,\n \"weightUnit\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/variants/bulk-add-variant/{product_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variants\": [\n {}\n ],\n \"append\": true,\n \"name\": \"<string>\",\n \"value\": \"<string>\",\n \"price\": 123,\n \"discountPrice\": 123,\n \"stock\": 123,\n \"stockStatus\": \"<string>\",\n \"skuId\": \"<string>\",\n \"weight\": 123,\n \"weightUnit\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"state": "success",
"message": "Variants added successfully",
"data": {
"variants": [
{
"varientId": "var_new123",
"productId": "prod_xyz789",
"name": "Size",
"value": "Large",
"price": 29.99,
"discountPrice": 39.99,
"stock": 100,
"skuId": "TSHIRT-BLUE-L",
"weight": 0.24,
"weightUnit": "kg"
}
]
}
}
There is no variant endpoint on the OAuth App API (
/api/v1/). This is
the merchant Admin API route, authenticated with a merchant access token
(not an app OAuth access token). To create variants from an app, send them in
the variants[] array of Create Product.Create Variant
There is no OAuth App API route for creating variants individually. Variants are created in one of two ways:- Merchant dashboard API —
POST /variants/bulk-add-variant/{product_id}adds one or more variants to an existing product (described below). - App API product create — pass a nested
variantsarray inside the body ofPOST /api/v1/products.json(Create Product).
bulk-add-variant route. It requires a
merchant (or staff) JWT and accepts a multipart/form-data body (so an
optional mainImage file can be attached). The variants field is a JSON
array of variant objects.
Path Parameters
string
required
The product ID to add variants to.
Body Parameters
array
required
Array of variant objects. Each object accepts the fields below.
boolean
default:"false"
When
true, append the supplied variants to the product’s existing set.
When false (default), the supplied set replaces the product’s variants.file
Optional variant image (multipart file part).
Variant object fields
string
required
Option name (e.g.
"Size").string
Option value (e.g.
"Medium").number
required
Variant price.
number
Discounted / compare-at price.
number
Stock quantity.
string
Stock status (e.g.
in_stock).string
Stock keeping unit.
number
Variant weight.
string
Weight unit (e.g.
kg).Request
curl -X POST "https://api.launchmystore.io/variants/bulk-add-variant/prod_xyz789" \
-H "Authorization: Bearer YOUR_MERCHANT_JWT" \
-F 'variants=[{"name":"Size","value":"Large","price":29.99,"discountPrice":39.99,"stock":100,"skuId":"TSHIRT-BLUE-L","weight":0.24,"weightUnit":"kg"}]' \
-F "append=true"
Response
Responses use the platform response envelope:status, state, message,
data.
{
"status": 200,
"state": "success",
"message": "Variants added successfully",
"data": {
"variants": [
{
"varientId": "var_new123",
"productId": "prod_xyz789",
"name": "Size",
"value": "Large",
"price": 29.99,
"discountPrice": 39.99,
"stock": 100,
"skuId": "TSHIRT-BLUE-L",
"weight": 0.24,
"weightUnit": "kg"
}
]
}
}