Set Attribute Option Swatch
POST/api/attributes/:attributeId/option-swatch
Sets the swatch (image URL and/or colour hex) on a single option value of an attribute, creating the option value if it does not exist yet. The swatch is shared by every product variant that selects this value.
Request body:
- value (string, required): the option value to attach the swatch to, e.g. "Blue".
- swatch_image_url (string, optional): public image URL for the swatch (max 500 chars).
- swatch_hex (string, optional): colour hex for the swatch (max 20 chars).
Authentication: Requires Bearer token.
Request
Responses
- 200
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.