Skip to main content
RapidDev - Software Development Agency
replit-integrationsStandard API Integration

How to Integrate Replit with RescueTime

To integrate Replit with RescueTime, generate an API key from your RescueTime account settings, store it in Replit Secrets (lock icon πŸ”’), and call the RescueTime Data API from your Python or Node.js server to fetch daily productivity summaries, activity breakdowns, and productivity scores. Use Replit's scheduler or a cron-style setup for automated daily analytics pulls.

What you'll learn

  • How to generate a RescueTime API key and configure Replit Secrets
  • How to fetch daily productivity summaries and efficiency scores using Python and Node.js
  • How to retrieve detailed activity breakdowns by application and category
  • How to build an automated daily productivity report with the RescueTime API
  • How to aggregate and visualize RescueTime data from a Replit server
Book a free consultation
4.9Clutch rating ⭐
600+Happy partners
17+Countries served
190+Team members
Intermediate16 min read20 minutesProductivityMarch 2026RapidDev Engineering Team
TL;DR

To integrate Replit with RescueTime, generate an API key from your RescueTime account settings, store it in Replit Secrets (lock icon πŸ”’), and call the RescueTime Data API from your Python or Node.js server to fetch daily productivity summaries, activity breakdowns, and productivity scores. Use Replit's scheduler or a cron-style setup for automated daily analytics pulls.

Why Connect Replit to RescueTime?

RescueTime's core value is passive time tracking β€” it runs silently in the background on your computer, categorizing every minute spent across applications and websites without requiring manual start/stop actions. The Data API exposes this tracked time as structured data: daily summaries with total productive time, productivity scores, and breakdowns by activity category. Connecting your Replit app to RescueTime unlocks the ability to build custom dashboards, automated reports, and productivity-based triggers that the native RescueTime interface does not support.

The most common integration patterns are: building a daily productivity digest that runs as a Replit scheduled task and sends results via email or Slack, creating a personal dashboard that shows week-over-week trends, and triggering automations based on productivity thresholds (for example, sending a reminder when daily productive time falls below a target). For teams using RescueTime Premium, the API supports pulling data across multiple users, enabling team-level productivity reporting.

Replit's Secrets system (lock icon πŸ”’ in the sidebar) is the right place to store your RescueTime API key. Although the RescueTime API is read-only (it cannot modify your tracked data), the key still grants access to your detailed activity history β€” a privacy-sensitive dataset. Always use the key in server-side code and never expose it in a frontend application that runs in the user's browser.

Integration method

Standard API Integration

You connect Replit to RescueTime by generating an API key from your RescueTime account settings, storing it in Replit Secrets, and calling the RescueTime Data API from your server-side Python or Node.js code. The API is read-only and uses a simple query parameter key authentication β€” include your API key as the key parameter in every request. The base URL is https://www.rescuetime.com/anapi.

Prerequisites

  • A Replit account with a Python or Node.js project created
  • A RescueTime account (Lite or Premium β€” API access available on both)
  • RescueTime app installed and running on your computer to generate tracking data
  • Basic familiarity with REST APIs and query parameter authentication
  • Python 3.10+ or Node.js 18+ (both available on Replit by default)

Step-by-step guide

1

Generate a RescueTime API Key and Store It in Replit Secrets

Log in to your RescueTime account at app.rescuetime.com. Click your name in the top-right corner and select 'API Key' from the dropdown, or navigate directly to https://www.rescuetime.com/anapi/manage. On the API Key Management page, you will see your existing API key or a button to create a new one. Click 'New API Key' and give it a description like 'Replit Integration'. Copy the generated key. The RescueTime API uses a query parameter authentication scheme β€” you include your key as ?key={api_key} in every request URL. There is no Bearer token or Authorization header. This makes the API easy to use but means you must be especially careful not to expose the key in logs, browser URLs, or client-side code. Open your Replit project and click the lock icon πŸ”’ in the left sidebar. Add a new Secret with key RESCUETIME_API_KEY and paste your API key as the value. Click 'Add Secret'. In Python, access this with os.environ['RESCUETIME_API_KEY']; in Node.js, use process.env.RESCUETIME_API_KEY. The RescueTime Data API base URL is https://www.rescuetime.com/anapi. The primary endpoint is /data which accepts parameters for date range, resolution (day, hour), and what data to return (overview, category, activity, document, efficiency).

