Update an attribute value
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/attributes/1/values/1';const options = { method: 'PATCH', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"value":"blue","display_value":"Blue","swatch_type":"none","swatch_value":"#0000FF","sort_order":1,"taxonomy_value_code":"blue"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://apibase.ecomweb.app/api/v1/stores/example/attributes/1/values/1 \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "value": "blue", "display_value": "Blue", "swatch_type": "none", "swatch_value": "#0000FF", "sort_order": 1, "taxonomy_value_code": "blue" }'Updates the fields you send and leaves the rest unchanged. A taxonomy code, once set, cannot be removed.
Required scopes: write:products
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The attribute ID.
The attribute value ID.
The store’s ref, as returned by GET /stores.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Raw value
Example
blueDisplay value
Example
BlueSwatch rendering type
Example
noneSwatch payload — a CSS color for swatch_type=color, or an image URL for swatch_type=image
Example
#0000FFSort order among the attribute’s values
Global facet bucket. Required when the parent attribute carries a taxonomy code.
Example
blueResponses
Section titled “Responses”object
Attribute value ID.
ID of the attribute this value belongs to.
Stored value, such as “red”.
Value as shown to shoppers, such as “Red”.
Swatch kind: none, color or image.
Swatch content: a color code or an image URL. Empty when there is no swatch.
Position of the value within its attribute.
When the value was created, as an ISO 8601 timestamp.
When the value was last updated, as an ISO 8601 timestamp.
Code of the global taxonomy value this one maps to, or null.
Example generated
{ "id": 1, "attribute_id": 1, "value": "example", "display_value": "example", "swatch_type": "example", "swatch_value": "example", "sort_order": 1, "created_at": "example", "updated_at": "example", "taxonomy_value_code": "example"}The request is malformed or failed validation.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The resource does not exist in this store.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}