Create
curl --request POST \
--url https://{defaultHost}/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product": {
"name": "Test Product",
"dimensions": {
"length": 10,
"width": 5,
"height": 3,
"unit": "cm"
}
}
}
'import requests
url = "https://{defaultHost}/v1/products"
payload = { "product": {
"name": "Test Product",
"dimensions": {
"length": 10,
"width": 5,
"height": 3,
"unit": "cm"
}
} }
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({
product: {
name: 'Test Product',
dimensions: {length: 10, width: 5, height: 3, unit: 'cm'}
}
})
};
fetch('https://{defaultHost}/v1/products', 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://{defaultHost}/v1/products",
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([
'product' => [
'name' => 'Test Product',
'dimensions' => [
'length' => 10,
'width' => 5,
'height' => 3,
'unit' => 'cm'
]
]
]),
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://{defaultHost}/v1/products"
payload := strings.NewReader("{\n \"product\": {\n \"name\": \"Test Product\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 5,\n \"height\": 3,\n \"unit\": \"cm\"\n }\n }\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://{defaultHost}/v1/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product\": {\n \"name\": \"Test Product\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 5,\n \"height\": 3,\n \"unit\": \"cm\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/products")
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 \"product\": {\n \"name\": \"Test Product\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 5,\n \"height\": 3,\n \"unit\": \"cm\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "fcc35458-5636-4bd7-9c73-5992a8439e36",
"object": "product",
"allow_out_of_stock_purchases": false,
"archived": false,
"archived_at": null,
"auto_fulfill_enabled": true,
"available_stock": 0,
"average_stars": "0.0",
"bundle": false,
"description": null,
"dimensions": {
"length": 10,
"width": 5,
"height": 3,
"unit": "cm"
},
"held_stock": 0,
"featured": false,
"licensing_enabled": false,
"license_activation_limit": null,
"metadata": {},
"purchase_limit": null,
"metrics": {
"currency": "usd",
"max_price_amount": null,
"min_price_amount": null,
"prices_count": 0
},
"name": "Test Product",
"recurring": false,
"reviews_breakdown": {},
"reviews_enabled": true,
"shipping_enabled": false,
"sku": null,
"slug": "test-product-1",
"solicit_reviews": true,
"status": "draft",
"stock": 0,
"stock_enabled": false,
"tax_enabled": true,
"tax_category": "tangible",
"hs_code": null,
"country_of_origin": null,
"manufacturer_code": null,
"weight": 0,
"weight_unit": "lb",
"commission_structure": null,
"featured_product_media": null,
"product_group": null,
"current_release_download": null,
"shipping_profile": null,
"cataloged_at": 1793796938,
"discarded_at": null,
"created_at": 1793796939,
"updated_at": 1793796939
}Products
Create
Creates a new product.
POST
/
v1
/
products
Create
curl --request POST \
--url https://{defaultHost}/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product": {
"name": "Test Product",
"dimensions": {
"length": 10,
"width": 5,
"height": 3,
"unit": "cm"
}
}
}
'import requests
url = "https://{defaultHost}/v1/products"
payload = { "product": {
"name": "Test Product",
"dimensions": {
"length": 10,
"width": 5,
"height": 3,
"unit": "cm"
}
} }
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({
product: {
name: 'Test Product',
dimensions: {length: 10, width: 5, height: 3, unit: 'cm'}
}
})
};
fetch('https://{defaultHost}/v1/products', 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://{defaultHost}/v1/products",
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([
'product' => [
'name' => 'Test Product',
'dimensions' => [
'length' => 10,
'width' => 5,
'height' => 3,
'unit' => 'cm'
]
]
]),
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://{defaultHost}/v1/products"
payload := strings.NewReader("{\n \"product\": {\n \"name\": \"Test Product\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 5,\n \"height\": 3,\n \"unit\": \"cm\"\n }\n }\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://{defaultHost}/v1/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product\": {\n \"name\": \"Test Product\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 5,\n \"height\": 3,\n \"unit\": \"cm\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/products")
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 \"product\": {\n \"name\": \"Test Product\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 5,\n \"height\": 3,\n \"unit\": \"cm\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "fcc35458-5636-4bd7-9c73-5992a8439e36",
"object": "product",
"allow_out_of_stock_purchases": false,
"archived": false,
"archived_at": null,
"auto_fulfill_enabled": true,
"available_stock": 0,
"average_stars": "0.0",
"bundle": false,
"description": null,
"dimensions": {
"length": 10,
"width": 5,
"height": 3,
"unit": "cm"
},
"held_stock": 0,
"featured": false,
"licensing_enabled": false,
"license_activation_limit": null,
"metadata": {},
"purchase_limit": null,
"metrics": {
"currency": "usd",
"max_price_amount": null,
"min_price_amount": null,
"prices_count": 0
},
"name": "Test Product",
"recurring": false,
"reviews_breakdown": {},
"reviews_enabled": true,
"shipping_enabled": false,
"sku": null,
"slug": "test-product-1",
"solicit_reviews": true,
"status": "draft",
"stock": 0,
"stock_enabled": false,
"tax_enabled": true,
"tax_category": "tangible",
"hs_code": null,
"country_of_origin": null,
"manufacturer_code": null,
"weight": 0,
"weight_unit": "lb",
"commission_structure": null,
"featured_product_media": null,
"product_group": null,
"current_release_download": null,
"shipping_profile": null,
"cataloged_at": 1793796938,
"discarded_at": null,
"created_at": 1793796939,
"updated_at": 1793796939
}Authorizations
Response
200 - application/json
Success
Expandable – Property not returned unless expanded.
Expandable – The associated commission structure ID.
Expandable – The associated download ID.
Expandable – Property not returned unless expanded.
The featured (first) product media.
Expandable – The associated product media ID.
Expandable – Property not returned unless expanded.
Expandable – Property not returned unless expanded.
Expandable – The associated product group ID.
Expandable – Property not returned unless expanded.
Expandable – The associated shipping profile ID.
Expandable – Property not returned unless expanded.
Expandable – Property not returned unless expanded.
Expandable – Property not returned unless expanded.
Was this page helpful?