Catalog Attribute — Create
Creates a new product attribute. Mirrors Catalog → Attributes → Create in the Bagisto admin panel. The same event hooks fire (catalog.attribute.create.before / catalog.attribute.create.after), so any core listener (search reindex, cache flush, etc.) is triggered.
Endpoint
| Endpoint | Method |
|---|---|
/api/admin/catalog/attributes | POST |
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
code | string | yes | Snake_case identifier. Must be unique and not a reserved word. |
admin_name | string | yes | Internal admin label. |
type | string | yes | One of text, textarea, price, boolean, select, multiselect, checkbox, date, datetime, image, file. |
swatch_type | string|null | no | color, image, or text. Only relevant for select/multiselect. |
is_required / is_unique / is_filterable / is_configurable / is_visible_on_front / is_comparable / value_per_locale / value_per_channel / enable_wysiwyg | boolean | no | Standard attribute flags. |
validation | string|null | no | Validation rule (numeric, email, decimal, url). |
default_value | string|null | no | Default value for the attribute. |
position | integer | no | Display order. |
translations | object | no | Map of locale → { name }. |
options | array | no | Initial options (select/multiselect/checkbox only). Each entry: { admin_name, sort_order?, swatch_value?, translations? }. |
Response
201 Created returning the full attribute detail — identical shape to GET /api/admin/catalog/attributes/{id}.
Errors
| HTTP | Cause |
|---|---|
401 Unauthorized | Missing or invalid Bearer token |
422 Unprocessable Entity | Validation failure (missing/duplicate code, invalid type, malformed body) |
Notes
- The
codefield is immutable after creation — see the Update endpoint. - The repository returns a contract interface — the response is re-fetched as a full Eloquent model so the payload always carries
translationsandoptions. - For attribute types that do not support options (
text,textarea,boolean, etc.), theoptionsarray in the response isnull.

