Documentation
Feedback
Guides

Managing SKUs

Learn how to create, update, and activate an SKU with the Catalog API.

This step-by-step guide will walk you through the process of creating, updating, and activating a Stock Keeping Unit (SKU) within the VTEX platform. An SKU represents a specific item in the inventory that customers can purchase, essentially serving as a unique product variation, such as a "long sleeve gray size S shirt."

Before you begin

Before you begin managing your SKUs, make sure you've completed the following steps:

  • Create a Product: Your SKUs should be associated with an existing product. If you haven't created a product yet, refer to the Product for more information.
  • Obtain API Credentials: Ensure you have a valid appKey and appToken with the necessary permissions to access the Catalog API. For more information, please refer to the Roles article.

Click the steps below to navigate through this article and explore specific topics. Relevant code will be highlighted and focused for your convenience. Additionally, in the code viewer on the right, you can switch between different code files or tabs to view the corresponding code examples.

Creating an SKU

Send a request to the Create SKU endpoint to create a new SKU, considering the following points when building the request body:

  • IsActive: Ensure that IsActive is set to false. Activating it during creation will result in a 400 Bad Request error.
  • ActivateIfPossible: It's recommended to set ActivateIfPossible as true, unless you plan to have an internal workflow to manually activate SKUs.
  • Alternate IDs: Provide at least one of the following IDs in the request body: RefId or EAN. You can also provide both if necessary.

When sending the request body, you can specify the desired SKU Id or let VTEX automatically generate it, as presented in the following.

Custom Id: Request body

If there is a need to create a new SKU with a specific custom Id, specify the Id (integer) in the request body.

Shell
Python
Node.js

_10
curl --request post \
_10
--url https://{accountName}.vtexcommercestable.com.br/api/catalog/pvt/stockkeepingunit \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}' \
_10
--data '{body}'

Body
Response

_29
{
_29
"Id": 1,
_29
"ProductId": 310117069,
_29
"IsActive": false,
_29
"ActivateIfPossible": true,
_29
"Name": "sku test",
_29
"RefId": "125478",
_29
"Ean": "8949461894984",
_29
"PackagedHeight": 10,
_29
"PackagedLength": 10,
_29
"PackagedWidth": 10,
_29
"PackagedWeightKg": 10,
_29
"Height": null,
_29
"Length": null,
_29
"Width": null,
_29
"WeightKg": null,
_29
"CubicWeight": 0.1667,
_29
"IsKit": false,
_29
"CreationDate": null,
_29
"RewardValue": null,
_29
"EstimatedDateArrival": null,
_29
"ManufacturerCode": "123",
_29
"CommercialConditionId": 1,
_29
"MeasurementUnit": "un",
_29
"UnitMultiplier": 2.0,
_29
"ModalType": null,
_29
"KitItensSellApart": false,
_29
"Videos": ["https://www.youtube.com/"]
_29
}

Automatically generated ID: Request body

If there's no need to specify a custom Id, you can omit it from the request body, and VTEX will automatically generate the Id.

Shell
Python
Node.js

_10
curl --request post \
_10
--url https://{accountName}.vtexcommercestable.com.br/api/catalog/pvt/stockkeepingunit \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}' \
_10
--data '{body}'

Body
Response

_28
{
_28
"ProductId": 310117069,
_28
"IsActive": false,
_28
"ActivateIfPossible": true,
_28
"Name": "sku test",
_28
"RefId": "125478",
_28
"Ean": "8949461894984",
_28
"PackagedHeight": 10,
_28
"PackagedLength": 10,
_28
"PackagedWidth": 10,
_28
"PackagedWeightKg": 10,
_28
"Height": null,
_28
"Length": null,
_28
"Width": null,
_28
"WeightKg": null,
_28
"CubicWeight": 0.1667,
_28
"IsKit": false,
_28
"CreationDate": null,
_28
"RewardValue": null,
_28
"EstimatedDateArrival": null,
_28
"ManufacturerCode": "123",
_28
"CommercialConditionId": 1,
_28
"MeasurementUnit": "un",
_28
"UnitMultiplier": 2.0,
_28
"ModalType": null,
_28
"KitItensSellApart": false,
_28
"Videos": ["https://www.youtube.com/"]
_28
}

Updating an SKU

After successfully creating an SKU, you can update its details by sending a request to the Update SKU endpoint. To update an SKU, provide the SKU's unique skuId in the URL and include the updated information in the request body.

Shell
Python
Node.js

_10
curl --request put \
_10
--url 'https://{accountName}.vtexcommercestable.com.br/api/catalog/pvt/stockkeepingunit/{skuId}' \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}' \
_10
--data '{body}'

