> ## Documentation Index
> Fetch the complete documentation index at: https://developers.reintersect.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a block

> Merge a partial state into one of your blocks and re-render it.

> Reintersect apps are in developer preview. Names and limits can still change before general
> release.

Shallow-merges `state` into the block's state, validates the result, renders the block with your app
and syncs it to everyone viewing it.

Authenticate with an install token that has `blocks:write`, or with the interaction token for this
block. The interaction token needs no scope and works for 15 minutes after the action.

## Body

| Field | Type | Required | Description |
| - | - | - | - |
| `state` | `object` | Yes | Top-level keys to set. Nested objects are replaced, not merged. |
| `expectedVersion` | `number` | No | Only update if the block is at this version. |

## Response

The updated block, as in [Get a block](/api-reference/blocks/get).

## Errors

| `_tag` | Status | Cause |
| - | - | - |
| `ReintersectAppScopeMissingError` | 403 | An install token without `blocks:write`. |
| `ReintersectAppBlockNotFoundError` | 404 | No block with this id belongs to your install. |
| `ReintersectAppBlockStateInvalidError` | 422 | The resulting state doesn't match the state schema; `issues` lists why. |
| `ReintersectAppBlockVersionConflictError` | 409 | `expectedVersion` isn't the current version; `currentVersion` says what is. |
| `ReintersectAppBlockFinalError` | 409 | The block is final. |
| `ReintersectAppResponseInvalidError` | 502 | Re-rendering with the new state failed in your app. |

## Example

```bash theme={null}
curl -X PATCH https://api.reintersect.com/v0/blocks/blk_123 \
  -H "authorization: Bearer $INSTALL_TOKEN" \
  -H "content-type: application/json" \
  -d '{ "state": { "status": "done" }, "expectedVersion": 4 }'
```

With the SDK, call `reintersect.blocks.update(TaskBlock, blockId, { state, expectedVersion })`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.