Query your data

Every piece of data in Life Logger is accessible via a REST API. Use any HTTP client — curl, Python, JavaScript, a spreadsheet macro — to pull your events and statistics programmatically.

No extra setup required. All endpoints use the same Bearer token auth as the app. Your token only grants access to your own data. Use HTTPS in production so tokens are not transmitted in plaintext (the VPS setup guide covers this with certbot).
Your Session Token
Token ••••••••••••••••

Sessions expire after 1 hour of inactivity. Any API call resets the timer. Log out and back in from the main app to get a fresh token.

Connection

Base URL


    

Required header on every request

Authorization: Bearer <your-token>
Endpoints
GET /me Your profile
curl  \
  -H "Authorization: Bearer <token>"
// Response
{
  "id": 1,
  "username": "yourname",
  "display_name": "Jacob",
  "created_at": "2026-03-24T12:00:00+00:00"
}
GET /labels Your label set
curl  \
  -H "Authorization: Bearer <token>"
// Response
{ "labels": ["Exercise", "Programming", "Reading"] }
GET /events Events in a time range

Query params: start and end as UTC ISO 8601 strings. Matches events whose started_at falls within the range.

curl "" \
  -H "Authorization: Bearer <token>"
// Response
{
  "events": [
    {
      "id": 42,
      "label": "Programming",
      "started_at": "2026-03-24T09:00:00+00:00",
      "ended_at":   "2026-03-24T11:30:00+00:00"
    }
  ]
}
GET /stats Time breakdown by label

Same date range params as /events. Returns percentage share and total minutes per label. An active event is counted up to the current time.

curl "" \
  -H "Authorization: Bearer <token>"
// Response
{
  "percentages": { "Programming": 62.5, "Exercise": 37.5 },
  "minutes":     { "Programming": 187.5, "Exercise": 112.5 }
}
PATCH /me Update display name
curl -X PATCH  \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"display_name": "New Name"}'
Interactive Docs

FastAPI generates a full interactive API explorer automatically. You can authenticate with your token and try every endpoint directly in the browser — no curl required.

Contribute

Life Logger is open source

Bug reports, feature requests, and pull requests are all welcome. If you build something with the API, feel free to share it.

View on GitHub