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

# Update a session

> Update mutable Session attributes.

`POST /api/v1/cloud/sessions/{session_id}`

Updates mutable Session attributes. Omitted fields are preserved.

## Path parameters

| Parameter    | Type   | Description                        |
| ------------ | ------ | ---------------------------------- |
| `session_id` | string | Session ID with the `sess_` prefix |

## Headers

| Header          | Required | Description         |
| --------------- | -------- | ------------------- |
| `Authorization` | Yes      | `Bearer $QODER_PAT` |
| `Content-Type`  | Yes      | `application/json`  |

## Request body

| Field      | Type           | Required | Description                                                                                                         |
| ---------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
| `title`    | string \| null | No       | New Session title. Send `null` to clear it                                                                          |
| `metadata` | object \| null | No       | Metadata patch. Object keys with `null` values delete those keys; top-level `null` is currently a no-op             |
| `agent`    | object         | No       | Mid-session Agent update. Only `tools` and `mcp_servers` are supported, and each is a full replacement when present |

> Note: `vault_ids` appears in the public Session shape but is not currently writable through this endpoint — the request will be rejected. Use it only when reading; it is not part of the supported request body. `delta_flush_interval_ms` is also not supported.

## Example request

```bash theme={null}
curl -X POST https://api.qoder.com/api/v1/cloud/sessions/sess_019e3bb1e8c171fd9abbb1477ffb84cc \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "New title",
    "metadata": {"priority": "high", "old_key": null},
    "agent": {
      "tools": [],
      "mcp_servers": []
    }
  }'
```

## Example response

**HTTP 200 OK**

Returns the updated [Session object](/cloud-agents/api/sessions/schemas#session-object).

## Errors

| HTTP | Type                    | Trigger                                                                      |
| ---- | ----------------------- | ---------------------------------------------------------------------------- |
| 400  | `invalid_request_error` | Malformed request body, unsupported field, or unsupported Agent update field |
| 401  | `authentication_error`  | PAT invalid or expired                                                       |
| 404  | `not_found_error`       | Session does not exist                                                       |

**HTTP 400 Bad Request**

```json theme={null}
{
  "type": "error",
  "request_id": "cb80235f-76a2-4ff3-9e28-5aa2da12dc14",
  "error": {
    "type": "invalid_request_error",
    "message": "metadata must be an object"
  }
}
```

**HTTP 404 Not Found**

```json theme={null}
{
  "type": "error",
  "request_id": "cb80235f-76a2-4ff3-9e28-5aa2da12dc14",
  "error": {
    "type": "not_found_error",
    "message": "Session 'sess_does_not_exist_0000000000000000000000000000' was not found."
  }
}
```

See [Errors](/cloud-agents/api/conventions/errors) for the full error envelope.

## Related

<CardGroup cols={2}>
  <Card title="Start a session" icon="play" href="/cloud-agents/sessions">
    Run an agent against an environment as a stateful conversation.
  </Card>
</CardGroup>
