Updating SKU Specifications with Catalog API

In our Catalog, specifications are created in the category level. Products and SKUs inherit their specifications from the category they are placed in and all its parent categories. This may lead to some confusion when using our API to create and update SKUs.

In this article, we share a few tips to help you update an SKU Specification.

SKU and its Specification

First, you need to select an SKU and its Specification to update. If you don’t know the Specifications of the SKU, use the Get SKU Specifications endpoint. It will retrieve all Specifications indexed on the SKU.

In the example below, we show what the response would look like if your SKU had two specifications to fill in:

  • Color ("FieldId": 271)
  • Size ("FieldId": 40)

If needed, you would be able to get more information about each specification using the Get Specification Field endpoint.

[
    {
        "Id": 472,
        "SkuId": 17784,
        "FieldId": 271,
        "FieldValueId": null,
        "Text": ""
    },
    {
        "Id": 528,
        "SkuId": 17784,
        "FieldId": 40,
        "FieldValueId": 147,
        "Text": "L"
    }
]

🚧

Notice that the response body from this endpoint is an array but you can’t update all at once. You can update only one SKU Specification at a time.

Knowing the FieldValueId

After selecting the one Specification to update, use the Get Specifications Values By Field Id endpoint. It allows you to know all the possible values from this Specification as you can only update the FieldValueId from an SKU Specification.

In the example below, we show what the response would look like if your specification had three possible values:

  • S ("FieldValueId": 144)
  • M ("FieldValueId": 145)
  • L ("FieldValueId": 146)
[
    {
        "FieldValueId": 144,
        "Value": "S",
        "IsActive": true,
        "Position": 1
    },
    {
        "FieldValueId": 145,
        "Value": "M",
        "IsActive": true,
        "Position": 2
    },
    {
        "FieldValueId": 147,
        "Value": "L",
        "IsActive": true,
        "Position": 3
    }
]

Updating the SKU Specification FieldValueId

Finally, use the Update SKU Specification endpoint to change the FieldValueId from the SKU Specification to the desired new value.

🚧

SKU Specifications can only have the FieldType as 5(Combo) or 6(Radio). You cannot change the Text field without updating the FieldValueId. After this update, the Text field will be automatically modified.


Did this page help you?