---
title: "Create a new attribute"
method: POST
path: "/catalog/attributes"
tags: ["Admin Catalog: Attributes"]
---

# Create a new attribute

`POST /catalog/attributes`

## Request

- Base URL: `http://localhost:8000/api/admin`
- URL: `http://localhost:8000/api/admin/catalog/attributes`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/bagisto/apis/bagisto-admin-api/docs/catalog/attributes/post.ts> (a function with typed inputs; its response is checked against the schema)

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`).

## Request body

- object
  - `code` string, required
  - `admin_name` string, required
  - `type` 'text' | 'textarea' | 'price' | 'boolean' | 'select' | 'multiselect' | 'checkbox' | 'date' | 'datetime' | 'image' | 'file', required
  - `swatch_type` string, nullable
  - `is_required` boolean
  - `is_unique` boolean
  - `is_filterable` boolean
  - `is_configurable` boolean
  - `is_visible_on_front` boolean
  - `is_comparable` boolean
  - `value_per_locale` boolean
  - `value_per_channel` boolean
  - `enable_wysiwyg` boolean
  - `validation` string, nullable
  - `default_value` string, nullable
  - `position` integer
  - `translations` object
  - `options` object[]

## Response `201`

Attribute created successfully. Returns the full attribute detail.

## Other responses

- `400`: Invalid input
- `422`: Validation failure.

---

[API](https://skmtc.dev/bagisto/apis/bagisto-admin-api.md) - [All operations](https://skmtc.dev/bagisto/apis/bagisto-admin-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bagisto/apis/bagisto-admin-api/revisions/3198f11be70f?raw)
