POST
/
api
/
attributes
{
  "code": "color",
  "label": "Color",
  "project": 1,
  "attribute_type": "select",
  "is_required": true,
  "options": ["red", "blue", "green"],
  "validation_rules": {
    "min_selections": 1,
    "max_selections": 1
  }
}
{
  "id": 1,
  "code": "color",
  "label": "Color",
  "attribute_type": "select",
  "created_at": "2024-01-01T12:00:00Z"
}

Create a new attribute for products.

Body Parameters

code
string
required

Unique identifier for the attribute

label
string
required

Display label for the attribute

project
integer
required

Project ID

attribute_type
string
required

Type of attribute. One of: text, textarea, number, decimal, date, datetime, boolean, select, multiselect, color, image, file

is_required
boolean
default:"false"

Whether the attribute is required

options
array

Array of options for select/multiselect types

validation_rules
object

Validation rules for the attribute

{
  "code": "color",
  "label": "Color",
  "project": 1,
  "attribute_type": "select",
  "is_required": true,
  "options": ["red", "blue", "green"],
  "validation_rules": {
    "min_selections": 1,
    "max_selections": 1
  }
}
{
  "id": 1,
  "code": "color",
  "label": "Color",
  "attribute_type": "select",
  "created_at": "2024-01-01T12:00:00Z"
}