Create a widget theme

post/v1/widget/presets

Saves a new widget theme. Every colour, a name and a launcher label are required; roundness defaults to 100 when left out.

Launcher label in other languages

The launcher label is translated automatically, when the theme is saved, into every language your connected stores show pages in, so a shopper on a French page sees a French label (see lang on GET /v1/widget/preflight). The translations are returned in options.button.translations. To write one yourself, send it in buttonLabelTranslations with edited: true; it is kept as written when the label later changes, while automatic ones are redone. If the translation service fails, the theme is still saved, with whatever translations it already had.

Needs the widget:write scope. Fields are checked all at once: nothing is saved if any is wrong.

Private keyapi.v1.widget.presets.createNo demo

Request body

application/jsonrequired
namestringrequired

Shown in the theme builder. At most 100 characters.

maxLength: 100
buttonLabelstringrequired

The launcher button's text. At most 40 characters.

maxLength: 40
buttonColorstringrequired

Launcher button background. A hex colour, like #FFFFFF or #FFF, with or without alpha.

buttonHoverColorstringrequired

Launcher button background on hover. A hex colour, like #FFFFFF or #FFF, with or without alpha.

buttonTextColorstringrequired

Launcher button text. A hex colour, like #FFFFFF or #FFF, with or without alpha.

typingDotColorstringrequired

Typing indicator dots. A hex colour, like #FFFFFF or #FFF, with or without alpha.

accentColorstringrequired

Selected options, links and emphasis. A hex colour, like #FFFFFF or #FFF, with or without alpha.

accentHoverColorstringrequired

Accent on hover. A hex colour, like #FFFFFF or #FFF, with or without alpha.

mutedTextColorstringrequired

Labels, placeholders and secondary text. A hex colour, like #FFFFFF or #FFF, with or without alpha.

primaryTextColorstringrequired

What the stylist says, product names, prices. A hex colour, like #FFFFFF or #FFF, with or without alpha.

pageColorstringrequired

The background the conversation sits on. A hex colour, like #FFFFFF or #FFF, with or without alpha.

surfaceColorstringrequired

Product cards, look panels and question cards. A hex colour, like #FFFFFF or #FFF, with or without alpha.

borderColorstringrequired

Card outlines and dividers. A hex colour, like #FFFFFF or #FFF, with or without alpha.

inputColorstringrequired

The shopper's own messages and the message box. A hex colour, like #FFFFFF or #FFF, with or without alpha.

footerColorstringrequired

The strip behind the message box. A hex colour, like #FFFFFF or #FFF, with or without alpha.

roundnessinteger

Corner roundness for the whole widget, a whole number from 0 (square) to 100 (as shipped). Left unset when not sent, which the widget draws as 100.

default: 100min: 0max: 100
WidgetLabelTranslations

The launcher label in other languages, keyed by language tag (fr, de, zh-Hant; tags are normalised, so fr-CA is stored as fr). An entry with an empty text is dropped. Only present on a theme once a translation exists.

{text}stringrequired

The label in that language, at most 40 characters.

maxLength: 40
{source}string

The label it translates. An automatic translation whose source is no longer the label is not shown and is redone.

{edited}boolean

true for a translation you wrote. It is shown whatever the label is now, and never replaced automatically.

default: false

Response

201The saved theme.
WidgetPresetrequired

A saved widget theme, as stored.

idstring (uuid)required

Pass it to the embed, or to preflight, as themeId.

namestringrequired

Shown in the theme builder.

objectrequired

The colours, grouped as stored.

createdstring (date-time)required

When it was saved first.

modifiedstring (date-time)required

When it was last changed.

Errors

38

Every error is JSON with a single error string unless noted. Match on the status code; the message is for humans.

400
Request body must be valid JSON.

The body is not parseable JSON.

400
Request body must be a JSON object.

The body is empty, an array, or a JSON primitive.

422
Validation failed.

More than one field is missing or invalid. details names each one.

{
  "error": "Validation failed.",
  "details": [
    {
      "path": "pageColor",
      "message": "pageColor is required."
    },
    {
      "path": "accentColor",
      "message": "Accent colour must be a hex colour, like"
    }
  ]
}
422
<field> is required.

A required field is missing (or null) and nothing else is wrong, for example name is required. or pageColor is required.

422
name cannot be empty.

name is not a string, or is blank once trimmed.

422
name can be at most 100 characters.

name is longer than 100 characters once trimmed.

422
buttonLabel cannot be empty.

buttonLabel is not a string, or is blank once trimmed.

422
buttonLabel can be at most 40 characters.

buttonLabel is longer than 40 characters once trimmed.

422
<Colour name> must be a hex colour, like #FFFFFF or #FFF.

A colour is not #RGB, #RGBA, #RRGGBB or #RRGGBBAA. The name is the field's, as a person reads it: Button colour, Button hover colour, Button text colour, Typing dot colour, Accent colour, Accent hover colour, Muted text colour, Primary text colour, Page colour, Surface colour, Border colour, Input colour or Footer colour.

422
roundness must be a whole number from 0 to 100.

roundness is not an integer from 0 to 100.

422
buttonLabelTranslations must be an object of languages.

buttonLabelTranslations is not an object.

422
"<key>" is not a language.

A key of buttonLabelTranslations is not a language tag.

422
The <language> label can be at most 40 characters.

A translation's text is longer than 40 characters once trimmed, for example The French label can be at most 40 characters.

curl -X POST "https://stylor.ai/api/v1/widget/presets" \
  -H "Authorization: Bearer $STYLOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Ranch",
  "buttonLabel": "Ask a stylist",
  "buttonColor": "#2D2926",
  "buttonHoverColor": "#000000",
  "buttonTextColor": "#FFFFFF",
  "typingDotColor": "#999999",
  "accentColor": "#B5651D",
  "accentHoverColor": "#8A4B12",
  "mutedTextColor": "#6B6B6B",
  "primaryTextColor": "#2D2926",
  "pageColor": "#FBF8F3",
  "surfaceColor": "#FFFFFF",
  "borderColor": "#E6E1DA",
  "inputColor": "#F3EFE9",
  "footerColor": "#FBF8F3",
  "roundness": 60
}'
Response · 201
{
  "preset": {
    "id": "7e6d5c4b-3a2f-4e1d-9c8b-7a6f5e4d3c2b",
    "name": "Ranch",
    "options": {
      "button": {
        "label": "Ask a stylist",
        "color": "#2D2926",
        "hoverColor": "#000000",
        "textColor": "#FFFFFF"
      },
      "widget": {
        "typingDotColor": "#999999",
        "accentColor": "#B5651D",
        "accentHoverColor": "#8A4B12",
        "mutedTextColor": "#6B6B6B",
        "primaryTextColor": "#2D2926",
        "pageColor": "#FBF8F3",
        "surfaceColor": "#FFFFFF",
        "borderColor": "#E6E1DA",
        "inputColor": "#F3EFE9",
        "footerColor": "#FBF8F3",
        "roundness": 60
      }
    },
    "created": "2026-10-04T18:20:03.001Z",
    "modified": "2026-10-04T18:20:03.001Z"
  }
}