Pro tip: RescueTime has two API endpoints: /anapi/data (the main analytics data endpoint) and /anapi/daily_summary_feed (a simpler summary feed). For most use cases, /anapi/data with perspective=interval and resolution_time=day gives the most useful daily breakdown.

Expected result: RESCUETIME_API_KEY appears in the Replit Secrets pane. A test API call to the RescueTime summary endpoint returns your productivity data.

2

Fetch Productivity Summaries and Activity Data in Python

The RescueTime Data API uses query parameters exclusively β€” no request body, no JSON headers. Include your API key as key, the date range as restrict_begin and restrict_end (YYYY-MM-DD format), and the data format as format=json. The perspective parameter controls what the rows represent: rank (sorted by time), interval (broken down by time period), or member (by team member for premium accounts). The resolution_time parameter determines time granularity: day (daily totals), hour (hourly breakdown), or month. For daily summaries, use perspective=interval and resolution_time=day. For an activity ranking sorted by time, use perspective=rank. The response structure is consistent: a row_headers array describing column names and a rows array of data arrays. The productivity_pulse field (available in the daily summary endpoint) gives a 0-100 score for each day, where higher numbers indicate more time on productive activities. The code below demonstrates fetching daily summaries, getting an activity breakdown for a date range, and pulling the efficiency report that shows productive vs. unproductive vs. neutral time.

rescuetime_client.py
1import os
2import requests
3from datetime import datetime, timedelta
4from typing import Optional
5
6API_KEY = os.environ["RESCUETIME_API_KEY"]
7BASE_URL = "https://www.rescuetime.com/anapi"
8
9def get_daily_summary(date: str = None) -> dict:
10 """
11 Get the productivity summary for a specific date.
12 date format: YYYY-MM-DD (defaults to yesterday)
13 """
14 if not date:
15 date = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
16
17 params = {
18 "key": API_KEY,
19 "perspective": "interval",
20 "resolution_time": "day",
21 "restrict_begin": date,
22 "restrict_end": date,
23 "format": "json"
24 }
25 response = requests.get(f"{BASE_URL}/data", params=params)
26 response.raise_for_status()
27 return response.json()
28
29def get_activity_breakdown(restrict_begin: str, restrict_end: str,
30 limit: int = 20) -> dict:
31 """
32 Get activities ranked by total time spent.
33 Returns applications and websites sorted by time.
34 """
35 params = {
36 "key": API_KEY,
37 "perspective": "rank",
38 "resolution_time": "day",
39 "restrict_begin": restrict_begin,
40 "restrict_end": restrict_end,
41 "restrict_kind": "activity",
42 "restrict_count": limit,
43 "format": "json"
44 }
45 response = requests.get(f"{BASE_URL}/data", params=params)
46 response.raise_for_status()
47 return response.json()
48
49def get_efficiency_data(restrict_begin: str, restrict_end: str) -> dict:
50 """Get productivity score data β€” time by productivity level."""
51 params = {
52 "key": API_KEY,
53 "perspective": "interval",
54 "resolution_time": "day",
55 "restrict_begin": restrict_begin,
56 "restrict_end": restrict_end,
57 "restrict_kind": "efficiency",
58 "format": "json"
59 }
60 response = requests.get(f"{BASE_URL}/data", params=params)
61 response.raise_for_status()
62 return response.json()
63
64def parse_daily_summary(data: dict) -> dict:
65 """Parse the raw API response into a readable summary dict."""
66 headers = data.get("row_headers", [])
67 rows = data.get("rows", [])
68 if not rows:
69 return {"message": "No data for this date"}
70
71 result = {}
72 for row in rows:
73 for i, header in enumerate(headers):
74 result[header] = row[i]
75 return result
76
77# Example usage
78if __name__ == "__main__":
79 yesterday = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
80 print(f"Fetching RescueTime data for {yesterday}...\n")
81
82 summary = get_daily_summary(yesterday)
83 parsed = parse_daily_summary(summary)
84 print("Yesterday's summary:")
85 for key, value in parsed.items():
86 print(f" {key}: {value}")
87
88 print("\nTop 10 activities:")
89 activities = get_activity_breakdown(yesterday, yesterday)
90 headers = activities.get("row_headers", [])
91 for row in activities.get("rows", [])[:10]:
92 activity = dict(zip(headers, row))
93 seconds = activity.get("Time Spent (seconds)", 0)
94 name = activity.get("Activity", "Unknown")
95 print(f" {name}: {seconds // 3600}h {(seconds % 3600) // 60}m")

Pro tip: RescueTime only tracks data when the desktop app is running. If the API returns empty rows for a date you were working, check whether RescueTime was installed and running on that device on that day.

Expected result: Running the script prints yesterday's productivity summary and a ranked list of top applications by time spent. The script confirms the API key is valid and data is being tracked.

3

Build a Node.js Productivity Dashboard API

The Node.js implementation provides the same data access with an Express server that exposes endpoints consumable by a frontend dashboard or Slack bot. Because the RescueTime API uses query parameters for authentication, the integration is simpler than OAuth-based APIs β€” just include the API key in every request. The server below exposes three endpoints: a daily summary endpoint, a weekly trend endpoint that aggregates 7 days of data, and a category breakdown endpoint that shows time by work category (communication, development, reference, etc.). The weekly trend endpoint is particularly useful for building productivity charts that show day-over-day patterns. Install dependencies with 'npm install express axios' in the Replit shell. No additional libraries are needed β€” the RescueTime API's simplicity makes it easy to work with using standard HTTP libraries.

server.js
1const express = require('express');
2const axios = require('axios');
3
4const app = express();
5app.use(express.json());
6
7const API_KEY = process.env.RESCUETIME_API_KEY;
8const BASE_URL = 'https://www.rescuetime.com/anapi';
9
10function formatDate(date) {
11 return date.toISOString().split('T')[0];
12}
13
14async function fetchRescueTime(params) {
15 const response = await axios.get(`${BASE_URL}/data`, {
16 params: { key: API_KEY, format: 'json', ...params }
17 });
18 return response.data;
19}
20
21// Get summary for a specific date (defaults to yesterday)
22app.get('/summary', async (req, res) => {
23 const date = req.query.date || formatDate(new Date(Date.now() - 86400000));
24 try {
25 const data = await fetchRescueTime({
26 perspective: 'interval',
27 resolution_time: 'day',
28 restrict_begin: date,
29 restrict_end: date
30 });
31 const headers = data.row_headers || [];
32 const rows = (data.rows || []).map(row => {
33 const obj = {};
34 headers.forEach((h, i) => { obj[h] = row[i]; });
35 return obj;
36 });
37 res.json({ date, summary: rows });
38 } catch (err) {
39 console.error('Summary error:', err.message);
40 res.status(500).json({ error: err.message });
41 }
42});
43
44// Get weekly productivity trend (last 7 days)
45app.get('/trend', async (req, res) => {
46 const endDate = new Date();
47 const startDate = new Date(Date.now() - 7 * 86400000);
48 try {
49 const data = await fetchRescueTime({
50 perspective: 'interval',
51 resolution_time: 'day',
52 restrict_begin: formatDate(startDate),
53 restrict_end: formatDate(endDate),
54 restrict_kind: 'efficiency'
55 });
56 const headers = data.row_headers || [];
57 const trend = (data.rows || []).map(row => {
58 const obj = {};
59 headers.forEach((h, i) => { obj[h] = row[i]; });
60 return obj;
61 });
62 res.json({ trend, period: '7d' });
63 } catch (err) {
64 res.status(500).json({ error: err.message });
65 }
66});
67
68// Get top activities ranked by time
69app.get('/activities', async (req, res) => {
70 const { date, limit = 15 } = req.query;
71 const targetDate = date || formatDate(new Date(Date.now() - 86400000));
72 try {
73 const data = await fetchRescueTime({
74 perspective: 'rank',
75 resolution_time: 'day',
76 restrict_begin: targetDate,
77 restrict_end: targetDate,
78 restrict_kind: 'activity',
79 restrict_count: parseInt(limit)
80 });
81 const headers = data.row_headers || [];
82 const activities = (data.rows || []).map(row => {
83 const obj = {};
84 headers.forEach((h, i) => { obj[h] = row[i]; });
85 const seconds = obj['Time Spent (seconds)'] || 0;
86 return {
87 activity: obj['Activity'],
88 category: obj['Category'],
89 productivity: obj['Productivity'],
90 hours: Math.floor(seconds / 3600),
91 minutes: Math.floor((seconds % 3600) / 60)
92 };
93 });
94 res.json({ date: targetDate, activities });
95 } catch (err) {
96 res.status(500).json({ error: err.message });
97 }
98});
99
100app.get('/health', (req, res) => res.json({ status: 'ok' }));
101
102app.listen(3000, '0.0.0.0', () => {
103 console.log('RescueTime dashboard server running on port 3000');
104});

