---
title: "Update a session"
method: PUT
path: "/api/sessions/{id}"
tags: ["Sessions"]
---

# Update a session

`PUT /api/sessions/{id}`

## Request

- Base URL: `https://your-deployment.example.com`
- URL: `https://your-deployment.example.com/api/sessions/{id}`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Updates a session (called a "notebook" in the product UI): its name, attached knowledge files, tags, or retrieval settings. Set `knowledgeIds` and `forceKnowledgeRetrieval: true` together to enable grounded retrieval for `POST /api/chat` against this session - retrieval is gated by these session fields, not by the chat request. `lakeScope` narrows that retrieval to a chosen set of data lakes, and a non-empty list also turns forced retrieval on for a session that has never set it; omit it to leave the current choice unchanged, or send `null` to clear it so retrieval reaches every lake you can access. `includeLibraryFiles` sets whether the session grounds on your own library alongside its lakes; `false` confines it to lake content even when every lake is in scope (files attached to the session still reach the model and its knowledge-base tools), and is set aside (library included) while `forceKnowledgeRetrieval` is `false`. Authenticate with an API key (`b4m_live_`) or a JWT. Warning: adding to `knowledgeIds` shares those files with every member of every project containing this session by default (see `propagateToProjects`), and that sharing cannot be undone through the UI.

## Path parameters

- `id` string, required

## Request body

- UpdateSessionRequest
  - `name` string
  - `knowledgeIds` string[]
  - `artifactIds` string[]
  - `tags` object[]
    - `name` string, required
    - `strength` number, required
  - `lastUsedModel` string, nullable: Pin a specific model id, or omit/send null to leave the current pin unchanged. Sending null does NOT clear it.
  - `forceKnowledgeRetrieval` boolean
  - `lakeScope` string[], nullable: The data lakes this session searches, as lake tags (the `datalake_tag` of each lake from GET /api/v1/data-lakes). Send a list to search only those lakes, `[]` to search no lake at all, or `null` to clear the choice so retrieval falls back to every lake you can reach. Omit to leave the current choice unchanged. Tags naming a lake you cannot reach are ignored at retrieval time rather than rejected here. A non-empty list also turns forced retrieval on for a session that has never set it, unless `forceKnowledgeRetrieval` is sent in the same request; a value the session already stores is left as it is. Conversely `[]` leaves a session with forced retrieval nothing to retrieve from, so its forced retrieval is skipped rather than run against every lake.
  - `includeLibraryFiles` boolean: Whether the session grounds on your own library (files you own, or that are shared with you or your groups) alongside its lakes. `false` confines retrieval to lake content, including when every lake is in scope; the session's attached files still reach the model and stay searchable by its knowledge-base tools. Omit to leave it unchanged; while never set, the library is excluded only when a lake was picked for the session (Data Lakes mode or an explicit lake scope), not when lake tags were derived from an attached file. While `forceKnowledgeRetrieval` is `false` the library is included regardless; the stored value applies again once it is turned back on.
  - `propagateToProjects` boolean: Defaults to true when omitted. When knowledgeIds grows, the newly-added file ids are also appended to every project that contains this session, granting every member of that project access to those files. This propagation is append-only and cannot be undone through the UI - pass false if newly-attached files should not be shared with the project.

## Response `200`

The updated session.

- UpdateSessionResponse200
  - `id` string, required
  - `_id` string
  - `name` string, required
  - `userId` string, required
  - `knowledgeIds` string[]
  - `artifactIds` string[]
  - `tags` object[]
    - `name` string, required
    - `strength` number, required
  - `forceKnowledgeRetrieval` boolean
  - `retrievalTags` string[]
  - `lakeScopeExplicit` boolean: True when `retrievalTags` is a deliberate choice, so an empty list means "no lake" rather than "any".
  - `includeLibraryFiles` boolean: Whether the session grounds on your own library alongside its lakes. Absent when never set.
  - `lastUsedModel` string, nullable
  - `firstCreated` string, date-time, required
  - `lastUpdated` string, date-time, required

## Other responses

- `401`: Missing or invalid credentials.
- `403`: The API key does not hold any of the required scopes.
- `404`: No session exists with the given id.
- `405`: The path does not serve this HTTP method.
- `422`: Request failed validation.
- `429`: Per-user rate limit exceeded.

---

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