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

  1. 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 sessionId from the reply.

  2. 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 sessionId must belong to your account. Otherwise you get 404 Session not found.
  • Leave sessionId out to start a new session.
  • Each message is scored on its own and gets its own verdict id and receipt.