---
title: "Update component state"
method: POST
path: "/v1/threads/{threadId}/components/{componentId}/state"
tags: ["v1"]
---

# Update component state

`POST /v1/threads/{threadId}/components/{componentId}/state`

Update the state of a component in a thread. Supports both full replacement and JSON Patch operations. Thread must not have an active run.

## Path parameters

- `threadId` string, required
- `componentId` string, required

## Request body

- UpdateComponentState
  - `userKey` string — Identifier for a user in your system. Required if no bearer token is provided.
  - `state` object — Full replacement state object
  - `patch` JsonPatchOperation[] — JSON Patch operations to apply to current state
    - `op` 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test', required — Operation type
    - `path` string, required — JSON Pointer path to the target location
    - `value` object — Value to add, replace, or test (required for add, replace, test)
    - `from` string — Source path for move and copy operations

## Response `200`

Component state updated successfully

- UpdateComponentStateResponse
  - `state` object, required — New complete state of the component

## Other responses

- `400` — Invalid request (missing state/patch, or invalid patch)
- `404` — Component not found in thread
- `409` — Cannot update state while run is active

---

[API](https://skmtc.net/tambo-ai/apis/tambo-api.md) · [All operations](https://skmtc.net/tambo-ai/apis/tambo-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tambo-ai/tambo-api/revisions/312691b28f1c/schema)