Body
Response

_27
{
_27
"Id": 70,
_27
"ProductId": 42,
_27
"IsActive": true,
_27
"Name": "Size 10",
_27
"RefId": "B096QW8Y8Z",
_27
"PackagedHeight": 15.0,
_27
"PackagedLength": 15.0,
_27
"PackagedWidth": 15.0,
_27
"PackagedWeightKg": 15.0,
_27
"Height": null,
_27
"Length": null,
_27
"Width": null,
_27
"WeightKg": null,
_27
"CubicWeight": 0.0,
_27
"IsKit": false,
_27
"CreationDate": "2020-01-25T15:51:00",
_27
"RewardValue": null,
_27
"EstimatedDateArrival": null,
_27
"ManufacturerCode": null,
_27
"CommercialConditionId": 1,
_27
"MeasurementUnit": "un",
_27
"UnitMultiplier": 1.0,
_27
"ModalType": null,
_27
"KitItensSellApart": false,
_27
"Videos": []
_27
}

Activating an SKU

Activating an SKU means making it available for purchase in your store, allowing customers to browse, search, and buy the associated product. To be activated, ensure your SKU meets the following requirements:

  • Alternate IDs: The SKU must have at least one of the following alternate IDs configured: RefId or EAN.
  • Image: The SKU must have at least one image associated with it. Use the Create SKU file endpoint to associate an image to an SKU.
  • Specifications: If the SKU has specifications, they must be filled in.
  • Kit: For kit SKUs, at least one component must be active.
  • Product: The SKU must be associated with an active product, which, in turn, must be related to an active Brand and an active Category.

Once the SKU meets these requirements, you can activate it using one of the following methods: automatic or manual.

Automatic activation

If your SKU's IsActive is set to false and ActivateIfPossible is set to true, your SKU will automatically become active as soon as it is associated with an image or an active component.

Here's an overview of the necessary steps to implement automatic SKU activation:

  1. Create the SKU, setting IsActive as false and ActivateIfPossible as true.
  2. If the SKU is a kit, create and associate SKU components.
  3. Create and associate SKU files.
Response

_29
{
_29
"Id": 1,
_29
"ProductId": 310117069,
_29
"IsActive": false,
_29
"ActivateIfPossible": true,
_29
"Name": "sku test",
_29
"RefId": "125478",
_29
"Ean": "8949461894984",
_29
"PackagedHeight": 10,
_29
"PackagedLength": 10,
_29
"PackagedWidth": 10,
_29
"PackagedWeightKg": 10,
_29
"Height": null,
_29
"Length": null,
_29
"Width": null,
_29
"WeightKg": null,
_29
"CubicWeight": 0.1667,
_29
"IsKit": false,
_29
"CreationDate": null,
_29
"RewardValue": null,
_29
"EstimatedDateArrival": null,
_29
"ManufacturerCode": "123",
_29
"CommercialConditionId": 1,
_29
"MeasurementUnit": "un",
_29
"UnitMultiplier": 2.0,
_29
"ModalType": null,
_29
"KitItensSellApart": false,
_29
"Videos": ["https://www.youtube.com/"]
_29
}

Manual activation

If your SKU's IsActive is set to false and ActivateIfPossible is set to false, send a request to the Update the SKU endpoint, setting IsActive as true.

Here's an overview of the necessary steps to implement manual SKU activation:

  1. Create the SKU, setting IsActive as false and ActivateIfPossible as false.
  2. If the SKU is a kit, create and associate SKU components.
  3. Create and associate SKU files.
  4. Update the SKU as active, setting IsActive as true.
Shell
Python
Node.js

_10
curl --request put \
_10
--url 'https://{accountName}.vtexcommercestable.com.br/api/catalog/pvt/stockkeepingunit/{skuId}' \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}' \
_10
--data '{body}'

Body
Response

_27
{
_27
"Id": 70,
_27
"ProductId": 42,
_27
"IsActive": true,
_27
"Name": "Size 10",
_27
"RefId": "B096QW8Y8Z",
_27
"PackagedHeight": 15.0,
_27
"PackagedLength": 15.0,
_27
"PackagedWidth": 15.0,
_27
"PackagedWeightKg": 15.0,
_27
"Height": null,
_27
"Length": null,
_27
"Width": null,
_27
"WeightKg": null,
_27
"CubicWeight": 0.0,
_27
"IsKit": false,
_27
"CreationDate": "2020-01-25T15:51:00",
_27
"RewardValue": null,
_27
"EstimatedDateArrival": null,
_27
"ManufacturerCode": null,
_27
"CommercialConditionId": 1,
_27
"MeasurementUnit": "un",
_27
"UnitMultiplier": 1.0,
_27
"ModalType": null,
_27
"KitItensSellApart": false,
_27
"Videos": []
_27
}

