{% extends "base.html" %} {% block title %}{{ title }}{% endblock %} {% block content %}
Complete reference for the Claude Code Tracker REST API
http://localhost:8000
All API endpoints are relative to this base URL. The server runs on port 8000 by default.
/api/projects
Retrieve all projects with their statistics.
[
{
"id": 1,
"name": "claude-tracker",
"path": "/home/user/claude-tracker",
"total_sessions": 5,
"total_time_minutes": 240,
"files_modified_count": 15,
"lines_changed_count": 500,
"last_session": "2024-01-15T10:30:00",
"created_at": "2024-01-10T09:00:00"
}
]
/api/projects/{project_id}
Get detailed information about a specific project.
project_id
(integer, required): Project ID/api/projects/{project_id}/stats
Get comprehensive statistics for a project including time series data.
/api/sessions/start
Start a new coding session.
{
"project_path": "/path/to/project",
"start_time": "2024-01-15T10:30:00",
"user": "username"
}
{
"session_id": "12345",
"project_id": 1,
"message": "Session started successfully"
}
/api/sessions/end
End an active coding session.
{
"session_id": "12345",
"end_time": "2024-01-15T12:30:00"
}
/api/sessions
Retrieve sessions with optional filtering.
project_id
(integer, optional): Filter by projectstart_date
(date, optional): Sessions after this dateend_date
(date, optional): Sessions before this datelimit
(integer, optional): Maximum number of results/api/conversations
Record a new conversation message.
{
"session_id": "12345",
"content": "User message or assistant response",
"role": "user|assistant",
"timestamp": "2024-01-15T10:35:00"
}
/api/conversations/search
Search conversations by content, project, or date.
q
(string): Search query for contentproject_id
(integer): Filter by projectstart_date
(date): Messages after this dateend_date
(date): Messages before this daterole
(string): Filter by role (user/assistant)limit
(integer): Maximum results (default: 50)/api/conversations
Retrieve conversations with pagination.
/api/activities
Record a file modification activity.
{
"session_id": "12345",
"file_path": "/path/to/modified/file.py",
"action": "created|modified|deleted",
"lines_added": 10,
"lines_removed": 5,
"timestamp": "2024-01-15T10:40:00"
}
/api/activities
Retrieve file modification activities.
session_id
(string): Filter by sessionproject_id
(integer): Filter by projectfile_path
(string): Filter by file pathaction
(string): Filter by action type/api/tool-calls
Record a tool call made during a Claude Code session.
{
"tool_name": "Read",
"parameters": {
"file_path": "/path/to/file.py",
"limit": 100
},
"result_status": "success",
"execution_time_ms": 250,
"timestamp": "2024-01-15T10:45:00"
}
/api/tool-calls/stats
Get tool usage statistics with optional filtering.
project_id
(integer, optional): Filter by projectstart_date
(date, optional): Tools used after this dateend_date
(date, optional): Tools used before this date/api/tool-calls/session/{session_id}
Get all tool calls for a specific session.
/api/import/claude-data
Import data from a Claude.json file.
Multipart form data with file upload:
Content-Type: multipart/form-data
file: [claude.json file]
{
"success": true,
"projects_imported": 15,
"sessions_imported": 42,
"conversations_imported": 158,
"activities_imported": 89,
"errors": []
}
The API uses standard HTTP status codes and returns error details in JSON format.
Code | Meaning | Description |
---|---|---|
200 | OK | Request successful |
201 | Created | Resource created successfully |
400 | Bad Request | Invalid request data |
404 | Not Found | Resource not found |
500 | Server Error | Internal server error |
{
"error": true,
"message": "Detailed error description",
"code": "ERROR_CODE",
"details": {
"field": "Additional error context"
}
}
fetch('/api/projects')
.then(r => r.json())
.then(data => console.log(data))
import requests
r = requests.get('http://localhost:8000/api/projects')
print(r.json())
curl -X GET http://localhost:8000/api/projects
Currently, there are no official SDKs. Use standard HTTP libraries for your preferred language.