---
title: "Create a session"
method: POST
path: "/api/v1/sessions"
tags: ["Sessions"]
---

# Create a session

`POST /api/v1/sessions`

## Request

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

Creates a session (called a "notebook" in the product UI). Pass the returned `id` as `sessionId` to `POST /api/chat`, then poll `GET /api/v1/quests/{id}` for the reply. An API key needs `notebooks:write` for this call, so a chat round trip needs that scope as well as `ai:chat`. A key holding `ai:generate` without `notebooks:write` may create a bare session only (`name`, `lastUsedModel`, `temperature`, `autoNamePlaceholder`); any other field is a 403. Unknown body fields are ignored. Naming a data lake with `dataLakeId` (ids come from `GET /api/v1/data-lakes`) seeds the session with that lake's retrieval defaults and turns on forced retrieval.

## Request body

- CreateSessionRequest
  - `name` string, required
  - `projectId` string: Adds the new session to this project.
  - `dataLakeId` string, nullable: Seeds retrieval defaults from this data lake and turns on forced retrieval. Get ids from `GET /api/v1/data-lakes`.
  - `preauthorizedLakeIds` unknown
  - `knowledgeIds` string[]
  - `artifactIds` string[]
  - `agentIds` string[]
  - `systemPromptText` string: Write-only: never returned in a session response.
  - `systemPromptId` string
  - `surface` string
  - `enabledTools` string[]
  - `disabledTools` string[]
  - `disableUserIntegrations` boolean
  - `forceKnowledgeRetrieval` boolean
  - `retrievalTags` string[]
  - `lakeScopeExplicit` boolean
  - `includeLibraryFiles` boolean
  - `corpusGroundingMode` 'inline' | 'retrieve' | 'auto-by-size': Honored only when a lake is named by `retrievalTags` without `dataLakeId`.
  - `retrievalExcludeFilenameMarkers` string[]
  - `retrievalVectorizedOnly` boolean
  - `citationStyle` 'named' | 'indexed'
  - `temperature` number
  - `maxToolCalls` integer
  - `autoNamePlaceholder` string
  - `tags` object[]
    - `name` string, required
    - `strength` number, required
  - `lastUsedModel` string, nullable

## Response `200`

The created session.

- CreateSessionResponse200
  - `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

- `400`: The request could not be processed (for example a bad project id).
- `401`: Missing or invalid credentials.
- `403`: The key lacks `notebooks:write` (or holds only `ai:generate` and set a field beyond a bare session), is not bound to a requested data lake, or the caller is not entitled to the requested `surface`.
- `404`: A named data lake or project was not found.
- `405`: The path does not serve this HTTP method.
- `422`: Request failed validation.

---

[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)
