Skip to content

Catalog Attribute Options — Create / Update / Delete

CRUD for individual options on select, multiselect, and checkbox attributes. Options for other attribute types do not exist (the attribute payload returns options: null).

Endpoints

EndpointMethodPurpose
/api/admin/catalog/attributes/{attributeId}/optionsPOSTAdd a new option
/api/admin/catalog/attributes/{attributeId}/options/{optionId}PUTPartially update an option
/api/admin/catalog/attributes/{attributeId}/options/{optionId}DELETERemove an option

Both {attributeId} and {optionId} are constrained to digits (\d+).

Request body — Create / Update

FieldTypeRequiredNotes
admin_namestringyes (create) / no (update)Internal admin label.
sort_orderintegernoDisplay order.
swatch_valuestring|nullnoHex color for color swatches, image path for image swatches, display text for text swatches.
translationsobjectnoMap of locale → { label }. Merges per-locale on update.

Response

  • Create201 Created with the full attribute detail (same shape as GET /api/admin/catalog/attributes/{id}).
  • Update200 OK with the full attribute detail.
  • Delete200 OK with { "message": "..." }.

Errors

HTTPCause
401 UnauthorizedMissing or invalid Bearer token
404 Not FoundUnknown attributeId or optionId
409 Conflict(delete only) Option is referenced by product attribute values
422 Unprocessable Entity(create) Attribute type does not support options, or admin_name missing

Notes

  • The delete-409 message names the dependency count: This option is used by N product(s) and cannot be deleted.
  • For bulk attribute changes, supply the full options array on the Update Attribute endpoint — that replaces the whole option set in one call.

Released under the MIT License.