# The attribute model

Source: https://developers.swell.is/backend-api/attributes/the-attribute-model

## Fields

- `id` (string, required, auto): Unique identifier for the attribute. Defaults to attribute `name` underscored. Default: `{"$formula":"underscore(name)"}`.
- `name` (string, required): A human-friendly name for the attribute.
- `date_created` (date, auto): Date and time the attribute was created.
- `date_updated` (date, auto): Date and time the attribute was last updated.
- `collection` (string): Collection to look up when the attribute type is `lookup`. Required when type is `lookup`.
- `default` (mixed): Default value used when entering a value for the attribute.
- `filterable` (boolean): Indicates if the category is available in the storefront category page filters. Default: `false`.
- `localized` (boolean): Indicates if this attribute supports localized content. Default: `false`.
- `manual` (boolean): Indicates the variant attribute values are edited manually.
- `multi` (boolean): When attribute `type=image` is indicated, the attribute contains multiple images.
- `name_pattern` (string): Pattern for resolving the display label from a target collection record (e.g. `{name}`). Defaults to the target model's name field.
- `products` (Product): Expandable list of products using the attribute.
- `required` (boolean): Indicates the attribute requires a value when assigned to a product. Default: `false`.
- `searchable` (boolean): Indicates if this attribute is searchable on the backend. Default: `false`.
- `type` (enum): Input type used when entering a value for the attribute. Possible values: `short_text`, `long_text`, `asset`, `lookup`, `boolean`, `select`, `number`, `date`, `tags`, `icon`, `collection`, `field_group`, `field_row`, `text`, `textarea`, `dropdown`, `checkbox`, `radio`, `image`, `file`, `currency`.
- `values` (array of child_scalar): List of the attribute's associated select options used with attribute `type` of `checkbox`, `radio`, or `select`.
- `variant` (boolean): Indicates if this attribute is a variant.
- `visible` (boolean): Indicates the attribute is visible to customers. Default: `false`.

## Example response

```json
{
  "id": "material",
  "name": "Color",
  "date_created": "2021-07-16T14:35:59.968Z",
  "date_updated": "2021-07-16T14:35:59.968Z",
  "default": null,
  "required": false,
  "type": "text",
  "values": [
    "Red",
    "White",
    "Blue",
    "Green",
    "Yellow",
    "Black"
  ],
  "visible": true
}
```
