---
title: "Update widget"
method: PUT
path: "/widget/{id}"
tags: ["Widgets"]
---

# Update widget

`PUT /widget/{id}`

## Request

- Base URL: `https://api.lytics.io/v2`
- URL: `https://api.lytics.io/v2/widget/{id}`
- Auth: API key in header `Authorization`

Update the version named in the body (404 if it does not exist), or create the next draft version when the body names none. State only changes through publish and pause; a body state must match the stored one. A published version's config, type and targeting cannot change until it is paused.

## Path parameters

- `id` string, required

## Query parameters

- `account_id` string

## Request body

- ModelsWidget
  - `aid` integer
  - `config` object: Raw Pathfora SDK config
  - `created` string, date-time
  - `custom_rule_function` string
  - `description` string
  - `excluded_segment_ids` string[]
  - `id` string
  - `issues` ModelsWidgetIssue[]: Every reason this version cannot be served, computed per request; empty when it can. Any issue refuses publish and keeps a published version off the tag. Omitted only when it could not be checked.
    - `code` 'segment_not_found' | 'segment_invalid' | 'segment_no_slug' | 'segment_not_public' | 'invalid_config' | 'invalid_callback' | 'invalid_custom_rule' | 'invalid_widget_type'
    - `field` 'target_segment_ids' | 'excluded_segment_ids' | 'config' | 'custom_rule_function' | 'widget_type'
    - `message` string
    - `value` string: the segment id, or the config key of a bad callback
  - `label` string
  - `modified` string, date-time
  - `personalization_key` string
  - `published_at` string, date-time
  - `slug` string
  - `state` 'draft' | 'published' | 'paused' | 'deleted'
  - `state_modified_at` string, date-time
  - `target_segment_ids` string[]
  - `version` integer
  - `widget_type` 'message' | 'form' | 'sitegate'

## Response `200`

Updated Widget

- object
  - `_meta` object: Response Metadata
  - `data` object: Response Payload
    - `aid` integer
    - `config` object: Raw Pathfora SDK config
    - `created` string, date-time
    - `custom_rule_function` string
    - `description` string
    - `excluded_segment_ids` string[]
    - `id` string
    - `issues` ModelsWidgetIssue[]: Every reason this version cannot be served, computed per request; empty when it can. Any issue refuses publish and keeps a published version off the tag. Omitted only when it could not be checked.
      - `code` 'segment_not_found' | 'segment_invalid' | 'segment_no_slug' | 'segment_not_public' | 'invalid_config' | 'invalid_callback' | 'invalid_custom_rule' | 'invalid_widget_type'
      - `field` 'target_segment_ids' | 'excluded_segment_ids' | 'config' | 'custom_rule_function' | 'widget_type'
      - `message` string
      - `value` string: the segment id, or the config key of a bad callback
    - `label` string
    - `modified` string, date-time
    - `personalization_key` string
    - `published_at` string, date-time
    - `slug` string
    - `state` 'draft' | 'published' | 'paused' | 'deleted'
    - `state_modified_at` string, date-time
    - `target_segment_ids` string[]
    - `version` integer
    - `widget_type` 'message' | 'form' | 'sitegate'
  - `request_id` string
  - `status` integer: HTTP Status Code

## Other responses

- `201`: Created Widget version
- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found
- `500`: Internal Server Error

## Changes

- **2026-11-03** `d8e975057aec`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/lytics/apis/lytics-api/changes/widget/:id/put.md)

---

[API](https://skmtc.dev/lytics/apis/lytics-api.md) - [All operations](https://skmtc.dev/lytics/apis/lytics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lytics/apis/lytics-api/revisions/d8e975057aec?raw)
