Skip to main content
POST
/
api
/
v1
/
user-sessions
/
import-claude-session
Import Claude Session
curl --request POST \
  --url https://api.example.com/api/v1/user-sessions/import-claude-session \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "workspace_id": "<string>",
  "claude_session_id": "<string>",
  "messages": [
    {
      "message_id": "<string>",
      "role": "<string>",
      "content": {
        "type": "<string>",
        "text": "<string>",
        "name": "<string>",
        "tool_use_id": "<string>",
        "arguments": {},
        "output": "<unknown>",
        "is_error": true,
        "success": true,
        "message": "<string>"
      },
      "created_at": "<string>",
      "metadata": {}
    }
  ],
  "worktree_name": "<string>",
  "session_name": "<string>"
}
'
{
  "success": true,
  "user_session_id": "<string>",
  "agent_session_id": "<string>",
  "message_count": 0,
  "error": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request to import messages from a Claude CLI session.

This creates a new user_session and agent_session, then imports all the provided messages into the database. The agent_session_id can then be used as the resume_session_id when starting the SDK.

workspace_id
string
required

Workspace ID to import the session into

claude_session_id
string
required

Original Claude CLI session ID (used as SDK resume ID)

messages
ImportableMessage · object[]
required

Messages to import from the Claude CLI session

worktree_name
string | null

Optional worktree name (null for main workspace)

session_name
string | null

Optional name for the imported session

Response

Successful Response

Response from importing a Claude CLI session.

success
boolean
required

Whether the import was successful

user_session_id
string | null

ID of the created user session

agent_session_id
string | null

ID of the created agent session

message_count
integer
default:0

Number of messages successfully imported

error
string | null

Error message if the import failed