API REFERENCE

History, sessions, feedback

Read a conversation back, clear it, or tell the agent how it did. Three small endpoints around a session.

Get history

GET/v1/history

Returns the recent messages for one session, oldest first. Useful when you render your own transcript instead of the widget.

FieldTypeDescription
session_idrequiredstringThe session to read. Query parameter.
limitnumberHow many messages to return. Query parameter, defaults to 30.
In signed identity mode, pass the signed user_context URL-encoded in the X-Era-User header. There is no body on a GET, so the identity rides in the header.
bash
curl "https://eerraa.online/v1/history?session_id=sess_9f3a&limit=30" \
  -H "Authorization: Bearer era_your_project_key"

Response:

json
{
  "messages": [
    { "role": "user", "content": "Where is order 1043?" },
    { "role": "assistant", "content": "Order 1043 shipped, ETA Sep 2." }
  ],
  "session_id": "sess_9f3a"
}

An unknown session returns SESSION_NOT_FOUND.

Delete a session

DELETE/v1/sessions/{session_id}

Deletes the session and its history. Use it for a clear-conversation action or when a user asks to be forgotten.

bash
curl -X DELETE https://eerraa.online/v1/sessions/sess_9f3a \
  -H "Authorization: Bearer era_your_project_key"

Response:

json
{ "deleted": true, "session_id": "sess_9f3a" }

Submit feedback

POST/v1/feedback

Records a thumbs up or down on a reply. Pair it with the trace_id from that turn's done event so the rating lands on the right response.

FieldTypeDescription
session_idrequiredstringThe session the reply belongs to.
trace_idrequiredstringFrom the done event of the rated turn.
ratingrequired+1 | -1Thumbs up (+1) or thumbs down (-1).
commentstringOptional free-text note from the user.
user_contextobjectThe end-user identity. Signed in signed mode.
bash
curl -X POST https://eerraa.online/v1/feedback \
  -H "Authorization: Bearer era_your_project_key" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "sess_9f3a",
    "trace_id": "tr_7c1d",
    "rating": 1,
    "comment": "Nailed it.",
    "user_context": { "id": "u_42" }
  }'

Response:

json
{ "ok": true }