Mix LogoMix

Rewind a session

Delete messages after a specified message in the current session, optionally cleaning up media files created after that point

Delete messages after a specified message in the current session, optionally cleaning up media files created after that point

POST
/api/sessions/{id}/rewind

Path Parameters

idstring

Session ID to rewind

cleanupMedia?boolean

Whether to clean up media files created after the rewind point (based on file timestamp)

Defaulttrue
messageIdstring

ID of the last message to keep. All messages after this message will be deleted.

Response Body

from mix_python_sdk import Mixwith Mix() as mix:    res = mix.sessions.rewind_session(id="<id>", message_id="<id>", cleanup_media=True)    # Handle response    print(res)
{
  "assistantMessageCount": 0,
  "completionTokens": 0,
  "cost": 0.1,
  "createdAt": "2019-08-24T14:15:22Z",
  "firstUserMessage": "string",
  "id": "string",
  "promptTokens": 0,
  "title": "string",
  "toolCallCount": 0,
  "userMessageCount": 0
}
{
  "error": {
    "code": 0,
    "message": "string",
    "type": "bad_request"
  }
}
{
  "error": {
    "code": 0,
    "message": "string",
    "type": "bad_request"
  }
}