Skip to content

Catalog Attribute — Detail

Returns a single attribute record by ID, including the full translations array (every locale present in the database) and — for select, multiselect, and checkbox attribute types — all options, each with their own locale translations.

This is the read endpoint to call when an admin needs the complete metadata for an attribute — e.g. when opening the edit form in the Catalog → Attributes UI.

Endpoint

EndpointMethodAuthentication
/api/admin/catalog/attributes/{id}GETAdmin Bearer token

{id} must be a positive integer. Non-numeric values are rejected by a route requirement (\d+) — this prevents the {id} segment from matching any other path under /catalog/attributes/.

Authentication

Every request requires:

Authorization: Bearer <token>

Obtain the Bearer token via Authentication.

Path Parameter

ParameterTypeRequiredDescription
idintegerYesThe numeric attribute ID

Response Shape

The response is a single JSON object (not wrapped in { data }) with the following fields:

FieldTypeDescription
idintegerAttribute ID
codestringAttribute code (e.g. color, size)
typestringAttribute type (e.g. select, text, boolean)
adminNamestringInternal admin-facing label
isRequiredinteger1 = required on product forms, 0 = optional
isUniqueinteger1 = value must be unique across products
valuePerLocaleinteger1 = separate value per store locale
valuePerChannelinteger1 = separate value per channel
isFilterableinteger1 = attribute appears in layered navigation filters
isConfigurableinteger1 = used as a configurable variant axis
isVisibleOnFrontinteger1 = shown on the product page storefront
isUserDefinedinteger1 = created by an admin user (not a system attribute)
swatchTypestring|nullSwatch rendering mode (color, image, text); null for non-swatch types
positionintegerDisplay order position
localestring|nullApp locale used for the top-level scalar fields
createdAtstring|nullISO 8601 creation timestamp
updatedAtstring|nullISO 8601 last-update timestamp
validationstring|nullValidation rule string (e.g. numeric, email, regex); null if none
defaultValuestring|nullDefault value for the attribute; null if not configured
isComparableinteger1 if the attribute is shown in the storefront product-compare table, else 0
enableWysiwyginteger1 if a rich-text (WYSIWYG) editor is used for a textarea attribute, else 0
regexstring|nullCustom regular-expression pattern, used when validation is regex; null otherwise
translationsarrayAll locale translations (see below)
optionsarray|nullAttribute options for select, multiselect, checkbox types; null for all other types

translations[] item shape

Each entry in the translations array corresponds to one locale row in attribute_translations:

FieldTypeDescription
localestringLocale code (e.g. en, fr)
namestring|nullLocale-specific attribute display name

options[] item shape

Each entry represents one attribute option (row in attribute_options):

FieldTypeDescription
idintegerOption ID
adminNamestringInternal admin label for the option
sortOrderintegerDisplay sort order
swatchValuestring|nullSwatch value — hex color code for color swatches, storage path for image swatches, display text for text swatches; null if not a swatch type
swatchValueUrlstring|nullFull URL to the swatch image for image swatches; null for other swatch types or no image
translationsarrayLocale translations for this option (see below)

options[].translations[] item shape

Each entry corresponds to one row in attribute_option_translations:

FieldTypeDescription
localestringLocale code (e.g. en, fr)
labelstring|nullLocale-specific display label for the option

Example Request

bash
curl -X GET "https://your-domain.com/api/admin/catalog/attributes/12" \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json"

Example Response

json
{
  "id": 12,
  "code": "color",
  "type": "select",
  "adminName": "Color",
  "isRequired": 0,
  "isUnique": 0,
  "valuePerLocale": 0,
  "valuePerChannel": 0,
  "isFilterable": 1,
  "isConfigurable": 1,
  "isVisibleOnFront": 1,
  "isUserDefined": 1,
  "swatchType": "color",
  "position": 5,
  "locale": "en",
  "createdAt": "2026-01-12T08:15:00+00:00",
  "updatedAt": "2026-04-30T14:20:09+00:00",
  "validation": null,
  "defaultValue": null,
  "isComparable": 0,
  "enableWysiwyg": 0,
  "regex": null,
  "translations": [
    { "locale": "en", "name": "Color" },
    { "locale": "fr", "name": "Couleur" }
  ],
  "options": [
    {
      "id": 33,
      "adminName": "Red",
      "sortOrder": 1,
      "swatchValue": "#FF0000",
      "swatchValueUrl": null,
      "translations": [
        { "locale": "en", "label": "Red" },
        { "locale": "fr", "label": "Rouge" }
      ]
    },
    {
      "id": 34,
      "adminName": "Blue",
      "sortOrder": 2,
      "swatchValue": "#0000FF",
      "swatchValueUrl": null,
      "translations": [
        { "locale": "en", "label": "Blue" },
        { "locale": "fr", "label": "Bleu" }
      ]
    }
  ]
}

Errors

HTTP StatusCause
401 UnauthorizedMissing, expired, or revoked admin Bearer token
401 UnauthorizedMissing or invalid admin Bearer token
404 Not FoundThe specified {id} does not exist in the database

Notes

  • translations contains every locale in the DB, not just the current app locale. If the store has translations for en, fr, and de, all three entries are returned. Fields with no content for a locale are null.
  • options is null for non-option types. Only select, multiselect, and checkbox attributes have options. For all other types (text, textarea, price, boolean, datetime, date, image, file), options is null.
  • translations and options are plain arrays, not IRIs. Nested objects (options and their translations) are serialized inline in the response — there are no follow-up requests needed.
  • The {id} route parameter must be a digit. The route carries a requirements: ['id' => '\d+'] constraint — non-numeric path segments are rejected with 404 before reaching the provider.
  • swatchValueUrl is only non-null for options of attributes with swatch_type = 'image'. For color and text swatches, swatchValue carries the display value directly and swatchValueUrl is always null.
  • validation holds the validation rule string stored in attributes.validation (e.g. numeric, email, decimal, url). null means no validation rule is configured for the attribute.
  • Top-level locale reflects the app's current default locale. It is a convenience indicator — use translations to get display names in other locales.

Released under the MIT License.