How to continue a ClearRun chat conversation (sessionId and context)
Send the sessionId from the last reply with your next message. You can also send earlier turns in context as [{ "role": "user", "content": "What does ClearRun score?" }].
Last updated
Steps
Start a conversation
curl -s https://api.clearrun.net/api/chat \ -H "Authorization: Bearer $CLEARRUN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "message": "What is a hash chain?" }'Save
sessionIdfrom the reply.Continue it
curl -s https://api.clearrun.net/api/chat \ -H "Authorization: Bearer $CLEARRUN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "message": "How is that different from a signature?", "sessionId": "SESSION_ID", "context": [ { "role": "user", "content": "What is a hash chain?" }, { "role": "assistant", "content": "PREVIOUS_ANSWER" } ] }'
Rules
- A
sessionIdmust belong to your account. Otherwise you get 404Session not found. - Leave
sessionIdout to start a new session. - Each message is scored on its own and gets its own verdict id and receipt.