API Reference

Threads

List Chat Threads

  • API Name: List Chat Threads
  • API Route: GET /api/v1/threads
  • Request:
    • Auth: Session required
  • What it does: Returns all chat thread workspaces for the authenticated user, ordered by most recent activity. Each thread includes a preview of the last message and the timestamp of the last activity. Threads are workspaces under the user's default project (default-{userId}).
  • Returns:
json
  {
    "threads": [
      {
        "id", "workspaceName", "createdAt",
        "lastMessagePreview": "string (first 60 chars)",
        "lastMessageAt": "datetime"
      }
    ]
  }

Create Chat Thread

  • API Name: Create New Chat Thread
  • API Route: POST /api/v1/threads
  • Request:
    • Body:
json
    {
      "title": "string (optional, default: 'New Chat')"
    }
  • What it does: Creates a new chat thread (workspace) under the user's default project. Assigns a unique ID based on the user ID and timestamp. Resolves the user's role for workspace creation.
  • Returns: 201 with { "thread": { ...workspaceObject } }. 400 if no role can be resolved for the user.