---
docId: doc_caffb684f45d437099a7230dc39264f8
title: Publish a web chat
description: "Publish settings changes without replacing the code on your site."
api:
  group: canales/webchat
  auth: bearer
  operations:
    - operationId: publishWebchat
      method: POST
      path: '/v1/webchats/{webchatId}/publish'
      postmanName: Publish a web chat
---

<script>
  import { Ways } from '$lib/components';
</script>

# Publish a web chat

Publish the saved `config` changes on your site and the chat's page. You do not need to replace the installation code.

It also turns on a web chat that you [turned off](/api-reference/channels/disconnect). In that case, if it had unpublished changes, they are published too.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl -X POST https://api.platic.ai/v1/webchats/$WEBCHAT_ID/publish \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.webchats.publish("webchat_123");
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `webchatId` | string | Web chat id (`wc-…`) | ✓ |

## Query parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `workspace` | string | Only if your credential has several workspaces: which one the web chat is in | — |

## Request body

It has no body.

## Response

`data` is the published web chat: `published` is `true` and `hasUnpublishedChanges` is `false`.

```json
{
  "status": "success",
  "message": "Web chat published",
  "data": {
    "id": "wc-7Hq2LmN4pR8sT1vX",
    "name": "Acme Store",
    "agentId": "tVKljCHCNiebQdasHeit",
    "mode": "both",
    "allowedDomains": ["example.com"],
    "config": {
      "enabled": true,
      "appearance": {
        "mode": "light",
        "primary": "#E4572E",
        "radius": 16,
        "font": "system",
        "colors": {
          "canvas": "#f7f8f5",
          "surface": "#ffffff",
          "surfaceMuted": "#f4f5f1",
          "text": "#343434",
          "textMuted": "#666666",
          "border": "#111111",
          "headerBackground": "#ffffff",
          "headerText": "#343434",
          "headerIcons": "#666666",
          "visitorBackground": "#eef0e9",
          "visitorText": "#343434",
          "composerBackground": "#ffffff",
          "composerInput": "#ffffff",
          "sendBackground": "#00C577",
          "sendIcon": "#111111",
          "error": "#ef4444",
          "online": "#00C577"
        },
        "visualEffects": { "enabled": true, "intensity": 60, "blur": 80, "motion": true }
      },
      "availability": { "status": "online" }
    },
    "published": true,
    "hasUnpublishedChanges": false,
    "embed": {
      "publicKey": "wc_pub_7Hq2LmN4pR8sT1vX",
      "script": "<script\n  src=\"https://chat.platica.mx/widget.js\"\n  data-webchat=\"wc_pub_7Hq2LmN4pR8sT1vX\"\n  defer>\n</script>",
      "inline": "<div id=\"platica-chat\"></div>\n\n<script\n  src=\"https://chat.platica.mx/widget.js\"\n  data-webchat=\"wc_pub_7Hq2LmN4pR8sT1vX\"\n  data-target=\"#platica-chat\"\n  defer>\n</script>",
      "pageUrl": "https://chat.platica.mx/chat?webchat=wc_pub_7Hq2LmN4pR8sT1vX"
    },
    "health": { "state": "ok", "reason": null, "since": "2026-11-12T18:30:00.000Z" },
    "creationDate": "2026-11-12T18:30:00.000Z",
    "lastUpdate": "2026-11-12T19:10:00.000Z",
    "nextStep": "Published: the saved configuration is live."
  }
}
```

The `config` example is partial; the response includes all twelve sections. Change `colors.sendBackground` and `colors.online` too if you want them to use the new `primary`: those colors are saved separately.

The fields are in [get a web chat](/api-reference/web-chats/get#response-fields).

## If it was turned off

- It turns it on and publishes it in the same call. It loads again on your site and on its page, with the same code.
- The response has `health` as `ok`, unless `config.enabled` is `false`. Then it is turned on but paused (`paused`) until you publish with `enabled: true`.
- After a `503`, the chat may be on but not yet loading on your site. Repeat the call to finish turning it on.

## Errors

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `400` | `INVALID_REQUEST` | `webchatId` does not start with `wc-` |
| `403` | `FORBIDDEN` | The credential does not have write permission on Integrations |
| `404` | `WEBCHAT_NOT_FOUND` | The web chat does not exist in this workspace |
| `409` | `WEBCHAT_CONFLICT` | The web chat cannot be published in its current state |
| `503` | `WEBCHAT_SERVICE_UNAVAILABLE`, `WEBCHAT_SERVICE_TIMEOUT` | The web chat service did not respond. You can publish again |

## Notes

- Publishing without changes publishes the same thing again. You can repeat the call if it failed.
- Needs a workspace API key, or an OAuth token with write access to Integrations and the `platica:write` scope.
