Skip to main content

Create Product

You can create a product using this service. You no longer need to find category IDs - you can send category information directly as names.

New System

The old system used subCategoryBrandId which required you to navigate the category hierarchy to find the ID first. In the new system, you can send category names directly as strings. The system automatically handles the matching.

Request

curl --location --request POST '<BASE_URL>/merchant-products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <jwtToken>' \
--data '{
"mainCategoryName": "Electronics",
"categoryName": "Phone",
"subCategoryName": "Smartphone",
"brand": "Apple",
"name": "iPhone 15 Pro",
"warrantyYear": 2,
"model": "A2848",
"description": "Apple iPhone 15 Pro 256GB Titanium",
"setupRequired": false,
"productCode": "PRD-001",
"price": 49999.99
}'

Request Body

ParameterTypeRequired
Description
mainCategoryNameStringNoMain category name (e.g., "Electronics"). Max 255 characters.
categoryNameStringNoCategory name (e.g., "Phone"). Max 255 characters.
subCategoryNameStringNoSub category name (e.g., "Smartphone"). Max 255 characters.
brandStringNoBrand name (e.g., "Apple"). Max 255 characters.
nameStringYesProduct name. Max 255 characters.
warrantyYearIntegerYesWarranty duration in years. Can take values between 2 and 10.
modelStringNoProduct model. Max 255 characters.
descriptionStringNoProduct description. Max 1000 characters.
setupRequiredBooleanYesIndicates whether the product requires setup/installation.
productCodeStringYesUnique product code in your system. Max 255 characters.
priceDecimalNoProduct price. Minimum 0.

Response

Returns HTTP 201 (Created) on successful creation, together with the identifier of the created product.

{
"merchantProductId": 12345
}

Response Fields

FieldType
Description
merchantProductIdIntegerID of the created product
No Extra Lookup Needed

Previously this service returned an empty body, so you had to call Get ID By Product Code afterwards to learn the ID of the product you had just created. The merchantProductId is now returned directly in the creation response, so that second call is no longer necessary. The Get ID By Product Code service is still available and unchanged.

Duplicate Product Codes

The error behaviour is unchanged: sending the same productCode again for the same merchant still fails. This service is not idempotent, so do not retry a creation request that has already succeeded.

Example Usage Scenarios

Scenario 1: Creating a Product with Full Category Information

{
"mainCategoryName": "Electronics",
"categoryName": "Computer",
"subCategoryName": "Laptop",
"brand": "Apple",
"name": "MacBook Pro 14",
"warrantyYear": 2,
"model": "M3 Pro",
"description": "Apple MacBook Pro 14 inch M3 Pro 18GB RAM",
"setupRequired": false,
"productCode": "MBP-14-M3PRO",
"price": 89999.0
}

Scenario 2: Creating a Product without Category Information

Since category fields are optional, you can also create a product with only the required fields:

{
"name": "Generic Product",
"warrantyYear": 2,
"setupRequired": false,
"productCode": "GEN-001"
}