Skip to content

Catalog Attribute — Detail (GraphQL)

GraphQL item query that returns a single attribute by its IRI, including the full translations array (every locale present in the database) and — for select, multiselect, and checkbox types — all options with their own locale translations.

This is the query to call when an admin needs complete metadata for an attribute — e.g. when pre-populating the edit form in Catalog → Attributes.

Operation

OperationType
adminAttributeQuery (item)

Arguments

ArgumentTypeRequiredDescription
idID!YesAPI Platform IRI of the attribute (e.g. "/api/admin/catalog/attributes/12")

Take the IRI straight from the id of an adminAttributes edge node, or build it as /api/admin/catalog/attributes/<numericId>.

Fields

FieldTypeDescription
idIDAPI Platform IRI (e.g. /api/admin/catalog/attributes/12)
_idIntRaw attribute ID
codeStringAttribute code (e.g. color, size)
typeStringAttribute type (e.g. select, text, boolean)
adminNameStringInternal admin-facing label
isRequiredInt1 = required on product forms
isUniqueInt1 = value must be unique across products
valuePerLocaleInt1 = separate value per store locale
valuePerChannelInt1 = separate value per channel
isFilterableInt1 = appears in layered navigation
isConfigurableInt1 = used as a configurable variant axis
isVisibleOnFrontInt1 = shown on the storefront product page
isUserDefinedInt1 = admin-created (not a system attribute)
swatchTypeStringSwatch mode (color, image, text); null for non-swatch types
positionIntDisplay order position
localeStringApp locale used for top-level scalar fields
validationStringValidation rule string (e.g. numeric, email); null if none
defaultValueStringDefault value; null if not configured
isComparableInt1 if shown in the storefront product-compare table, else 0
enableWysiwygInt1 if a rich-text editor is used for a textarea attribute, else 0
regexStringCustom regex pattern, used when validation is regex; null otherwise
createdAtStringISO 8601 creation timestamp
updatedAtStringISO 8601 last-update timestamp
translationsscalar (JSON array)All locale translations — see shape below
optionsIterableOptions for select, multiselect, and checkbox types; [] for every other type

translations item shape

translations is returned as a plain JSON array (scalar in GraphQL). Each element corresponds to one locale row in attribute_translations:

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

options[] item shape

options is returned as a plain JSON array (scalar in GraphQL). Each element corresponds to one row in attribute_options:

KeyTypeDescription
idintegerOption ID
adminNamestringInternal admin label for the option
sortOrderintegerDisplay sort order
swatchValuestring|nullSwatch value (hex for color, path for image, text for text); null otherwise
swatchValueUrlstring|nullFull URL to the swatch image for image swatches; null for other types
translationsarrayLocale translations for this option (see below)

options[].translations[] item shape

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

Translations and Options Are JSON Scalars

Select translations and options as bare fields — a sub-selection is a schema error. Each returns its whole structure in one piece, including every option's own nested translations.

An option carries id (numeric, not an IRI), adminName, sortOrder, swatchValue, swatchValueUrl, and translations. Only select, multiselect, and checkbox attributes have options; every other type returns an empty list.

Errors

ConditionResult
Unknown or deleted idHTTP 200 with Attribute not found. in errors[] and null in data.adminAttribute
Missing or invalid tokenHTTP 401 with {"message": "Unauthenticated.", "error": "unauthenticated"} — rejected by the transport before GraphQL runs

Working With This Query

  • options is [] for a non-option type, not null. Only select, multiselect, and checkbox carry options; a text attribute returns an empty list. Test the length, not for null.
  • translations carries one entry per stored locale row, not just the requested one, so a multi-locale store returns them all.
  • An option's id is the numeric option id, not an IRI — unlike the attribute's own id. Send that number when referencing the option on a product's attribute value.
  • The boolean flags are integers, 0 or 1, not booleans.
  • The id argument is the IRI, not the number. Build it as /api/admin/catalog/attributes/<_id> or pass a listing edge's id straight through.

Released under the MIT License.