Sessions
Add Message
Add a message to a session conversation
POST
Add Message
Add user or assistant messages to track conversation flow. Supports both simple text messages and structured messages with multiple parts (text, context references, tool calls).
Request
Path Parameters
The session ID to add the message to
Headers
Your OpenViking API key for authentication
Must be
application/jsonBody Parameters
Message role:
user or assistantSimple text content (backward compatible mode). Mutually exclusive with
parts.Array of message parts for structured messages (text, context, tool). If both For text parts:For context parts:For tool parts:
content and parts are provided, parts takes precedence.Part type:
text, context, or toolText content
Viking URI of the context (e.g.,
viking://resources/docs/auth/)Type of context:
memory, resource, or skillBrief description of the context
Unique tool call identifier
Name of the tool being called
URI of the skill providing the tool
Input parameters for the tool
Tool execution output
Execution status:
pending, running, completed, or errorResponse
Response status (
ok or error)Request processing time in seconds
Examples
Simple Text Message
Message with Context Reference
Message with Tool Call
Response Example
Message Roles
- user - Messages from the end user
- assistant - Messages from the AI assistant
Part Types
Text Part
Simple text content:Context Part
Reference to a resource, memory, or skill:Tool Part
Tool execution record:Best Practices
Always Track Context Usage
Structure Messages Properly
Use parts for rich messages instead of mixing everything into text:Related Endpoints
- Create Session - Create a new session
- Get Session - Retrieve session and messages
- Commit Session - Archive messages and extract memories
Add Message
