Rest API create product attribute options - unable to set option value
Preconditions and environment
- Magento 2.4.5
- Having a custom product attribute, type multiple select
Steps to reproduce
- Create an attribute option using this REST API enpoint:
POST products/attributes/{attributeCode}/options - Use this payload:
"option": { "label": "aaaaaaa", "value": "bbbbb", }
Expected result
When I call this REST API endpoint:
GET products/attributes/{attributeCode}/options
in the result array I expect to obtain an option like this:
{
"label": "aaaaaaa",
"value": "bbbbb"
}
Actual result
when the POST enpoint create the new option, it ignores the value. This is the created option:
{
"label": "aaaaaaa",
"value": "123"
}
where '123' is the progressive option ID.
Additional information
Here is the official enpoint documentation:
https://adobe-commerce.redoc.ly/2.4.5-admin/tag/productsattributesattributeCodeoptions#operation/PostV1ProductsAttributesAttributeCodeOptions
as you can see label and value are mandatory, but value is totally ignored.
Release note
No response
Triage and priority
- [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [X] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @salgua. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance- upcoming 2.4.x release- For more details, review the Magento Contributor Assistant documentation.
- Add a comment to assign the issue:
@magento I am working on this - To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @engcom-Lima. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @salgua ,
Thanks for your contribution and collaboration.
I have tried to reproduce the issue in fresh **2.4-develop ** instance and this issue is the expected behaviour of Magento. Whenever options is created for custom attribute multi-select, Magento generate unique increment id for the options created.
Below is the screenshot for your reference:

Let us know if your facing any issue.
Thanks
Hi @engcom-Lima,
I suspected it was the default behavior, but at this point I'm wondering: what's the point of passing it the "value" parameter? In your request you passed "value": "m3_value_shu", where does Magento save this data and how do I get it?
Thanks
This ticket needs further Dev triage . Hence, labelling as "Dev Experience"
Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @salgua ,
Thank you for the response. Verified the behavior on Magento 2.4-develop instance and is reproducible. Value passed in the payload POST /products/attributes/{attribute-code}/options is being saved / used nowhere in DB tables as well: eav_attribute_option_value, eav_attribute_option, eav_attribute, catalog_product_entity_varchar and catalog_product_entity_int
The options are stored in eav_attribute_option_value DB table. Here option_idis the response retrieved from the POST request and value is the label passed in payload and the actual value passed in the payload request is being ignored but as per Magento docs, value parameter can be passed in the request which is existing behavior of Magento but however this is not a mandatory field to be passed in the payload. No behavior change is observed even if value parameter is not passed in the payload request. Hence we can consider this as an enhancement to remove the value parameter in the payload and label as feature request.

Any updates on this?
I am having the same issue and it is quite vital to synchronize product options from an external system to Magento. Unfortunately, as everything on Adobe/Magento takes years :(
@engcom-November @engcom-Hotel
In fact, this value required by this endpoint, is being used for swatch attribute, as swatch attribute option value: eav_attribute_option_swatch.value in database
private function setSwatchAttributeOption(
AttributeInterface $attribute,
AttributeOptionInterface $option,
string $optionId
): void {
$optionsValue = trim($option->getValue() ?: '');
if ($this->swatchHelper->isVisualSwatch($attribute)) {
$attribute->setData('swatchvisual', ['value' => [$optionId => $optionsValue]]);
} else {
$options = [];
$options['value'][$optionId][Store::DEFAULT_STORE_ID] = $optionsValue;
if (is_array($option->getStoreLabels())) {
foreach ($option->getStoreLabels() as $label) {
if (!isset($options['value'][$optionId][$label->getStoreId()])) {
$options['value'][$optionId][$label->getStoreId()] = null;
}
}
}
$attribute->setData('swatchtext', $options);
}
}
It means it sets this value as swatch text, displayed as on the picture: