You can visualize your recording periods throughout the day by downloading lifelog data from the Limitless API and plotting the start and end timestamps using pandas and matplotlib. This process involves fetching lifelogs for a specific date, extracting the startTime from the contents array of each lifelog, and generating a timeline chart showing when recording sessions occurred.
import pandas as pd
import matplotlib.pyplot as plt
import requests
from datetime import date
# 1. Setup API Key
API_KEY = "< your api key >"
# 2. Define download function (simplified logic)
def download_lifelogs(date_str=None, page_size=10):
url = "https://api.limitless.ai/v1/lifelogs"
params = {
"date": date_str or date.today().isoformat(),
"timezone": "America/Chicago",
"includeMarkdown": "false",
"direction": "asc",
"limit": page_size,
"includeHeadings": "false"
}
headers = {"X-API-Key": API_KEY}
# ... (pagination logic using nextCursor) ...
return df
# 3. Download and Plot
df = download_lifelogs()
if not df.empty:
plt.figure(figsize=(12, 6))
for i, row in df.iterrows():
start_hour = row['first_timestamp'].hour + row['first_timestamp'].minute/60
end_hour = row['last_timestamp'].hour + row['last_timestamp'].minute/60
plt.plot([start_hour, end_hour], [i, i], linewidth=3, color='blue')
plt.show()