> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mercurjs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Product Attribute

> Create a catalog product attribute.

Creates a shared attribute that products across the catalog can use.

> [!NOTE]
>
> `is_variant_axis` is only valid for `multi_select` attributes. Axis attributes provide the value sets that variants are generated from.

## Body parameters

**name** `string` *required*

Attribute name.

**type** `string` *required*

One of `single_select`, `multi_select`, `unit`, `toggle`, `text`.

**handle** `string`

Unique URL-safe handle, generated from the name if omitted.

**description** `string`

Attribute description.

**is\_required** `boolean`

Whether a value is required on products.

**is\_filterable** `boolean`

Whether the attribute can be used as a storefront filter.

**is\_variant\_axis** `boolean`

Whether the attribute drives variant generation; only valid for `multi_select`.

**rank** `number`

Sort rank of the attribute; must be non-negative.

**is\_active** `boolean`

Whether the attribute is active.

**category\_ids** `string[]`

IDs of categories to link the attribute to; omit for a global attribute.

**values** `object[]`

Initial attribute values for select types.

**properties**

**name** `string` *required*

Value name.

**handle** `string`

Unique URL-safe handle.

**rank** `number`

Sort rank; must be non-negative.

**is\_active** `boolean`

Whether the value is active.

**metadata** `object`

Custom key-value data.

**metadata** `object`

Custom key-value data.

**additional\_data** `object`

Custom data passed to workflow hooks.

## Response

**product\_attribute** `object`

**properties**

**id** `string`

The attribute's ID.

**name** `string`

Attribute name.

**handle** `string`

Unique URL-safe handle.

**type** `string`

One of `single_select`, `multi_select`, `unit`, `toggle`, `text`.

**is\_required** `boolean`

Whether a value is required on products.

**is\_filterable** `boolean`

Whether the attribute can be used as a storefront filter.

**is\_variant\_axis** `boolean`

Whether the attribute drives variant generation.

**is\_active** `boolean`

Whether the attribute is active.

**values** `object[]`

The attribute's values.

**categories** `object[]`

Linked categories with `id`, `name`, and `handle`.

**created\_at** `string`

Creation timestamp.

**updated\_at** `string`

Last update timestamp.

```bash cURL theme={null}
curl -X POST 'http://localhost:9000/admin/product-attributes' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Material",
    "type": "single_select",
    "is_filterable": true,
    "values": [{ "name": "Linen" }, { "name": "Cotton" }]
  }'
```

```ts JS Client theme={null}
const { product_attribute } = await client.admin.productAttributes.mutate({
  name: "Material",
  type: "single_select",
  is_filterable: true,
  values: [{ name: "Linen" }, { name: "Cotton" }],
})
```

```json 200 theme={null}
{
  "product_attribute": {
    "id": "pattr_01HXYZABCDEF",
    "name": "Material",
    "handle": "material",
    "type": "single_select",
    "is_required": false,
    "is_filterable": true,
    "is_variant_axis": false,
    "is_active": true,
    "values": [
      { "id": "pattrval_01HXYZABCDEF", "name": "Linen", "rank": 0 },
      { "id": "pattrval_01HXYZABCDEG", "name": "Cotton", "rank": 1 }
    ]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.