Get messages from session
Changed onGet messages from session. Default format is openai. Can convert to acontext (original), anthropic, or gemini format.
Request
- Base URL: /api/v1 (relative, and the document was published on a file host, not at the API’s origin)
- URL: /api/v1/session/{session_id}/messages
- Auth: API key in header Authorization
Path parameters
Session ID
Query parameters
Limit of messages to return. Max 200. If limit is 0 or not provided, all messages will be returned.
WARNING! Use limit only for read-only/display purposes (pagination, viewing). Do NOT use limit to truncate messages before sending to LLM as it may cause tool-call and tool-result unpairing issues. Instead, use the token_limit edit strategy in edit_strategies parameter to safely manage message context size.
Cursor for pagination. Use the cursor from the previous response to get the next page.
Whether to return asset public url, default is true
Whether to include session events in the response, default is false
Format to convert messages to: acontext (original), openai (default), anthropic, gemini.
Order by created_at descending if true, ascending if false (default false)
JSON array of edit strategies to apply before format conversion
Message ID to pin editing strategies at. When provided, strategies are only applied to messages up to and including this message ID, keeping subsequent messages unchanged. This helps maintain prompt cache stability by preserving a stable prefix. The response will include edit_at_message_id indicating where strategies were applied.
Response
OK
Changes
- info
added the new optional
queryrequest parameterwith_events
- info
- info
added the new optional
queryrequest parameterpin_editing_strategies_at_message
- info