Skip to main content

List Sessions

Retrieve a paginated list of Claude Code sessions.
curl -H "X-API-Key: sk_live_your_key_here" \
  "https://api.turen.dev/api/v1/sessions?limit=20"

Query Parameters

ParameterTypeDefaultDescription
limitnumber20Number of sessions to return
offsetnumber0Pagination offset
agent_idstring-Filter by agent ID
client_idstring-Filter by client ID
projectstring-Filter by project path
git_branchstring-Filter by git branch
datestring-Filter by date (YYYY-MM-DD)
tzstring-Timezone for date filtering
include_subagentsbooleanfalseInclude subagent sessions

Response

{
  "sessions": [
    {
      "id": 123,
      "session_id": "sess_abc123",
      "client_id": "a1b2c3d4e5f67890",
      "agent_hostname": "johns-macbook-pro",
      "project_path": "/Users/john/project",
      "first_prompt": "Help me refactor the auth module",
      "git_branch": "feature/auth-refactor",
      "message_count": 23,
      "created_at": "2026-02-17T09:00:00Z",
      "modified_at": "2026-02-17T09:45:00Z",
      "uploaded_at": "2026-02-17T09:46:00Z",
      "size_bytes": 45200,
      "is_subagent": false,
      "subagent_count": 2
    }
  ],
  "pagination": {
    "limit": 20,
    "offset": 0,
    "total": 847,
    "has_more": true
  }
}

Response Fields

FieldTypeDescription
idnumberDatabase row ID
session_idstringClaude Code session identifier
client_idstringAgent client ID
agent_hostnamestringMachine hostname
project_pathstringWorking directory path
first_promptstringFirst message in the session
git_branchstringActive git branch during the session
message_countnumberNumber of conversation messages
created_atstringWhen the session started
modified_atstringWhen the session last had activity
uploaded_atstringWhen the session was uploaded to Turen
size_bytesnumberSession data size
is_subagentbooleanWhether this is a subagent session
subagent_countnumberNumber of subagent sessions spawned

Get Session Detail

Retrieve metadata for a specific session.
curl -H "X-API-Key: sk_live_your_key_here" \
  https://api.turen.dev/api/v1/sessions/{id}
Returns the same fields as the list response for a single session.

Download Session Content

Download the full decrypted session content.
curl -H "X-API-Key: sk_live_your_key_here" \
  https://api.turen.dev/api/v1/sessions/{id}/content
Returns the session as JSON:
{
  "session_id": "sess_abc123",
  "message_count": 23,
  "messages": [
    {"type": "user", "content": "Help me refactor the auth module", "timestamp": "2026-02-17T09:00:01Z"},
    {"type": "assistant", "content": "I'll start by reading the current auth implementation...", "timestamp": "2026-02-17T09:00:03Z"},
    {"type": "tool_use", "tool": "file_read", "path": "src/auth/index.ts", "timestamp": "2026-02-17T09:00:04Z"}
  ]
}

Sessions Calendar

Get session counts grouped by date — useful for building calendar views.
curl -H "X-API-Key: sk_live_your_key_here" \
  "https://api.turen.dev/api/v1/sessions/calendar?since=2026-02-01&until=2026-02-28"

Response

{
  "days": [
    {"date": "2026-02-01", "count": 12},
    {"date": "2026-02-02", "count": 0},
    {"date": "2026-02-03", "count": 28}
  ],
  "total_count": 40
}

List Session Clients

Get distinct clients with session counts.
curl -H "X-API-Key: sk_live_your_key_here" \
  https://api.turen.dev/api/v1/sessions/clients