The "Create Product" API allows adding a new product to the system. Use this endpoint to create a product with the specified details. Ensure that the required information is provided in the request payload.
POST https://services.leadconnectorhq.com/products/Authorization
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer token generated from the Leadway portal. See Authentication. | |
Version | string | Yes | 2021-07-28 | API version. |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
name | string | Yes | Awesome Product | The name of the product. |
locationId | string | Yes | 3SwdhCsvxI8Au3KsPJt6 | The unique identifier for the account. |
description | string | No | Product description goes here. | A brief description of the product. |
productType | string | Yes | Possible values: 'DIGITAL', 'PHYSICAL', 'SERVICE', 'PHYSICAL/DIGITAL' | |
image | string | No | https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/65af8d5df88bdb4b1022ee90.png | The URL for the product image. |
statementDescriptor | string | No | abcde | The statement descriptor for the product. |
availableInStore | boolean | No | True | Indicates whether the product is available in-store. |
medias(object[]): An array of medias for the product.id(string, required): The unique identifier for the media. Example:fzrgusiuu0mtitle(string): The title of the media file. Example:1dd7dcd0-e71d-4cf7-a06b-6d47723d6a29.pngurl(string, required): The URL where the media file is stored. Example:https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/sample.pngtype(string, required): The type of the media file (e.g., image, video will be supporting soon). Possible values: 'image', 'video' Example:imageisFeatured(boolean): Indicates whether the media is featured. Example:TruepriceIds(array[]): Mongo ObjectIds of the prices for which the media is assigned Example:6578278e879ad2646715ba9c
variants(object[]): An array of variants for the product.id(string, required): A unique identifier for the variant. Example:38s63qmxfr4name(string, required): The name of the variant. Example:Sizeoptions(object[], required): An array of options for the variant.id(string, required): The unique identifier for the option. Example:h4z7u0im2q8name(string, required): The name of the option. Example:XL
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
collectionIds | string[] | No | An array of category Ids for the product | |
isTaxesEnabled | boolean | No | True | Are there any taxes attached to the product. If this is true, taxes array cannot be empty. |
taxes | string[] | No | List of ids of Taxes attached to the Product. If taxes are passed, isTaxesEnabled should be true. | |
automaticTaxCategoryId | string | No | 65d71377c326ea78e1c47df5 | Tax category ID for Automatic taxes calculation. |
isLabelEnabled | boolean | No | True | Is the product label enabled. If this is true, label object cannot be empty. |
label | object | No | Details for Product Label | |
slug | string | No | awesome-product | The slug using which the product navigation will be handled |
seo | object | No | SEO data for the product that will be displayed in the preview | |
taxInclusive | boolean | No | True | Whether the taxes should be included in the purchase price |
Responses
201 - Successful response
_id(string, required): The unique identifier for the product. Example:655b33a82209e60b6adb87a5description(string): product description Example:This is a really awesome productvariants(object[]): An array of variants for the product.id(string, required): A unique identifier for the variant. Example:38s63qmxfr4name(string, required): The name of the variant. Example:Sizeoptions(object[], required): An array of options for the variant.id(string, required): The unique identifier for the option. Example:h4z7u0im2q8name(string, required): The name of the option. Example:XL
locationId(string, required): The unique identifier for the account. Example:3SwdhCsvxI8Au3KsPJt6name(string, required): The name of the product. Example:Awesome ProductproductType(string, required): The type of the product (e.g., PHYSICAL). Example:PHYSICALavailableInStore(boolean): Indicates whether the product is available in-store. Example:TruecreatedAt(string, required): The creation timestamp of the product. Example:2023-11-20T10:23:36.515ZupdatedAt(string, required): The last update timestamp of the product. Example:2024-01-23T09:57:04.846ZstatementDescriptor(string): The statement descriptor for the product. Example:abcdeimage(string): The URL for the product image. Example:https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/65af8d5df88bdb4b1022ee90.pngcollectionIds(string[]): An array of category Ids for the productisTaxesEnabled(boolean): The field indicates whether taxes are enabled for the product or not. Example:Truetaxes(string[]): An array of ids of Taxes attached to the Product. If the expand query includes tax, the taxes will be of typeProductTaxDto. Please refer to theProductTaxDtofor additional details.automaticTaxCategoryId(string): Tax category ID for Automatic taxes calculation. Example:65d71377c326ea78e1c47df5label(object): The Product label detailsslug(string): The slug of the product by which the product will be navigated Example:washing-machine
{
"_id": "655b33a82209e60b6adb87a5",
"description": "This is a really awesome product",
"variants": [
{
"id": "38s63qmxfr4",
"name": "Size",
"options": [
{}
]
}
],
"locationId": "3SwdhCsvxI8Au3KsPJt6",
"name": "Awesome Product",
"productType": "PHYSICAL",
"availableInStore": true,
"createdAt": "2023-11-20T10:23:36.515Z",
"updatedAt": "2024-01-23T09:57:04.846Z",
"statementDescriptor": "abcde",
"image": "https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/65af8d5df88bdb4b1022ee90.png",
"collectionIds": [
"65d71377c326ea78e1c47df5",
"65d71377c326ea78e1c47d34"
],
"isTaxesEnabled": true,
"taxes": [
"654492a4e6bef380114de15a"
],
"automaticTaxCategoryId": "65d71377c326ea78e1c47df5",
"slug": "washing-machine"
}400 - Bad Request
{}422 - Unprocessable Entity
{}Example
curl -X POST 'https://services.leadconnectorhq.com/products/' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"name": "Awesome Product",
"locationId": "3SwdhCsvxI8Au3KsPJt6",
"description": "Product description goes here.",
"productType": "DIGITAL",
"image": "https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/65af8d5df88bdb4b1022ee90.png",
"statementDescriptor": "abcde",
"availableInStore": true,
"medias": [
{
"id": "fzrgusiuu0m",
"title": "1dd7dcd0-e71d-4cf7-a06b-6d47723d6a29.png",
"url": "https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/sample.png",
"type": "image",
"isFeatured": true,
"priceIds": "6578278e879ad2646715ba9c"
}
],
"variants": [
{
"id": "38s63qmxfr4",
"name": "Size",
"options": [
{}
]
}
],
"collectionIds": [
"65d71377c326ea78e1c47df5",
"65d71377c326ea78e1c47d34"
],
"isTaxesEnabled": true,
"taxes": [
"654492a4e6bef380114de15a"
],
"automaticTaxCategoryId": "65d71377c326ea78e1c47df5",
"isLabelEnabled": true,
"slug": "awesome-product",
"taxInclusive": true
}'const response = await fetch('https://services.leadconnectorhq.com/products/', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"name": "Awesome Product", "locationId": "3SwdhCsvxI8Au3KsPJt6", "description": "Product description goes here.", "productType": "DIGITAL", "image": "https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/65af8d5df88bdb4b1022ee90.png", "statementDescriptor": "abcde", "availableInStore": true, "medias": [{"id": "fzrgusiuu0m", "title": "1dd7dcd0-e71d-4cf7-a06b-6d47723d6a29.png", "url": "https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/sample.png", "type": "image", "isFeatured": true, "priceIds": "6578278e879ad2646715ba9c"}], "variants": [{"id": "38s63qmxfr4", "name": "Size", "options": [{}]}], "collectionIds": ["65d71377c326ea78e1c47df5", "65d71377c326ea78e1c47d34"], "isTaxesEnabled": true, "taxes": ["654492a4e6bef380114de15a"], "automaticTaxCategoryId": "65d71377c326ea78e1c47df5", "isLabelEnabled": true, "slug": "awesome-product", "taxInclusive": true}),
});
const data = await response.json();import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/products/',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"name": "Awesome Product", "locationId": "3SwdhCsvxI8Au3KsPJt6", "description": "Product description goes here.", "productType": "DIGITAL", "image": "https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/65af8d5df88bdb4b1022ee90.png", "statementDescriptor": "abcde", "availableInStore": true, "medias": [{"id": "fzrgusiuu0m", "title": "1dd7dcd0-e71d-4cf7-a06b-6d47723d6a29.png", "url": "https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/sample.png", "type": "image", "isFeatured": true, "priceIds": "6578278e879ad2646715ba9c"}], "variants": [{"id": "38s63qmxfr4", "name": "Size", "options": [{}]}], "collectionIds": ["65d71377c326ea78e1c47df5", "65d71377c326ea78e1c47d34"], "isTaxesEnabled": true, "taxes": ["654492a4e6bef380114de15a"], "automaticTaxCategoryId": "65d71377c326ea78e1c47df5", "isLabelEnabled": true, "slug": "awesome-product", "taxInclusive": true},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/products/');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'name': 'Awesome Product', 'locationId': '3SwdhCsvxI8Au3KsPJt6', 'description': 'Product description goes here.', 'productType': 'DIGITAL', 'image': 'https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/65af8d5df88bdb4b1022ee90.png', 'statementDescriptor': 'abcde', 'availableInStore': true, 'medias': [{'id': 'fzrgusiuu0m', 'title': '1dd7dcd0-e71d-4cf7-a06b-6d47723d6a29.png', 'url': 'https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/sample.png', 'type': 'image', 'isFeatured': true, 'priceIds': '6578278e879ad2646715ba9c'}], 'variants': [{'id': '38s63qmxfr4', 'name': 'Size', 'options': [{}]}], 'collectionIds': ['65d71377c326ea78e1c47df5', '65d71377c326ea78e1c47d34'], 'isTaxesEnabled': true, 'taxes': ['654492a4e6bef380114de15a'], 'automaticTaxCategoryId': '65d71377c326ea78e1c47df5', 'isLabelEnabled': true, 'slug': 'awesome-product', 'taxInclusive': true}),
]);
$data = json_decode(curl_exec($ch), true);