Create SKUs in Bulk


This endpoint is used to create new SKUs in bulk. You need to add all the details of the SKUs in an array in JSON format.

Basic Information

  • Method: POST
  • URI: /skus
  • Request Format: JSON
  • Response Format: JSON

Headers

The following headers should be sent along with the request

  • Accept: application/json
  • Authorization: Your API Key

Request

Below table list the request parameters which can be sent to create SKUs API in JSON format

{info} The request parameters should be sent as array of JSON objects in the request body

Parameter Type Required Description
sku_code String Yes It must be unique for each SKU. If you provide a SKU code which is already used somewhere else, then the system will update the existing SKU instead of creating a new one
cost Number Yes The cost of purchasing the product, like 300.
selling_price Number Yes The price at which the product is being sold, like 499.
retail_price Number Yes The Manufacturer's Retail Price (MRP) of the product, like 599.
type String Yes Allowed values: "simple", "bundle". This classification defines whether the SKU is a standalone product or part of a bundle.
handling_type String Yes Allowed values: "hot", "cold". This determines the appropriate storage or handling conditions for the SKU.
status String Yes Allowed values: "all", "live," "ready_to_list," "under_review," "draft," "un_sync," or "others. Indicates the status of the product.
name String No The name of the product, such as "Smart LED TV."
description String No A detailed description of the product, like "High-quality 4K Smart LED TV with Wi-Fi connectivity."
attributes Array of Objects No An array containing attributes that differentiate the SKU from other variations. Please check attributes table below for the details of the attributes
unit String No The measuring unit for the SKU, such as "pcs" (pieces).
sku_images Array of Objects No An array of images associated with the SKU. Please check images table below for the details of the images
categories Array of Objects No An array of category objects.
Object attributes:
1. name (string): The name of the category, such as "Electronics", "TV & Video."
manufacturer_name String No The name of the manufacturer, like "ABC Electronics."
brand_name String No The brand name associated with the product, like "BrandX."
country_of_origin String No The originating country of the product, like "CountryX."
is_weighted Boolean No A boolean indicating whether the SKU has weight considerations.
dimensions Object No An object representing the physical dimensions of the product. Please check dimensions table below for the details of the object
barcodes Array of Strings No An array of barcode strings associated with the SKU. For example ["barcode-1", "barcode-2"]
is_perishable Boolean No A boolean indicating whether the SKU is perishable (true or false).
configuration Object No An object with SKU configurations. Please check configuration table below for the details of the object
custom_attribute Array of Objects No An array of custom attribute objects. Please check custom attribute table below for the details of the objects
product_url URL No The URL associated with the product, like "https://example.com/tv."


"attributes" object

Parameter Type Required Description
name String No The name of the attribute, like "Screen Size."
sku_attribute_variation Object No An object with details about the attribute variation:
1. name (string): Variation name. e.g "Variation 1"


"sku_images" object

Parameter Type Required Description
default URL No The default image URL.
thumbnail URL No The thumbnail image URL.
medium URL No The medium-sized image URL.
large URL No The large-sized image URL.
url URL No The URL of the image.
type String No The type of the image, such as "image"
description String No A description of the image, like "Smart LED TV image."


"dimensions" object

Parameter Type Required Description
length Object No Length of the SKU, including:
1. length (number): The length value, such as 100.
2. unit (string): The unit of measurement, such as "cm."
breadth Object No Breadth of the SKU, including:
1. breadth (number): The breadth value, such as 10.
2. unit (string): The unit of measurement, such as "cm."
height Object No Height of the SKU, including:
1. height (number): The height value, such as 50.
2. unit (string): The unit of measurement, such as "cm."


"configuration" object

Parameter Type Required Description
weight Object No An object indicating the weight range:
1. min (string): The minimum weight, like "10 kg."
2. max (string): The maximum weight, like "15 kg."
3.type (string): The type of weight configuration, like "fixed."


"custom_attribute" object

Parameter Type Required Description
key String Yes The key of the custom attribute, like "discount_added"
value String Yes The value of the custom attribute, like "Yes"


Sample Request

URL:

https://dev-fc-api.aymakan.net/api/v1/skus


Body:

[
    {
        "name": "Smart LED TV",
        "description": "High-quality 4K Smart LED TV with Wi-Fi connectivity.",
        "sku_id": "tv_sku12342322",
        "sku_code": "SKU-TV-123423",
        "attributes": [
            {
                "name": "Screen Size",
                "sku_attribute_variation": {
                    "name": "Variation 1"
                }
            }
        ],
        "handling_type": "cold",
        "type": "simple",
        "status": "live",
        "unit": "pcs",
        "sku_images": [
            {
                "default": "https://images.unsplash.com/photo-1593305841991-05c297ba4575?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8M3x8dHZ8ZW58MHx8MHx8fDA%3D&auto=format&fit=crop&w=800&q=60",
                "thumbnail": "https://images.unsplash.com/photo-1593305841991-05c297ba4575?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8M3x8dHZ8ZW58MHx8MHx8fDA%3D&auto=format&fit=crop&w=800&q=60",
                "medium": "https://example.com/images/tv/medium.jpg",
                "large": "https://example.com/images/tv/large.jpg",
                "url": "https://example.com/images/tv/image.jpg",
                "type": "image",
                "description": "Smart LED TV image"
            }
        ],
        "categories": [
            {
                "name": "Electronics"
            },
            {
                "name": "TV & Video"
            }
        ],
        "manufacturer_name": "ABC Electronics",
        "brand_name": "BrandX",
        "country_of_origin": "CountryX",
        "is_weighted": false,
        "dimensions": {
            "length": {
                "length": 100,
                "unit": "cm"
            },
            "breadth": {
                "breadth": 10,
                "unit": "cm"
            },
            "height": {
                "height": 60,
                "unit": "cm"
            }
        },
        "barcodes": [
            "1234567890123",
            "9876543210987"
        ],
        "cost": 300,
        "retail_price": 599,
        "selling_price": 499,
        "is_perishable": false,
        "configuration": {
            "weight": {
                "min": "10 kg",
                "max": "15 kg",
                "type": "fixed"
            }
        },
        "custom_attribute": [
            {
                "key": "Smart TV",
                "value": "Yes"
            },
            {
                "key": "Resolution",
                "value": "4K"
            }
        ],
        "product_url": "https://example.com/tv"
    }
]

Response

Sample response is added here:

Success:

{
    "success": true,
    "message": "SKUs saved successfully",
    "data": null,
    "meta": null
}


Validation Error:
The HTTP response code will be 422 in this case

{
    "success": false,
    "message": "Validation Error",
    "data": null,
    "meta": null,
    "validation_errors": {
        "0.sku_code": "The sku_code field is required.",
        "0.handling_type": "The handling_type field is required."
    }
}