Skip to content

Attribute Options

Attribute options are the selectable values for a select / multiselect attribute (color values, sizes, brands, etc.).

Prefer reading options inline through GET /api/shop/attributes/{id}, which scopes them to one attribute. Use the endpoints here when you want the whole option catalog, or need to resolve an option by ID without knowing its parent attribute.

The URL is flat rather than nested under its attribute — /attribute-options, not /attributes/{id}/options.

Endpoints

MethodPathPurpose
GET/api/shop/attribute-optionsPaginated flat list of every option
GET/api/shop/attribute-options/{id}Single option by ID

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 Option Object Fields

FieldTypeDescription
idintegerOption primary key — use this value when filtering products by an attribute
adminNamestringInternal admin label
sortOrderintegerDisplay order within its parent attribute
translationobjectCurrent-locale translation: { id, attributeOptionId, locale, label }
translationsarrayAll locale-specific labels (each { id, attributeOptionId, locale, label }). Empty [] if no other locales have stored labels.

The parent attribute is not embedded in the response, so an option on its own does not say which attribute it belongs to. Read the attribute when that matters.

Use Cases

  • Pre-load all option labels in every storefront locale for offline / SPA caching.
  • Resolve historical option IDs stored against orders or carts back to readable labels.
  • Build admin-style "find option by label" search.
  • Look up the localized label for a specific option in a non-default locale.

Best Practices

  • Prefer the attribute's inline optionsGet Attributes already embeds them, and this flat collection cannot be filtered to one attribute.
  • Order by sortOrder — it is the order the store configured for display, and it is not guaranteed to match ID order.
  • Read the localised label from translationadminName is the back-office label, not what a shopper should see.

Released under the MIT License.