curl --request POST \
--url https://api.exowpee.com/v1/catalog/products/{product}/variants \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/products/{product}/variants"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exowpee.com/v1/catalog/products/{product}/variants', 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.exowpee.com/v1/catalog/products/{product}/variants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/products/{product}/variants"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.exowpee.com/v1/catalog/products/{product}/variants")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/products/{product}/variants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": "<string>",
"stockable_id": "<string>",
"title": "<string>",
"weight": 123,
"weight_unit_id": "<string>",
"volume": 123,
"volume_unit_id": "<string>",
"is_tracked": true,
"is_taxable": true,
"max_sellable_quantity": 123,
"max_sellable_unit_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"image": {},
"options": {},
"inventoryItem": {},
"levels": "<array>",
"units": "<array>",
"organization_id": "<string>",
"vat_rate_id": "<string>",
"tax_configuration_mode": "<string>",
"vat_rate": {},
"taxes": "<array>"
}
]{
"message": "<string>",
"errors": {}
}Add product variants
Adds one or more variants to an existing product.
curl --request POST \
--url https://api.exowpee.com/v1/catalog/products/{product}/variants \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/products/{product}/variants"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exowpee.com/v1/catalog/products/{product}/variants', 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.exowpee.com/v1/catalog/products/{product}/variants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/products/{product}/variants"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.exowpee.com/v1/catalog/products/{product}/variants")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/products/{product}/variants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": "<string>",
"stockable_id": "<string>",
"title": "<string>",
"weight": 123,
"weight_unit_id": "<string>",
"volume": 123,
"volume_unit_id": "<string>",
"is_tracked": true,
"is_taxable": true,
"max_sellable_quantity": 123,
"max_sellable_unit_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"image": {},
"options": {},
"inventoryItem": {},
"levels": "<array>",
"units": "<array>",
"organization_id": "<string>",
"vat_rate_id": "<string>",
"tax_configuration_mode": "<string>",
"vat_rate": {},
"taxes": "<array>"
}
]{
"message": "<string>",
"errors": {}
}product_variants.create, products.update
Conditions
- Both products.update on the product and product_variants.create are needed.
- Each variant needs at least one unit with at least one price; options must be present (it may be empty).
- Option combinations must not repeat inside the request nor match an existing variant of the product.
- SKUs and barcodes must not repeat inside the payload and are unique per organization when set.
- Fiscal fields (tax_configuration_mode, is_taxable, vat_rate_id) also require the permission to update item taxes.
- Weight, volume and maximum sellable quantity need their unit and must match the kind of measure or the product’s unit category.
- Creates one item per variant (status draft, tracking copied from the product, purchase nature goods) and a stock record when tracked.
- Creates options, option values, variants, units of sale and prices; all in one transaction.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the product that receives the variants (27-character KSUID).
Query Parameters
Response mode. Default none; none answers 204 No Content.
none, resource Comma-separated JSON keys of the root resource (id is always rendered). Available: vat_rate_id, tax_configuration_mode, id, stockable_id, title, weight, weight_unit_id, volume, volume_unit_id, is_tracked, is_taxable, max_sellable_quantity, max_sellable_unit_id, created_at, updated_at, options, organization_id.
Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: vat_rate, taxes, image, inventoryItem, inventoryItem.stockable, inventoryItem.inventoryLevels, levels, levels.inventoryItem, levels.asset, levels.stocks, units, units.uomUnit, units.prices, units.stockable.
Response
Resource (only with response=resource).
Identifier of the variant (27-character KSUID).
Identifier of the item behind the variant (27-character KSUID).
Display title of the variant: the product title followed by its option values.
Weight of one unit of the variant, expressed in the unit given by weight_unit_id (converted back from the reference unit). Null when not set.
Identifier of the weight unit of weight (27-character KSUID), or null.
Volume of one unit of the variant, expressed in the unit given by volume_unit_id. Null when not set.
Identifier of the volume unit of volume (27-character KSUID), or null.
Whether stock is tracked for this variant.
Whether the variant is taxable according to its tax configuration (own or inherited).
Largest quantity that can be sold in one line, expressed in the unit given by max_sellable_unit_id. Null when there is no limit.
Identifier of the unit of max_sellable_quantity (27-character KSUID), or null.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).
Picture linked to this variant, or null. Present only when requested with include=image.
Option values of the variant keyed option1, option2, ... in position order, each with name and value.
Stock record of the variant, when stock is tracked. Present only when requested with include=inventoryItem.
Stock levels of the variant per asset, limited to those the current actor may see. Present only when requested with include=levels.
Sellable units of the variant with SKU, barcode and prices. Present only when requested with include=units.
Identifier of the organization the record belongs to.
Identifier of the VAT rate set on the variant, or null (27-character KSUID).
inherit when the variant takes its tax settings from its product category, custom when they are set on the variant itself.
VAT rate details. Present only when requested with include=vat_rate.
Taxes applied to the variant. Present only when requested with include=taxes.