Update agent styles

PATCH/v2/agents/{agentId}/styles

Change the look of the chat widget of an agent: theme, primary color, bubble position and header title.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

Changes how the website widget of an agent looks. Call it to match the chat bubble to your brand, or to give each of your sites its own color from a script.

Request

PATCH /v2/agents/{agentId}/styles

Path parameters:

Name Type Required Description
agentId string Yes The ID of the agent, starting with agt_.

Body fields. Send only the ones you want to change, and at least one:

Name Type Required Description
theme string No light, dark or auto. With auto, the widget follows the setting of the visitor.
primaryColor string No A hex color such as #1f6feb, used for the bubble, the header and the buttons.
bubblePosition string No bottom-right or bottom-left.
headerTitle string No The title shown at the top of the open chat.

Styles you leave out keep their value. The change applies to the chat bubble and the embedded iframe. For the embed options themselves, see Chat bubble.

Example request

curl -X PATCH https://api.askocto.co/v2/agents/agt_8f3k2m/styles \
  -H "Authorization: Bearer $OCTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "theme": "auto", "primaryColor": "#1f6feb", "headerTitle": "Chat with Store support" }'
const response = await fetch("https://api.askocto.co/v2/agents/agt_8f3k2m/styles", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.OCTO_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    theme: "auto",
    primaryColor: "#1f6feb",
    headerTitle: "Chat with Store support",
  }),
})

const { styles } = await response.json()
console.log(styles.primaryColor)

Example response

A successful call returns 200 OK with all styles of the agent after the change.

{
  "agentId": "agt_8f3k2m",
  "styles": {
    "theme": "auto",
    "primaryColor": "#1f6feb",
    "bubblePosition": "bottom-right",
    "headerTitle": "Chat with Store support"
  },
  "updatedAt": "2026-03-21T08:30:00Z"
}

Response fields

Name Type Description
agentId string The agent the styles belong to.
styles object The current theme, primaryColor, bubblePosition and headerTitle.
updatedAt string When the styles last changed, as an ISO 8601 UTC time.

Styles are not part of the agent object returned by Get agent.

Errors

Status Code When
400 invalid_request The body is empty, primaryColor is not a hex color, or theme or bubblePosition has an unknown value.
401 unauthorized The API key is missing, malformed or deleted.
404 not_found No agent has this ID in your workspace.
429 rate_limited Too many requests. Wait for the number of seconds in the Retry-After header.

Something unclear or missing? Tell us and we will fix the page.