Documentation
Feedback
Guides
API Reference

Guides
CatalogProduct specifications
Product specifications

Learn more with this article about specifications.

If you wish to implement color variation in your products, we recommend you do not use specifications. Instead, see this tutorial about How to implement product color variation.

Data Model

FieldDescriptionRequiredFormatDefault
IdID of Specification. This Id is used to delete/update the specificationNoIntegerAutoIncrement
ProductIdID of ProductYesInteger-
FieldIdField IDYesInteger-
FieldValueIdID of FieldValue. ONLY for FieldTypeId(5,6,7).Mandatory for 5,6,7. MUST NOT be used for any other field typesIntegernull
TextValue of specification. Only for FieldTypeId different from (5,6,7)Mandatory for all fields EXCEPT 5,6,7 where it MUSTN’T be usedStringnull

Implementation

To create a product specification, use the API below. Remembering that you must have saved the ID of the field for which you want to create a specification.

If the specification field is of the Combo, Radio or Checkbox type (FieldTypeId of 5, 6 and 7 respectively), the FieldValueId field is required and the Text field is not.\n- For text type fields, it is not necessary to create values for the field, that is, the FieldValueId attribute must be null and the Text attribute must be provided with the specification value.

Create Specification - Example #1 (text field)

POST


_10
https://{{accountName}}.vtexcommercestable.com.br/api/catalog/pvt/product/{{productId}}/specification

Body:


_10
{
_10
"FieldId": 21,
_10
"Text": "This is a test for specification field type text",
_10
}

Header:


_10
Accept: application/json
_10
Content-Type: application/json
_10
X-VTEX-API-AppToken: {{X-VTEX-API-AppToken}}
_10
X-VTEX-API-AppKey: {{X-VTEX-API-AppKey}}

Response:


_10
Status: 200 OK


_10
{
_10
"Id": 39,
_10
"ProductId": 42,
_10
"FieldId": 21,
_10
"FieldValueId": null,
_10
"Text": "This is a test for specification field type text"
_10
}

Create Specification - Example #2 (Non-text field)

POST


_10
https://{{accountName}}.vtexcommercestable.com.br/api/catalog/pvt/product/{{productId}}/specification

Body:


_10
{
_10
"FieldId": 22,
_10
"FieldValueId": 65,
_10
}

Headers:


_10
Accept: application/json
_10
Content-Type: application/json
_10
X-VTEX-API-AppToken: {{X-VTEX-API-AppToken}}
_10
X-VTEX-API-AppKey: {{X-VTEX-API-AppKey}}

Response:


_10
Status: 200 OK


_10
{
_10
"Id": 38,
_10
"ProductId": 42,
_10
"FieldId": 22,
_10
"FieldValueId": 65,
_10
"Text": "Metal"
_10
}

Get all specifications from a product

To get all specification fields and values from a product, use the Get product specification and its information by product ID endpoint. See an example response below.


_16
[
_16
{
_16
"Id": 38,
_16
"ProductId": 42,
_16
"FieldId": 22,
_16
"FieldValueId": 65,
_16
"Text": "Metal"
_16
},
_16
{
_16
"Id": 39,
_16
"ProductId": 42,
_16
"FieldId": 21,
_16
"FieldValueId": null,
_16
"Text": "This is a test for specification field type text"
_16
}
_16
]

Update product specification

To update a product specification use the Update a product specification by product ID API endpoint. It's also possible to update specification values in bulk.

Updating product specification by fieldName does not work.

Example request

Body:


_14
[
_14
{
_14
"value": [
_14
"Metal"
_14
],
_14
"Id": 22
_14
},
_14
{
_14
"value": [
_14
"This is the second test for specification field type text"
_14
],
_14
"Id": 21
_14
}
_14
]

Response:


_10
Status: 200 OK

Remove product specifications

To remove a specification from a product, use the Delete product specification API endpoint.

Remove all specifications from a product

To delete all specifications registered in a product, use the Delete all product specification API endpoint.

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