Pro tip: The RescueTime API does not require HTTPS for the key parameter in development, but always use HTTPS in production to prevent the key from being intercepted in transit. Replit's deployment infrastructure uses HTTPS by default.

Expected result: The server starts and GET /summary returns yesterday's productivity data. GET /activities returns the top 15 applications by time for the previous day.

4

Schedule Daily Reports and Deploy

The most useful RescueTime integration pattern is an automated daily report that runs without manual triggering. In Replit, you can schedule a Python or Node.js script to run on a schedule using the .replit configuration and Replit's deployment options. For a daily morning digest, create a script that fetches yesterday's data and sends it to your preferred destination β€” a Slack webhook, an email via SendGrid, or a database. The script can run as a Replit Scheduled deployment (available on Core plan), which executes on a cron-like schedule without requiring a persistent server. Deploy your Replit app by clicking 'Deploy'. For a scheduled daily report with no web server component, choose 'Scheduled' as the deployment type and set the schedule to run once per day (e.g., 07:00 UTC). For a dashboard server that responds to requests, choose Autoscale. After deployment, test the integration by calling the health endpoint and verifying the productivity data is accurate.

daily_digest.py
1#!/usr/bin/env python3
2"""
3Daily productivity digest β€” designed to run as a scheduled task.
4Schedule: daily at 07:00 UTC in Replit Scheduled deployment.
5"""
6import os
7import requests
8from datetime import datetime, timedelta
9
10API_KEY = os.environ["RESCUETIME_API_KEY"]
11# Optional: SLACK_WEBHOOK_URL for sending to Slack
12SLACK_WEBHOOK = os.environ.get("SLACK_WEBHOOK_URL", "")
13
14def fetch_summary(date: str) -> dict:
15 response = requests.get(
16 "https://www.rescuetime.com/anapi/data",
17 params={
18 "key": API_KEY,
19 "perspective": "rank",
20 "resolution_time": "day",
21 "restrict_begin": date,
22 "restrict_end": date,
23 "restrict_kind": "activity",
24 "restrict_count": 5,
25 "format": "json"
26 }
27 )
28 response.raise_for_status()
29 return response.json()
30
31def fetch_efficiency(date: str) -> dict:
32 response = requests.get(
33 "https://www.rescuetime.com/anapi/data",
34 params={
35 "key": API_KEY,
36 "perspective": "interval",
37 "resolution_time": "day",
38 "restrict_begin": date,
39 "restrict_end": date,
40 "restrict_kind": "efficiency",
41 "format": "json"
42 }
43 )
44 response.raise_for_status()
45 return response.json()
46
47def generate_report(date: str) -> str:
48 lines = [f"RescueTime Daily Digest β€” {date}"]
49 lines.append("-" * 40)
50
51 efficiency = fetch_efficiency(date)
52 eff_headers = efficiency.get("row_headers", [])
53 for row in efficiency.get("rows", []):
54 eff = dict(zip(eff_headers, row))
55 total = eff.get("Total Seconds Logged", 0)
56 prod = eff.get("Very Productive + Productive Time (seconds)", 0)
57 score = eff.get("Productivity Pulse", 0)
58 lines.append(f"Productivity score: {score}/100")
59 lines.append(f"Total tracked: {total // 3600}h {(total % 3600) // 60}m")
60 lines.append(f"Productive time: {prod // 3600}h {(prod % 3600) // 60}m")
61
62 lines.append("\nTop 5 activities:")
63 activities = fetch_summary(date)
64 act_headers = activities.get("row_headers", [])
65 for i, row in enumerate(activities.get("rows", [])[:5], 1):
66 act = dict(zip(act_headers, row))
67 seconds = act.get("Time Spent (seconds)", 0)
68 name = act.get("Activity", "Unknown")
69 lines.append(f" {i}. {name}: {seconds // 3600}h {(seconds % 3600) // 60}m")
70
71 return "\n".join(lines)
72
73if __name__ == "__main__":
74 yesterday = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
75 report = generate_report(yesterday)
76 print(report)
77
78 if SLACK_WEBHOOK:
79 requests.post(SLACK_WEBHOOK, json={"text": f"```{report}```"})
80 print("\nReport sent to Slack.")

