diff --git a/api-reference/openapi/sessions.json b/api-reference/openapi/sessions.json index 3b9fe1c..eeadd0b 100644 --- a/api-reference/openapi/sessions.json +++ b/api-reference/openapi/sessions.json @@ -137,6 +137,94 @@ } } } + }, + "patch": { + "operationId": "patchSessionById", + "summary": "Update session", + "description": "Renames a session or changes its status (e.g. archive / unarchive). All body fields are optional; omitted fields are left unchanged.", + "parameters": [ + { + "name": "sessionId", + "in": "path", + "required": true, + "description": "The id of the session to update.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PatchSessionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Session updated successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetSessionResponse" + } + } + } + }, + "400": { + "description": "Bad request — malformed JSON body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized — invalid or missing API key / Bearer token.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden — the authenticated account does not own this session.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not found — no session exists with the given id.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal server error — the session could not be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } } }, "/api/sessions/{sessionId}/chats": { @@ -346,6 +434,36 @@ } } }, + "PatchSessionRequest": { + "type": "object", + "description": "All fields are optional. Omitted fields are left unchanged.", + "properties": { + "title": { + "type": "string", + "description": "New display title for the session (rename)." + }, + "status": { + "type": "string", + "enum": [ + "running", + "completed", + "failed", + "archived" + ], + "description": "Lifecycle status (matches the DB CHECK). `running` is active / unarchived; `completed` and `failed` are terminal; `archived` archives the row. Use `running` to unarchive from `archived`." + }, + "linesAdded": { + "type": "integer", + "minimum": 0, + "description": "Updates the persisted `lines_added` column on the session (≥ 0)." + }, + "linesRemoved": { + "type": "integer", + "minimum": 0, + "description": "Updates the persisted `lines_removed` column on the session (≥ 0)." + } + } + }, "GetSessionResponse": { "type": "object", "required": [ diff --git a/api-reference/sessions/patch.mdx b/api-reference/sessions/patch.mdx new file mode 100644 index 0000000..f09b441 --- /dev/null +++ b/api-reference/sessions/patch.mdx @@ -0,0 +1,4 @@ +--- +title: "Update Session" +openapi: "/api-reference/openapi/sessions.json PATCH /api/sessions/{sessionId}" +--- diff --git a/docs.json b/docs.json index 4981b27..f50b591 100644 --- a/docs.json +++ b/docs.json @@ -287,6 +287,7 @@ "pages": [ "api-reference/sessions/create", "api-reference/sessions/get", + "api-reference/sessions/patch", "api-reference/sessions/list-chats", "api-reference/sessions/create-chat" ]