Admin Catalog: Attributes

Create a new attribute

Creates an attribute with optional translations and options (for select/multiselect/checkbox types). The code must be unique, pass the Code rule (letters/digits/underscore), and not be a reserved word (type, attribute_family_id).

post/catalog/attributes

Request

Request body

codestring required
admin_namestring required
type'text' | 'textarea' | 'price' | 'boolean' | 'select' | 'multiselect' | 'checkbox' | 'date' | 'datetime' | 'image' | 'file' required
swatch_typestring nullable
is_requiredboolean
is_uniqueboolean
is_filterableboolean
is_configurableboolean
is_visible_on_frontboolean
is_comparableboolean
value_per_localeboolean
value_per_channelboolean
enable_wysiwygboolean
validationstring nullable
default_valuestring nullable
positioninteger
translationsobject
optionsobject[]

Example request

{
  "code": "material",
  "admin_name": "Material",
  "type": "select",
  "swatch_type": "text",
  "is_filterable": true,
  "is_visible_on_front": true,
  "position": 10,
  "translations": {
    "en": {
      "name": "Material"
    },
    "fr": {
      "name": "Matière"
    }
  },
  "options": [
    {
      "admin_name": "Cotton",
      "sort_order": 1,
      "translations": {
        "en": {
          "label": "Cotton"
        },
        "fr": {
          "label": "Coton"
        }
      }
    }
  ]
}

Response

Attribute created successfully. Returns the full attribute detail.

Changes

No recorded changes to this operation across all 8 revisions of this API.