Pro tip: To run this as a scheduled Replit deployment, set the run command in your .replit file to 'python daily_digest.py' and configure it as a Scheduled deployment. The script exits after generating the report β€” no persistent server process is needed.

Expected result: The script runs, prints a formatted productivity digest, and optionally sends it to a Slack webhook. Running it confirms the API key and data retrieval are working correctly.

Common use cases

Automated Daily Productivity Digest

A Replit Python script runs every weekday morning and pulls yesterday's RescueTime summary: total time tracked, productivity score, top three applications, and hours in each category (communication, development, design, etc.). The script formats the data as a readable report and sends it to Slack or email, giving you a daily review without opening the RescueTime dashboard.

Replit Prompt

Write a Python script that fetches yesterday's RescueTime daily summary using the API key from Replit Secrets, formats the productivity score and top 5 activities into a readable message, and prints it to the console.

Copy this prompt to try it in Replit

Weekly Productivity Trend Dashboard

A Replit Express server exposes an API endpoint that aggregates the past 30 days of RescueTime data and returns daily productivity scores as a JSON array. A simple frontend dashboard charts the trend over time, showing whether productivity is improving or declining across weeks.

Replit Prompt

Create a Node.js API endpoint at /productivity/trend that fetches 30 days of RescueTime daily summaries and returns an array of dates with their productivity scores, suitable for plotting as a line chart.

Copy this prompt to try it in Replit

Focus Time Tracker Integration

A Replit app pulls hourly RescueTime activity data and calculates total focused work time β€” defined as time spent in development tools, design software, or other deep-work applications. This feeds into a personal habit tracker, allowing you to monitor whether you are hitting daily focus targets and log streaks of high-productivity days.

Replit Prompt

Write a Python function that fetches today's RescueTime activity breakdown by category, calculates total time in 'Software Development' and 'Design' categories, and returns the total focused hours as a number.

Copy this prompt to try it in Replit

Troubleshooting

API returns empty rows array for recent dates

Cause: RescueTime only has data for days when the desktop tracking app was running on your device. If you have not installed the RescueTime app, recently uninstalled it, or the app was paused, there will be no data for those dates.

Solution: Install the RescueTime desktop or mobile app and ensure it is running. In the RescueTime dashboard, verify that today's data is being recorded. The API returns data only for dates with recorded activity β€” queries for future dates or dates before installation return empty rows.

API returns 200 but the JSON rows contain unexpected columns

Cause: The restrict_kind parameter controls what type of data is returned β€” 'activity' (individual apps), 'category' (broad categories), 'efficiency' (productivity levels), or omitted (overview). Using the wrong restrict_kind returns different row_headers than expected.

Solution: Always parse the row_headers array from the response to understand the column names dynamically, rather than hardcoding column indices. The columns change based on the restrict_kind parameter.

typescript
1# Always use row_headers to map columns
2headers = data.get('row_headers', [])
3rows = data.get('rows', [])
4for row in rows:
5 record = dict(zip(headers, row))
6 print(record) # Now you know exactly what each field is

