Create a product
Create a product. Set update_existing_product_by_url to true to find an existing product with the same URL and update it instead.
curl --request POST \
--url https://{domain}/api/site/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'User-Agent: <api-key>' \
--data '
{
"title": "Interior Door",
"description": "<string>",
"url": "interior-door",
"hidden": true,
"images": [
"<string>"
],
"categories": [
{
"id": 1,
"name": "Doors",
"url": "doors",
"parentCategory": 0
}
],
"options": [
{
"name": "Material",
"values": [
"Wood",
"Glass"
],
"advanced": true
}
],
"variants": [
{
"options": [
"Wood",
"Single"
],
"price": 199,
"onSale": true,
"regularPrice": 123,
"salePrice": 123,
"quantity": 123,
"sku": "D-001",
"weight": 123
}
],
"subscription": {
"cycles": 123,
"period": 123
},
"file": "<string>"
}
'import requests
url = "https://{domain}/api/site/products"
payload = {
"title": "Interior Door",
"description": "<string>",
"url": "interior-door",
"hidden": True,
"images": ["<string>"],
"categories": [
{
"id": 1,
"name": "Doors",
"url": "doors",
"parentCategory": 0
}
],
"options": [
{
"name": "Material",
"values": ["Wood", "Glass"],
"advanced": True
}
],
"variants": [
{
"options": ["Wood", "Single"],
"price": 199,
"onSale": True,
"regularPrice": 123,
"salePrice": 123,
"quantity": 123,
"sku": "D-001",
"weight": 123
}
],
"subscription": {
"cycles": 123,
"period": 123
},
"file": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"User-Agent": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'User-Agent': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Interior Door',
description: '<string>',
url: 'interior-door',
hidden: true,
images: ['<string>'],
categories: [{id: 1, name: 'Doors', url: 'doors', parentCategory: 0}],
options: [{name: 'Material', values: ['Wood', 'Glass'], advanced: true}],
variants: [
{
options: ['Wood', 'Single'],
price: 199,
onSale: true,
regularPrice: 123,
salePrice: 123,
quantity: 123,
sku: 'D-001',
weight: 123
}
],
subscription: {cycles: 123, period: 123},
file: '<string>'
})
};
fetch('https://{domain}/api/site/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://{domain}/api/site/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([
'title' => 'Interior Door',
'description' => '<string>',
'url' => 'interior-door',
'hidden' => true,
'images' => [
'<string>'
],
'categories' => [
[
'id' => 1,
'name' => 'Doors',
'url' => 'doors',
'parentCategory' => 0
]
],
'options' => [
[
'name' => 'Material',
'values' => [
'Wood',
'Glass'
],
'advanced' => true
]
],
'variants' => [
[
'options' => [
'Wood',
'Single'
],
'price' => 199,
'onSale' => true,
'regularPrice' => 123,
'salePrice' => 123,
'quantity' => 123,
'sku' => 'D-001',
'weight' => 123
]
],
'subscription' => [
'cycles' => 123,
'period' => 123
],
'file' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"User-Agent: <api-key>"
],
]);
$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://{domain}/api/site/products"
payload := strings.NewReader("{\n \"title\": \"Interior Door\",\n \"description\": \"<string>\",\n \"url\": \"interior-door\",\n \"hidden\": true,\n \"images\": [\n \"<string>\"\n ],\n \"categories\": [\n {\n \"id\": 1,\n \"name\": \"Doors\",\n \"url\": \"doors\",\n \"parentCategory\": 0\n }\n ],\n \"options\": [\n {\n \"name\": \"Material\",\n \"values\": [\n \"Wood\",\n \"Glass\"\n ],\n \"advanced\": true\n }\n ],\n \"variants\": [\n {\n \"options\": [\n \"Wood\",\n \"Single\"\n ],\n \"price\": 199,\n \"onSale\": true,\n \"regularPrice\": 123,\n \"salePrice\": 123,\n \"quantity\": 123,\n \"sku\": \"D-001\",\n \"weight\": 123\n }\n ],\n \"subscription\": {\n \"cycles\": 123,\n \"period\": 123\n },\n \"file\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("User-Agent", "<api-key>")
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://{domain}/api/site/products")
.header("Authorization", "Bearer <token>")
.header("User-Agent", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Interior Door\",\n \"description\": \"<string>\",\n \"url\": \"interior-door\",\n \"hidden\": true,\n \"images\": [\n \"<string>\"\n ],\n \"categories\": [\n {\n \"id\": 1,\n \"name\": \"Doors\",\n \"url\": \"doors\",\n \"parentCategory\": 0\n }\n ],\n \"options\": [\n {\n \"name\": \"Material\",\n \"values\": [\n \"Wood\",\n \"Glass\"\n ],\n \"advanced\": true\n }\n ],\n \"variants\": [\n {\n \"options\": [\n \"Wood\",\n \"Single\"\n ],\n \"price\": 199,\n \"onSale\": true,\n \"regularPrice\": 123,\n \"salePrice\": 123,\n \"quantity\": 123,\n \"sku\": \"D-001\",\n \"weight\": 123\n }\n ],\n \"subscription\": {\n \"cycles\": 123,\n \"period\": 123\n },\n \"file\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/site/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["User-Agent"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Interior Door\",\n \"description\": \"<string>\",\n \"url\": \"interior-door\",\n \"hidden\": true,\n \"images\": [\n \"<string>\"\n ],\n \"categories\": [\n {\n \"id\": 1,\n \"name\": \"Doors\",\n \"url\": \"doors\",\n \"parentCategory\": 0\n }\n ],\n \"options\": [\n {\n \"name\": \"Material\",\n \"values\": [\n \"Wood\",\n \"Glass\"\n ],\n \"advanced\": true\n }\n ],\n \"variants\": [\n {\n \"options\": [\n \"Wood\",\n \"Single\"\n ],\n \"price\": 199,\n \"onSale\": true,\n \"regularPrice\": 123,\n \"salePrice\": 123,\n \"quantity\": 123,\n \"sku\": \"D-001\",\n \"weight\": 123\n }\n ],\n \"subscription\": {\n \"cycles\": 123,\n \"period\": 123\n },\n \"file\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 111,
"type": "physical",
"title": "Interior Door",
"description": "<string>",
"url": "interior-door",
"hidden": true,
"images": [
"https://path-to-image.jpg",
"https://path-to-another-image.jpg"
],
"categories": [
{
"id": 1,
"name": "Doors",
"url": "doors",
"parentCategory": 0
}
],
"options": [
{
"name": "Material",
"values": [
"Wood",
"Glass"
],
"advanced": true
}
],
"variants": [
{
"options": [
"Wood",
"Single"
],
"price": 199,
"onSale": true,
"regularPrice": 123,
"salePrice": 123,
"quantity": 123,
"sku": "D-001",
"weight": 123
}
],
"subscription": {
"cycles": 123,
"period": 123,
"periodUnit": "WEEKLY"
},
"file": "<string>"
}Authorizations
Pass your API key as: Authorization: Bearer <API KEY>.
Client identifier sent with requests from the documentation playground.
Query Parameters
If true and a product with the same URL exists, the existing product is updated instead.
true
Body
physical, digital, service, membership "Interior Door"
"interior-door"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Subscription details for a subscription product.
Show child attributes
Show child attributes
Response
The created or updated product.
Unique identifier.
111
The type of the product.
physical, digital, service, membership "Interior Door"
Supports light HTML formatting.
The product URL (handle) in your store.
"interior-door"
Whether the product is hidden in your store front.
[
"https://path-to-image.jpg",
"https://path-to-another-image.jpg"
]
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Subscription details for a subscription product.
Show child attributes
Show child attributes
Digital products only - URL of the digital file being sold.
Was this page helpful?
curl --request POST \
--url https://{domain}/api/site/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'User-Agent: <api-key>' \
--data '
{
"title": "Interior Door",
"description": "<string>",
"url": "interior-door",
"hidden": true,
"images": [
"<string>"
],
"categories": [
{
"id": 1,
"name": "Doors",
"url": "doors",
"parentCategory": 0
}
],
"options": [
{
"name": "Material",
"values": [
"Wood",
"Glass"
],
"advanced": true
}
],
"variants": [
{
"options": [
"Wood",
"Single"
],
"price": 199,
"onSale": true,
"regularPrice": 123,
"salePrice": 123,
"quantity": 123,
"sku": "D-001",
"weight": 123
}
],
"subscription": {
"cycles": 123,
"period": 123
},
"file": "<string>"
}
'import requests
url = "https://{domain}/api/site/products"
payload = {
"title": "Interior Door",
"description": "<string>",
"url": "interior-door",
"hidden": True,
"images": ["<string>"],
"categories": [
{
"id": 1,
"name": "Doors",
"url": "doors",
"parentCategory": 0
}
],
"options": [
{
"name": "Material",
"values": ["Wood", "Glass"],
"advanced": True
}
],
"variants": [
{
"options": ["Wood", "Single"],
"price": 199,
"onSale": True,
"regularPrice": 123,
"salePrice": 123,
"quantity": 123,
"sku": "D-001",
"weight": 123
}
],
"subscription": {
"cycles": 123,
"period": 123
},
"file": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"User-Agent": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'User-Agent': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Interior Door',
description: '<string>',
url: 'interior-door',
hidden: true,
images: ['<string>'],
categories: [{id: 1, name: 'Doors', url: 'doors', parentCategory: 0}],
options: [{name: 'Material', values: ['Wood', 'Glass'], advanced: true}],
variants: [
{
options: ['Wood', 'Single'],
price: 199,
onSale: true,
regularPrice: 123,
salePrice: 123,
quantity: 123,
sku: 'D-001',
weight: 123
}
],
subscription: {cycles: 123, period: 123},
file: '<string>'
})
};
fetch('https://{domain}/api/site/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://{domain}/api/site/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([
'title' => 'Interior Door',
'description' => '<string>',
'url' => 'interior-door',
'hidden' => true,
'images' => [
'<string>'
],
'categories' => [
[
'id' => 1,
'name' => 'Doors',
'url' => 'doors',
'parentCategory' => 0
]
],
'options' => [
[
'name' => 'Material',
'values' => [
'Wood',
'Glass'
],
'advanced' => true
]
],
'variants' => [
[
'options' => [
'Wood',
'Single'
],
'price' => 199,
'onSale' => true,
'regularPrice' => 123,
'salePrice' => 123,
'quantity' => 123,
'sku' => 'D-001',
'weight' => 123
]
],
'subscription' => [
'cycles' => 123,
'period' => 123
],
'file' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"User-Agent: <api-key>"
],
]);
$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://{domain}/api/site/products"
payload := strings.NewReader("{\n \"title\": \"Interior Door\",\n \"description\": \"<string>\",\n \"url\": \"interior-door\",\n \"hidden\": true,\n \"images\": [\n \"<string>\"\n ],\n \"categories\": [\n {\n \"id\": 1,\n \"name\": \"Doors\",\n \"url\": \"doors\",\n \"parentCategory\": 0\n }\n ],\n \"options\": [\n {\n \"name\": \"Material\",\n \"values\": [\n \"Wood\",\n \"Glass\"\n ],\n \"advanced\": true\n }\n ],\n \"variants\": [\n {\n \"options\": [\n \"Wood\",\n \"Single\"\n ],\n \"price\": 199,\n \"onSale\": true,\n \"regularPrice\": 123,\n \"salePrice\": 123,\n \"quantity\": 123,\n \"sku\": \"D-001\",\n \"weight\": 123\n }\n ],\n \"subscription\": {\n \"cycles\": 123,\n \"period\": 123\n },\n \"file\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("User-Agent", "<api-key>")
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://{domain}/api/site/products")
.header("Authorization", "Bearer <token>")
.header("User-Agent", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Interior Door\",\n \"description\": \"<string>\",\n \"url\": \"interior-door\",\n \"hidden\": true,\n \"images\": [\n \"<string>\"\n ],\n \"categories\": [\n {\n \"id\": 1,\n \"name\": \"Doors\",\n \"url\": \"doors\",\n \"parentCategory\": 0\n }\n ],\n \"options\": [\n {\n \"name\": \"Material\",\n \"values\": [\n \"Wood\",\n \"Glass\"\n ],\n \"advanced\": true\n }\n ],\n \"variants\": [\n {\n \"options\": [\n \"Wood\",\n \"Single\"\n ],\n \"price\": 199,\n \"onSale\": true,\n \"regularPrice\": 123,\n \"salePrice\": 123,\n \"quantity\": 123,\n \"sku\": \"D-001\",\n \"weight\": 123\n }\n ],\n \"subscription\": {\n \"cycles\": 123,\n \"period\": 123\n },\n \"file\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/site/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["User-Agent"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Interior Door\",\n \"description\": \"<string>\",\n \"url\": \"interior-door\",\n \"hidden\": true,\n \"images\": [\n \"<string>\"\n ],\n \"categories\": [\n {\n \"id\": 1,\n \"name\": \"Doors\",\n \"url\": \"doors\",\n \"parentCategory\": 0\n }\n ],\n \"options\": [\n {\n \"name\": \"Material\",\n \"values\": [\n \"Wood\",\n \"Glass\"\n ],\n \"advanced\": true\n }\n ],\n \"variants\": [\n {\n \"options\": [\n \"Wood\",\n \"Single\"\n ],\n \"price\": 199,\n \"onSale\": true,\n \"regularPrice\": 123,\n \"salePrice\": 123,\n \"quantity\": 123,\n \"sku\": \"D-001\",\n \"weight\": 123\n }\n ],\n \"subscription\": {\n \"cycles\": 123,\n \"period\": 123\n },\n \"file\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 111,
"type": "physical",
"title": "Interior Door",
"description": "<string>",
"url": "interior-door",
"hidden": true,
"images": [
"https://path-to-image.jpg",
"https://path-to-another-image.jpg"
],
"categories": [
{
"id": 1,
"name": "Doors",
"url": "doors",
"parentCategory": 0
}
],
"options": [
{
"name": "Material",
"values": [
"Wood",
"Glass"
],
"advanced": true
}
],
"variants": [
{
"options": [
"Wood",
"Single"
],
"price": 199,
"onSale": true,
"regularPrice": 123,
"salePrice": 123,
"quantity": 123,
"sku": "D-001",
"weight": 123
}
],
"subscription": {
"cycles": 123,
"period": 123,
"periodUnit": "WEEKLY"
},
"file": "<string>"
}
