V1 and V2Product Attributes

Create a product attribute

POST
/api/v1/attributes/product

Create a new product attribute.

Upon successful creation, a 201 CREATED status code is returned and product attribute can be found in response body.

FieldMandatoryDescriptionApplies toExample
nameYESproduct attribute friendly nameALL"name": "In stock"
type_classYESproduct attribute type (see available types at the begining of this section)ALL"type_class": "BooleanAttribute"
descriptionproduct attribute descriptionALL"description": "this attribute is used to indicate when a proudct is in stock or not"
product_families * (extra information given right under this table)list of product families that will contain the new attribute. It's also possible to indicate at what level of the family the attribute will be placedALL"product_families": [{"id": "6422dd98d732cac61a58431e", "attribute_level": "parent_level"}, {"id": "6422dd98d732cac61a58431f", "attribute_level": "variant_level"}]
optionsarray of available optionsMultiselectAttribute, DropdownAttribute"options": ["red", "blue", "white"]
manual_sortingBoolean. When true, options will respect options array order, when false options will be sorted alphabetically using english rules. Default value is manual_sorting = trueMultiselectAttribute, DropdownAttribute"manual_sorting": false
sort_ascendingBoolean. Options values will be sorted in ascending (true) or descending (false) order. Default value is sort_ascending = true. If manual_sorting = true this option has no effectMultiselectAttribute, DropdownAttribute"manual_sorting": false
attributesarray of attributes related to a completeness attributeCompletenessAttribute[ {"id": null, "label": "sku"} , {"id": "...", "label": "in_stock"} ]

product_families field

This field is a list of dictionaries. These dictionaries must follow the following fields

fieldmandatorydescription
idyesid of the Product Family that the attribute is going to belong to.
attribute_levelnoTo indicate whether the attributes will not be inherited ("no_level"), inherited from level 1 ("parent_level") or from level 2 ("variant_level"). Default: "no_level".

The "parent_level" and "variant_level" options are available only when automatic inheritance is active on the account. Contact your account manager for more information.

Example

More examples can be found in example requests

1.- Create new True/ False (Boolean) attribute named "In Stock"

{    "name":"In Stock",    "type_class":"BooleanAttribute"}

Response

{  "data": [    {      "id": "5d0b4ea525abd700016fc037",       "label": "in_stock",       "name": "In Stock",       "groups": [],       "type_class": "BooleanAttribute"    }  ]}

Authorization

bearerAuth
AuthorizationBearer <token>

Obtain a token via POST /auth/api/get-token (15 minute lifetime), then send it as Authorization: Bearer <token>.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST 'https://example.com/api/v1/attributes/product' \  -H 'Content-Type: application/json' \  --data-raw '{  "name": "In Stock",  "type_class": "BooleanAttribute",  "description": "this attribute is used to indicate when a producto is in stock or not"}'
{  "data": [    {      "id": "5d0b4ea525abd700016fc037",      "label": "in_stock",      "name": "In Stock",      "groups": [],      "type_class": "BooleanAttribute"    }  ]}