401 Unauthorized or 403 Forbidden on API requests

Cause: The API key is invalid, was regenerated in RescueTime settings, or is missing from the request query parameters. RescueTime does not use headers for authentication β€” the key must be in the URL as ?key={your_key}.

Solution: Check the RESCUETIME_API_KEY Secret in Replit Secrets. Navigate to rescuetime.com/anapi/manage to verify the key is still valid. If you regenerated the key, update the Secret with the new value. Confirm the key is passed as a query parameter named 'key', not as an Authorization header.

typescript
1# Python: correct key placement
2params = {
3 "key": os.environ["RESCUETIME_API_KEY"], # Must be a query param
4 "format": "json"
5}
6response = requests.get("https://www.rescuetime.com/anapi/data", params=params)

The daily report shows much less time than expected for productive work

Cause: RescueTime categorizes activities based on its default category assignments. Some work-relevant applications may be categorized as 'neutral' or even 'distracting' by default if RescueTime does not recognize them as productive tools.

Solution: In your RescueTime account settings, go to 'Activities and Categories' and review how your most-used applications are categorized. Re-categorize any applications that are incorrectly classified. Custom categories and productivity ratings are applied retroactively to existing data.

Best practices

  • Store RESCUETIME_API_KEY in Replit Secrets (lock icon πŸ”’) and never pass it in client-side code β€” even though the API is read-only, your activity history is private data.
  • Always parse row_headers dynamically from the API response rather than hardcoding column indices, since the columns change based on the restrict_kind parameter.
  • Use the restrict_kind parameter to get the right data type: 'activity' for individual app rankings, 'category' for broad categories, 'efficiency' for productivity scores.
  • Handle empty rows gracefully β€” RescueTime returns empty arrays for dates with no tracked data, which is normal for weekends, vacations, or days before installation.
  • Use Replit Scheduled deployment for daily digest scripts that run once and exit, rather than a persistent server β€” this saves resources and is simpler to manage.
  • Cache API results in memory or a database if your dashboard reads the same date range multiple times β€” RescueTime rate limits API calls and caching reduces unnecessary requests.
  • Avoid pulling more than 30 days of data in a single API call β€” use paginated date ranges and merge the results in your code for longer historical reports.
  • Customize RescueTime activity categories in your account settings before analyzing data β€” incorrect default categorizations will skew your productivity metrics.

Alternatives

Frequently asked questions

How do I store my RescueTime API key in Replit?

Click the lock icon πŸ”’ in the left sidebar of your Replit project. Add a secret with key RESCUETIME_API_KEY and your RescueTime API key as the value. Find your API key at rescuetime.com/anapi/manage. Access it in Python with os.environ['RESCUETIME_API_KEY'] or in Node.js with process.env.RESCUETIME_API_KEY.

Does Replit work with RescueTime on the free plan?

Yes. The RescueTime Data API is available on both the Lite (free) and Premium plans. The Lite plan provides access to basic activity summaries and productivity scores. Premium adds detailed goal tracking, alerts, and team reporting via the API. Replit's free tier supports all outbound API calls to RescueTime.

Why is my RescueTime API returning empty data?

The API returns empty rows when there is no tracked data for the requested date range. This happens when the RescueTime desktop app was not installed or running on those days. Check whether the RescueTime app is currently running on your device and verify data appears in your RescueTime dashboard before troubleshooting the API.

Can I get hourly breakdowns of productivity from the RescueTime API?

Yes. Set resolution_time=hour in your API request to get hourly breakdowns instead of daily totals. For example, with perspective=interval and resolution_time=hour, you get one row per hour showing how time was spent in that hour. This is useful for identifying peak productivity hours throughout the day.

How do I automate a daily RescueTime report in Replit?

Write a Python or Node.js script that fetches the previous day's data and formats it as a report. Deploy it in Replit as a Scheduled deployment (available on Core plan) with a daily run time. Alternatively, use a cron-based approach with a persistent server that checks the time and runs the report logic once per day. The script fetches data, formats it, and optionally sends it to Slack or email.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation β€” no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.