Skip to main content

Introduction

Manage user sessions used to group related tasks and context. Notes:
  • Soft delete only. DELETE marks a session as deleted (keeps data) and returns 204.
  • Deleted sessions are excluded from reads and cannot be fetched (404).

List Sessions

Query params:
  • limit (1–100, default 20)
  • offset (>= 0, default 0)
Response (200):

Get Session

Path params:
  • sessionId (UUID or external_id string)
Response (200): session metadata including token usage and task count. Errors: 401, 403, 404.

Session ID Format

Shannon supports dual-ID pattern for sessions:
  1. UUID Format (internal): a0c2b1e2-fd3e-4567-890a-bcdef1234567
  2. External ID Format (custom strings): "user-123-chat", "analytics-session-456"
When you submit a task with a non-UUID session_id, Shannon:
  • Creates an internal UUID for database storage
  • Stores your custom ID in context.external_id
  • Accepts either format in all session API calls
Example:
This allows natural session naming without managing UUIDs.

Get Session History

Path params:
  • sessionId (UUID or external_id string)
Returns all tasks in the session with execution details. Errors: 401, 403, 404.

Get Session Events (Grouped by Turn)

Path params:
  • sessionId (UUID or external_id string)
Returns chat history grouped by task/turn, including full events per turn (excludes LLM_PARTIAL). Query params:
  • limit (1–100, default 10) — number of turns to return
  • offset (>= 0, default 0) — number of turns to skip
Response (200):
Notes:
  • final_output falls back to the first LLM_OUTPUT event if the task result is empty.
  • turn numbers are global (offset+index).
  • Returns 404 if the session is deleted or not owned by the requester.

Update Session Title

Path params:
  • sessionId (UUID or external_id)
Body:
Rules:
  • Title is trimmed; control characters removed.
  • Max 60 characters (UTF-8 safe). Longer titles are rejected.
Responses:
  • 200 OK with updated title
  • 400 Invalid request (empty or too long title)
  • 401 Unauthorized
  • 403 Forbidden (not the owner)
  • 404 Not Found

Delete Session (Soft Delete)

Path params:
  • sessionId (UUID or external_id string)
Behavior:
  • Marks the session as deleted (deleted_at, deleted_by), does not remove data.
  • Idempotent: always returns 204 for the owner.
  • Clears session cache to prevent stale reads.
Responses:
  • 204 No Content
  • 401 Unauthorized
  • 403 Forbidden (not the owner)
  • 404 Not Found