Skip to content

Attributes

Attributes describe customer-facing or internal properties of a product (SKU, name, color, size, etc.). For select / multiselect types, every selectable value is inlined under options[] — fetch a single attribute and you have its full option set in one request.

Endpoints

MethodPathPurpose
GET/api/shop/attributesPaginated list of attributes
GET/api/shop/attributes/{id}Single attribute by ID

Use the example switcher above to flip between the list and single calls.

Request Headers

HeaderRequiredDescription
AcceptYesapplication/json
X-STOREFRONT-KEYYesStorefront API key (pk_storefront_…)

Query Parameters (collection only)

ParameterTypeDefaultDescription
pageinteger1Page number (1-based)
per_pageinteger10Items per page. Max 50.

Pagination headers are emitted on the collection. See Pagination.

Attribute Object Fields

Both endpoints return the same shape — the collection wraps an array of these objects, the single endpoint returns one.

FieldTypeDescription
idintegerAttribute primary key
codestringUnique attribute code (sku, color, size, …)
adminNamestringInternal admin label
typestringtext, textarea, price, boolean, select, multiselect, datetime, date, image, file, checkbox
swatchTypestring | nulldropdown, text, color, image — only for visual selection attributes
positionintegerDisplay order in admin
isRequiredboolean (0/1)Whether values are required when saving a product
isUniqueboolean (0/1)Whether values must be unique across products
isFilterableboolean (0/1)Whether the attribute appears in storefront layered filters
isComparableboolean (0/1)Whether the attribute appears in product comparison
isConfigurableboolean (0/1)Whether the attribute can be used to build configurable variants
isUserDefinedboolean (0/1)1 for custom attributes, 0 for system attributes
isVisibleOnFrontboolean (0/1)Whether the attribute is shown on the product detail page
valuePerLocaleboolean (0/1)Whether values can differ per locale
valuePerChannelboolean (0/1)Whether values can differ per channel
enableWysiwygboolean (0/1)Whether textarea type uses a WYSIWYG editor
validationsstringSerialized validation rules (e.g. "{ required: true }")
columnNamestringStorage column on product_attribute_values
createdAt, updatedAtstring (ISO-8601)Timestamps
optionsarrayInline list of AttributeOption objects (empty for non-select types)
translationobject | nullTranslation for the current request locale ({ id, attributeId, locale, name })
translationsarray of IRI stringsLinks to all locale translations — see IRIs & HATEOAS

Embedded options[]

Each option carries:

FieldTypeDescription
idintegerOption primary key
adminNamestringInternal admin label
sortOrderintegerDisplay order within the attribute
translationobjectCurrent-locale translation ({ id, attributeOptionId, locale, label })
translationsarrayAll locale-specific labels

For non-select types (text, textarea, boolean, price, date, …), options is an empty array [].

Use Cases

  • Build the attribute set for the product editor / filter sidebar.
  • Discover which attributes are filterable (isFilterable=1) for a category page.
  • Resolve codeid mappings for filter query parameters on /products.
  • Render a configurable product's variant selectors (fetch the attribute once, get every option inline).
  • Resolve attribute metadata (type, validations) before building a product-edit form.

Released under the MIT License.