Creating an SKU

Send a request to the Create SKU endpoint to create a new SKU, considering the following points when building the request body:

  • IsActive: Ensure that IsActive is set to false. Activating it during creation will result in a 400 Bad Request error.
  • ActivateIfPossible: It's recommended to set ActivateIfPossible as true, unless you plan to have an internal workflow to manually activate SKUs.
  • Alternate IDs: Provide at least one of the following IDs in the request body: RefId or EAN. You can also provide both if necessary.

When sending the request body, you can specify the desired SKU Id or let VTEX automatically generate it, as presented in the following.

Custom Id: Request body

If there is a need to create a new SKU with a specific custom Id, specify the Id (integer) in the request body.

Automatically generated ID: Request body

If there's no need to specify a custom Id, you can omit it from the request body, and VTEX will automatically generate the Id.

Updating an SKU

After successfully creating an SKU, you can update its details by sending a request to the Update SKU endpoint. To update an SKU, provide the SKU's unique skuId in the URL and include the updated information in the request body.

Activating an SKU

Activating an SKU means making it available for purchase in your store, allowing customers to browse, search, and buy the associated product. To be activated, ensure your SKU meets the following requirements:

  • Alternate IDs: The SKU must have at least one of the following alternate IDs configured: RefId or EAN.
  • Image: The SKU must have at least one image associated with it. Use the Create SKU file endpoint to associate an image to an SKU.
  • Specifications: If the SKU has specifications, they must be filled in.
  • Kit: For kit SKUs, at least one component must be active.
  • Product: The SKU must be associated with an active product, which, in turn, must be related to an active Brand and an active Category.

Once the SKU meets these requirements, you can activate it using one of the following methods: automatic or manual.

Automatic activation

If your SKU's IsActive is set to false and ActivateIfPossible is set to true, your SKU will automatically become active as soon as it is associated with an image or an active component.

Here's an overview of the necessary steps to implement automatic SKU activation:

  1. Create the SKU, setting IsActive as false and ActivateIfPossible as true.
  2. If the SKU is a kit, create and associate SKU components.
  3. Create and associate SKU files.

Manual activation

If your SKU's IsActive is set to false and ActivateIfPossible is set to false, send a request to the Update the SKU endpoint, setting IsActive as true.

Here's an overview of the necessary steps to implement manual SKU activation:

  1. Create the SKU, setting IsActive as false and ActivateIfPossible as false.
  2. If the SKU is a kit, create and associate SKU components.
  3. Create and associate SKU files.
  4. Update the SKU as active, setting IsActive as true.
Shell
Python
Node.js

_10
curl --request post \
_10
--url https://{accountName}.vtexcommercestable.com.br/api/catalog/pvt/stockkeepingunit \
_10
--header 'Accept: application/json' \
_10
--header 'Content-Type: application/json' \
_10
--header 'X-VTEX-API-AppKey: {appKey}' \
_10
--header 'X-VTEX-API-AppToken: {appToken}' \
_10
--data '{body}'

Body
Response

_29
{
_29
"Id": 1,
_29
"ProductId": 310117069,
_29
"IsActive": false,
_29
"ActivateIfPossible": true,
_29
"Name": "sku test",
_29
"RefId": "125478",
_29
"Ean": "8949461894984",
_29
"PackagedHeight": 10,
_29
"PackagedLength": 10,
_29
"PackagedWidth": 10,
_29
"PackagedWeightKg": 10,
_29
"Height": null,
_29
"Length": null,
_29
"Width": null,
_29
"WeightKg": null,
_29
"CubicWeight": 0.1667,
_29
"IsKit": false,
_29
"CreationDate": null,
_29
"RewardValue": null,
_29
"EstimatedDateArrival": null,
_29
"ManufacturerCode": "123",
_29
"CommercialConditionId": 1,
_29
"MeasurementUnit": "un",
_29
"UnitMultiplier": 2.0,
_29
"ModalType": null,
_29
"KitItensSellApart": false,
_29
"Videos": ["https://www.youtube.com/"]
_29
}

Note that additional configurations are necessary for a product and its SKUs to become visible in a store:

  • Register a price for the SKU in the associated trade policy (sales channel). Refer to the Pricing guide for more information.
  • Ensure you have at least one unit in stock. Manage your inventory by following the Fulfillment guide.
  • Configure your storefront to display products correctly.

Contributors
1
Photo of the contributor
+ 1 contributors
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
1
Photo of the contributor
+ 1 contributors
On this page