Skip to main content

Chat Sessions

Chat sessions store conversation history and state for Aurora’s AI agent. Each session maintains messages, UI state, and metadata.

Endpoints

GET /chat_api/sessions

Retrieve all chat sessions for the authenticated user. Authentication: Required (X-User-ID header) Response:
array
Array of chat session objects
string
Unique session identifier (UUID)
string
Session title (auto-generated from first message or custom)
string
ISO 8601 timestamp of session creation
string
ISO 8601 timestamp of last update
number
Number of messages in the session
object
UI preferences for the session (model, mode, providers)
string
Session status: active, completed, or cancelled
Example Response:

POST /chat_api/sessions

Create a new chat session. Authentication: Required (X-User-ID header) Request Body:
string
Custom session title. If not provided, auto-generated from first message (max 50 chars)
array
default:"[]"
Initial messages for the session (usually empty for new sessions)
object
default:"{}"
UI state including model, mode, and provider preferences
Example Request:
Response:
string
Unique session identifier
string
Session title
array
Session messages
object
UI state object
string
ISO 8601 creation timestamp
string
ISO 8601 update timestamp
string
Session status (always “active” for new sessions)

GET /chat_api/sessions/:session_id

Retrieve a specific chat session with full message history. Authentication: Required (X-User-ID header) Parameters:
string
required
UUID of the session to retrieve
Response: Same fields as POST response, plus:
array
Full array of message objects
string
Message sender: user or assistant
string
Message text content
array
Attached images (for multimodal messages)
string
Data URL for image display
string
MIME type (e.g., “image/png”)
string
Base64-encoded image data
string
Image filename
Example Response:

PUT /chat_api/sessions/:session_id

Update an existing chat session. Authentication: Required (X-User-ID header) Parameters:
string
required
UUID of the session to update
Request Body:
string
Updated session title
array
Updated messages array
object
Updated UI state
Behavior:
  • Only provided fields are updated
  • Cannot update cancelled or completed sessions
  • Title auto-generates from messages if not provided and current title is “New Chat”
  • updated_at is automatically set to current timestamp
Response: Updated session object with same structure as GET response.

DELETE /chat_api/sessions/:session_id

Delete a chat session (soft delete). Authentication: Required (X-User-ID header) Parameters:
string
required
UUID of the session to delete
Response:
Notes:
  • Sessions are soft-deleted (marked as inactive, not removed from database)
  • Associated storage files (Terraform state, etc.) are also deleted
  • Deleted sessions cannot be recovered

DELETE /chat_api/sessions/bulk-delete

Delete all chat sessions for a user, optionally preserving the current session. Authentication: Required (X-User-ID header) Query Parameters:
string
Session ID to preserve from deletion
Response:
Example:

Error Responses

string
Error message describing what went wrong
Common Error Codes:
  • 401 Unauthorized - Missing or invalid authentication
  • 403 Forbidden - Cannot update cancelled/completed session
  • 404 Not Found - Session not found
  • 500 Internal Server Error - Server error

Session Lifecycle

  1. Created - New session with status: "active"
  2. Updated - Messages added/modified via PUT requests
  3. Completed - Agent workflow finishes successfully
  4. Cancelled - User cancels ongoing workflow
  5. Deleted - Soft-deleted by user (marked inactive)

Best Practices

  • Always check status before updating sessions
  • Use bulk-delete with current_session_id to clear history while preserving active chat
  • Store session_id on the client to maintain conversation continuity
  • Title auto-generation uses first 50 characters of first user message
  • Sessions automatically update updated_at on any modification