Attribute Options
Select-type attributes carry a list of options your users pick from. This page covers reading, creating, updating, and deleting those options over the REST API.
Common Headers
Every request on this page carries the same two headers:
| Key | Value |
|---|---|
| Accept | application/json |
| Authorization | Bearer access_token |
Get Attribute Options by Attribute Code
Retrieves all options defined for a given attribute.
GET {{url}}/api/v1/rest/attributes/{attribute_code}/optionsHeaders: use the Common Headers.
The endpoint takes one path parameter:
| Name | Description | Type |
|---|---|---|
{attribute_code} | The unique code of the attribute (e.g., size) | String |
Response
The response is the list of options for the specified attribute:
Response
[
{
"code": "size4",
"sort_order": 4,
"labels": {
"de_DE": "Extra Large",
"en_US": "Extra Large",
"fr_FR": "Extra Large"
}
}
]Options come back ordered by sort_order, and the response is a plain array — this endpoint is not paginated.
When the attribute's swatch type is image or color, each option carries two extra keys:
{
"code": "red",
"sort_order": 1,
"labels": { "en_US": "Red" },
"swatch_value": "attribute_option/12/nEr4h2Kq….png",
"swatch_value_url": "https://example.com/storage/attribute_option/12/nEr4h2Kq….png"
}Use Swatch Media Upload to set an image swatch.
Create Attribute Options by Attribute Code
Creates one or more options for an attribute in a single request.
POST {{url}}/api/v1/rest/attributes/{attribute_code}/optionsHeaders: use the Common Headers.
Provide each option's code, sort order, and labels in the request body:
[
{
"code": "size4",
"sort_order": 4,
"labels": {
"de_DE": "Extra Large",
"en_US": "Extra Large",
"fr_FR": "Extra Large"
}
}
]Response
Upon successful creation, the API returns a success message:
Response
{
"success": true,
"message": "Attribute Options Created Successfully"
}Update Attribute Options by Attribute Code
Updates existing options; include only the fields that need to change.
PUT {{url}}/api/v1/rest/attributes/{attribute_code}/optionsHeaders: use the Common Headers.
Provide the code, sort order, and labels for each option you want to update:
[
{
"code": "SL",
"sort_order": 1,
"labels": {
"en_US": "SELL123"
}
}
]Response
Upon successful update, the API returns a confirmation message:
Response
{
"success": true,
"message": "Attribute Options Updated Successfully"
}Delete an Option 3.0
Deletes a single option from an attribute.
DELETE {{url}}/api/v1/rest/attributes/{attribute_code}/options/{option_code}Headers: use the Common Headers.
Response
A successful deletion returns a confirmation message:
{
"success": true,
"message": "Deleted successfully."
}An unknown attribute code or option code returns 404. Deleting an option does not rewrite products that already store its value — clean those up before removing an option that is in use.