Skip to main content
RapidDev - Software Development Agency
retool-integrationsREST API Resource

How to Integrate Retool with Time Doctor

Connect Retool to Time Doctor using a REST API Resource targeting the Time Doctor API v1.1 (api2.timedoctor.com). Authenticate with an API token obtained from your Time Doctor account settings. Query work logs, user activity data, and screenshots metadata to build a remote team monitoring dashboard that shows attendance, productivity scores, and app usage across your distributed workforce.

What you'll learn

  • How to obtain a Time Doctor API token and configure Retool's REST API Resource for authentication
  • How to query Time Doctor's worklog and user activity endpoints for team attendance data
  • How to build a remote team monitoring dashboard with daily hours, productivity scores, and app usage
  • How to use JavaScript transformers to aggregate and reshape Time Doctor's worklog response format
  • How to combine Time Doctor activity data with project data from other Retool Resources
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate17 min read30 minutesProductivityLast updated April 2026RapidDev Engineering Team
TL;DR

Connect Retool to Time Doctor using a REST API Resource targeting the Time Doctor API v1.1 (api2.timedoctor.com). Authenticate with an API token obtained from your Time Doctor account settings. Query work logs, user activity data, and screenshots metadata to build a remote team monitoring dashboard that shows attendance, productivity scores, and app usage across your distributed workforce.

Quick facts about this guide
FactValue
ToolTime Doctor
CategoryProductivity
MethodREST API Resource
DifficultyIntermediate
Time required30 minutes
Last updatedApril 2026

Why connect Retool to Time Doctor?

Time Doctor's native reports provide employee-level time tracking data, but remote team managers often need to see activity across their entire team in a single view, compare individual performance against team averages, or cross-reference work hours with project completion from a project management tool. Time Doctor's built-in dashboard updates every few hours and cannot be customized to show the specific metrics or groupings a particular team or manager needs. Retool gives team leads and HR operations a custom monitoring dashboard backed directly by the Time Doctor API.

The most impactful use case is a daily attendance and productivity overview that shows all team members' hours logged, productive time percentage, number of screenshots captured, and top apps used — all in a single Table with summary stats. Managers can quickly identify employees who haven't logged any time (potential attendance issues), those with lower-than-average productive time percentages, or team members working significantly more hours than contracted. Retool's flexible query parameters make it easy to filter by date, department, or project and drill down from team-level to individual views.

Time Doctor's API is built around a company-centric structure: most endpoints require a company_id parameter. The primary data resource is worklogs — individual time entries associated with a user, task, and project. The API also exposes user activity streams (app and website usage per second) and screenshots metadata. Understanding the worklog structure — each entry has a start time, end time, and duration — is key to building accurate aggregations in Retool transformers.

Integration method

REST API Resource

Time Doctor connects via Retool's REST API Resource targeting the Time Doctor API v1.1 at https://api2.timedoctor.com/api/1.1. Authentication uses an OAuth 2.0 access token obtained through Time Doctor's login endpoint or a personal API token from account settings. All API requests proxy through Retool's server-side infrastructure, keeping credentials off the browser and eliminating CORS issues. You query worklog, user, and company endpoints to pull activity data into Retool dashboards.

Prerequisites

  • A Time Doctor account with admin or manager access to view company-level data
  • The company ID for your Time Doctor account (visible in the Time Doctor web app URL or in account settings)
  • An API token from your Time Doctor account settings (Settings → Integrations → API)
  • Time Doctor interactive or silent tracking enabled for the team members you want to monitor
  • A Retool account with Resource creation permissions

Step-by-step guide

1

Obtain a Time Doctor API token

Time Doctor supports two authentication approaches for API access: OAuth 2.0 with username/password for session tokens, and API tokens generated from the Time Doctor web application. For server-side Retool integrations, an API token is the most practical option as it does not expire on a fixed schedule and does not require a browser-based OAuth flow. In the Time Doctor web app, navigate to Settings (gear icon in the top right). Select Integrations from the settings menu. Scroll to find the API Tokens section (if available on your plan) or look for the Access Token section. Click Generate Token or Create Token. Give the token a descriptive name such as Retool Integration. Copy the generated token immediately — Time Doctor displays it only once in some versions. If your Time Doctor plan does not offer standalone API tokens in the UI, you can obtain a session token by calling the authentication endpoint directly. POST to https://api2.timedoctor.com/api/1.1/authorization with a JSON body containing { email: "your@email.com", password: "yourpassword", totpCode: "" } — the response returns an access token and a companyId. For production integrations, the API token approach is preferred over embedding credentials; if using the login endpoint, implement a Retool Workflow to refresh the session token periodically since session tokens may have shorter expiry windows. Note your company_id from the authentication response or from your Time Doctor account URL — it is required as a query parameter in most API endpoints.

Pro tip: If you have two-factor authentication (2FA) enabled on your Time Doctor account, the /authorization login endpoint requires a TOTP code. For production integrations, it is simpler to use a dedicated service account without 2FA and generate a persistent API token from that account.

Expected result: You have a Time Doctor API access token and your company_id. These two values are required for all subsequent API calls.

2

Configure the Time Doctor API Resource in Retool

In Retool, navigate to the Resources tab in the left sidebar and click Add Resource. Select REST API from the resource type list. Name the resource Time Doctor API. In the Base URL field, enter https://api2.timedoctor.com/api/1.1 — this is the Time Doctor API v1.1 base URL used for all data endpoints. In the URL Parameters section (not Headers — Time Doctor uses token as a query parameter, not an Authorization header), click Add Parameter. Set the parameter name to token and the value to {{ config.TIMEDOCTOR_TOKEN }}. This appends the token to every API request automatically. Create the configuration variable: navigate to Settings → Configuration Variables in Retool, click Add variable, name it TIMEDOCTOR_TOKEN, paste your API token as the value, and enable the secret toggle to prevent the token from being exposed in frontend context. Create a second configuration variable named TIMEDOCTOR_COMPANY_ID with your company's numeric ID. This will be referenced in query URL parameters rather than the global resource settings, since most Time Doctor endpoints require it as a query parameter named company. Click Save on the Resource. Test the connection by creating a quick GET query with Path set to /users and a URL Parameter company set to {{ retoolContext.configVars.TIMEDOCTOR_COMPANY_ID }} — this should return a list of users in your company.

Pro tip: Time Doctor's API uses the query parameter name token for authentication (not Authorization in the header). This differs from most REST APIs. If you add an Authorization header, requests will return a 401 error. Always add the token as a URL parameter at the Resource level.

Expected result: The Time Doctor API Resource is saved in Retool with the base URL and token URL parameter configured. A test GET query to /users returns a list of company users, confirming authentication is working.

3

Query worklogs for team activity data

Create a new query in Retool targeting your Time Doctor API resource to fetch worklogs — the core data type representing time worked. Set Method to GET and Path to /activity/worklog. In the URL Parameters section, add company with value {{ retoolContext.configVars.TIMEDOCTOR_COMPANY_ID }}. Add start_date with value {{ formatDate(dateRangePicker.value[0], 'YYYY-MM-DD') }} and end_date with value {{ formatDate(dateRangePicker.value[1], 'YYYY-MM-DD') }}. Add user_ids as an optional filter — leave blank to get data for all users, or reference a multi-select dropdown: {{ userSelect.value.join(',') }}. The worklogs endpoint returns an array of time entries. Each entry has a userId, workMode (online or offline), start time, and a length in seconds. Add a JavaScript transformer to aggregate these raw worklog entries by user and date, summing the duration to compute daily hours per user. Time Doctor also provides a summary endpoint at /activity/summary which returns pre-aggregated totals per user for a date range — this is more efficient for daily summary views. Test the worklogs query by setting a date range of the last 7 days and verifying that entries appear for your team members. The raw worklog data will show many short entries representing individual tracked work sessions.

worklog_aggregator.js
1// JavaScript transformer: aggregate raw worklogs by user and date
2// Input: data = array of worklog entry objects from Time Doctor API
3const worklogs = data.worklog || data || [];
4
5// Group by userId + date
6const byUserDate = {};
7
8worklogs.forEach(entry => {
9 const userId = entry.userId || entry.user_id || '';
10 const date = entry.start
11 ? entry.start.substring(0, 10) // Extract YYYY-MM-DD
12 : '';
13 const duration = parseInt(entry.length || entry.duration || 0); // seconds
14
15 const key = `${userId}_${date}`;
16 if (!byUserDate[key]) {
17 byUserDate[key] = {
18 user_id: userId,
19 date: date,
20 total_seconds: 0,
21 sessions: 0
22 };
23 }
24 byUserDate[key].total_seconds += duration;
25 byUserDate[key].sessions += 1;
26});
27
28// Convert to array with formatted hours
29return Object.values(byUserDate).map(entry => ({
30 user_id: entry.user_id,
31 date: entry.date,
32 sessions: entry.sessions,
33 total_seconds: entry.total_seconds,
34 hours_worked: (entry.total_seconds / 3600).toFixed(2),
35 hours_display: `${Math.floor(entry.total_seconds / 3600)}h ${Math.floor((entry.total_seconds % 3600) / 60)}m`
36}));

Pro tip: For date ranges longer than 7 days, use the /activity/summary endpoint instead of /activity/worklog — summary returns pre-aggregated totals per user, which is far more efficient than fetching and aggregating thousands of raw worklog entries client-side.

Expected result: The worklog query returns an aggregated array of user-date records with total hours worked, session counts, and formatted duration strings. Data is ready to bind to a Table component.

4

Build the remote team monitoring dashboard

With worklog data available, build the team monitoring dashboard. First, fetch the user list by creating a second GET query to /users with the company parameter — this provides names to display alongside user IDs from the worklog data. Add a DateRangePicker at the top of the canvas set to last 7 days by default. Create a JavaScript query that joins the worklog aggregates with user names: use the user list from the users query as a lookup map, matching user_id to display names. Drag a Table component onto the canvas and bind it to the joined dataset. Configure the Table to show: User Name, Date, Hours Worked, and Sessions columns. Enable row grouping by User Name to create a collapsible view where each user's daily entries are nested under their name. Add a summary row showing per-user totals. Add Stat components at the top showing team-level totals: total hours logged across all users, average hours per user per day, and total number of active users (users with at least one session). Drag a Bar Chart component showing total hours per user for the period — this gives a visual comparison of individual contributions. Add a second Chart as a Line chart showing team-level total hours by day over the date range, making it easy to spot days with low attendance or unusually high overtime. Add a user filter dropdown bound to the users query data so managers can narrow the Table to specific team members.

join_users_worklogs.js
1// JavaScript query: join worklog aggregates with user names
2// Assumes: getWorklogs.data = aggregated worklog array, getUsers.data = user list
3const worklogs = getWorklogs.data || [];
4const users = getUsers.data?.users || getUsers.data || [];
5
6// Build user lookup map
7const userMap = {};
8users.forEach(u => {
9 userMap[u.id || u.userId] = {
10 name: u.name || u.fullName || `User ${u.id}`,
11 email: u.email || ''
12 };
13});
14
15// Merge names into worklog records
16return worklogs.map(entry => ({
17 ...entry,
18 user_name: userMap[entry.user_id]?.name || `User ${entry.user_id}`,
19 user_email: userMap[entry.user_id]?.email || ''
20}));

Pro tip: When building team monitoring dashboards, consider privacy implications for your team members. Display aggregate metrics (hours worked, productive percentage) prominently while keeping screenshot thumbnails and detailed app usage data accessible only via explicit drill-down, not in the default view.

Expected result: A complete team monitoring dashboard displays: team-level Stat summaries at the top, a user-and-date Table with grouped rows below, and a Bar chart comparing individual hours contributions — all filtered by the date range picker.

5

Add productivity scoring and app usage panels

Time Doctor tracks not just hours worked but also app and website usage, classifying each application as productive, unproductive, or neutral. Enrich the dashboard with this productivity data. Create a third GET query targeting /activity/computer-activity with the company and user_ids parameters and the same date range parameters. This endpoint returns app/website usage data per user, including the application name, URL (for websites), duration, and productivity classification set in your Time Doctor account. Add a JavaScript transformer to aggregate app usage by user and productivity category, computing a productive time percentage: (productive_seconds / total_seconds) * 100. Drag a second Table onto the canvas (consider placing it in a Tab component to keep the layout clean) to show app usage data. Include a User dropdown that filters the app usage Table to show data for the selected user. For each user row in the main Table, add an event handler on row click that sets the selected user for the app usage Tab, creating a drill-down workflow: click a user in the attendance Table → switch to the App Usage tab → see that user's app breakdown. For detailed per-session screenshot review, query /screenshots with a user_id and date to fetch screenshot metadata including timestamp and the screenshot URL, then display thumbnails in a Retool Image component or link to them from the Table.

productivity_scores.js
1// JavaScript transformer: compute productivity scores from computer activity data
2const activity = data.computerActivity || data || [];
3
4// Group by user
5const byUser = {};
6activity.forEach(entry => {
7 const userId = entry.userId || '';
8 const duration = parseInt(entry.time || entry.duration || 0);
9 const productivity = entry.productivity || 'neutral'; // 'productive', 'unproductive', 'neutral'
10
11 if (!byUser[userId]) {
12 byUser[userId] = { user_id: userId, productive: 0, unproductive: 0, neutral: 0, total: 0 };
13 }
14 byUser[userId][productivity] += duration;
15 byUser[userId].total += duration;
16});
17
18return Object.values(byUser).map(u => ({
19 user_id: u.user_id,
20 total_seconds: u.total,
21 productive_seconds: u.productive,
22 unproductive_seconds: u.unproductive,
23 neutral_seconds: u.neutral,
24 productive_pct: u.total > 0 ? ((u.productive / u.total) * 100).toFixed(1) + '%' : '0%',
25 hours_productive: (u.productive / 3600).toFixed(2)
26}));

Pro tip: Time Doctor's app productivity classifications (productive/unproductive/neutral) are configured at the company level in Time Doctor settings and apply to all team members. Review these classifications before building productivity score dashboards to ensure they reflect your actual standards.

Expected result: The dashboard shows productivity scores alongside hours worked for each team member. Clicking a user in the main Table switches to the App Usage tab showing that user's application and website breakdown with productivity classification.

Common use cases

Daily remote team attendance and hours dashboard

Build a Retool dashboard showing every team member's hours logged for today and the past week, alongside their productive time percentage and idle time. A Table shows all users with their total worked hours, productive percentage (time actively using tracked apps vs idle), and a status indicator for whether they've met daily minimums. Managers can click any row to see a detailed breakdown of that user's work session for the day.

Retool Prompt

Build a Retool remote team attendance dashboard that queries Time Doctor's worklog API for all company users for the past 7 days. Show a Table with user name, total hours worked per day, productive time percentage, and idle time. Add a date picker to change the reporting period and highlight rows where logged hours fall below a minimum threshold set in a number input.

Copy this prompt to try it in Retool

App and website usage analysis panel

Create a Retool panel that shows which applications and websites team members spend their time on, with productivity classification. Query Time Doctor's computer activity endpoint to retrieve app usage data, then aggregate by app name and productivity category (productive, unproductive, neutral) per user. The panel helps identify productivity patterns, spot time spent on non-work sites, and inform conversations about app usage guidelines.

Retool Prompt

Build a Retool app usage analysis tool that queries Time Doctor's computer activity API for a selected user and date range. Show a pie Chart of time split between productive, unproductive, and neutral activities. Display a Table of top 20 apps by time spent, with the productivity classification and total duration. Include a user dropdown to switch between team members.

Copy this prompt to try it in Retool

Project time allocation and payroll report

Build a Retool project allocation dashboard that shows how many hours each team member spent on each project during a pay period. Query Time Doctor's worklog API filtered by project to get time entries per user per project, then pivot the data in a JavaScript transformer to create a user-by-project matrix. Export the aggregated hours as a downloadable CSV for payroll processing or client billing.

Retool Prompt

Build a Retool project time report that queries Time Doctor worklogs grouped by user and project for a selected date range. Create a pivot table in a JavaScript transformer showing users as rows and projects as columns with total hours at the intersection. Display a Bar chart of total hours per project and a Table of the pivot data. Add a CSV export button.

Copy this prompt to try it in Retool

Troubleshooting

API returns 401 Unauthorized error on all requests

Cause: The API token is being sent in the Authorization header rather than as a token URL parameter, or the token has expired or been revoked.

Solution: Remove any Authorization header from the Retool Resource and ensure the token is configured as a URL parameter named exactly token at the Resource level. Verify the token is still valid by testing it in the Time Doctor API Explorer or by re-generating it from Time Doctor Settings → Integrations → API. Update the TIMEDOCTOR_TOKEN configuration variable with the new token value.

Worklog query returns an empty array despite team members actively working

Cause: The company_id parameter is missing or incorrect, the date range is in the wrong format, or the queried users have privacy settings that restrict data visibility.

Solution: Verify the company parameter value matches your Time Doctor company ID (confirm in Time Doctor settings or from the API authentication response). Ensure date formats are YYYY-MM-DD — Time Doctor does not accept ISO 8601 datetime strings for date parameters. If users have individual privacy settings enabled, their data may not appear in manager-level queries. Check that your account has manager or admin permissions.

Computer activity query returns data but productivity percentages are all 'neutral'

Cause: App productivity classifications have not been configured in Time Doctor settings, so all apps default to 'neutral' classification.

Solution: In the Time Doctor web app, navigate to Settings → Productivity Ratings. Configure which applications and websites are classified as Productive or Unproductive for your company. After saving these settings, new computer activity data will carry the correct classification. Historical data classification may not be retroactively updated.

Worklog totals in Retool do not match the totals shown in Time Doctor's native reports

Cause: Time Doctor's native reports may apply additional filtering (e.g., excluding very short sessions, applying minimum session length thresholds) that the raw worklog API does not automatically apply.

Solution: Filter out worklog entries with a duration below a minimum threshold (e.g., entries less than 10 seconds) in your JavaScript transformer, as Time Doctor's native reports typically exclude these micro-sessions from aggregated totals. Apply the same filtering logic that Time Doctor uses for its own reports based on your account's minimum session length setting.

typescript
1// Filter out short sessions (less than 10 seconds) before aggregation
2const worklogs = data.worklog || [];
3const filteredWorklogs = worklogs.filter(entry => parseInt(entry.length || 0) >= 10);
4// Continue with aggregation using filteredWorklogs

Best practices

  • Store the Time Doctor API token in a Retool configuration variable marked as secret — this prevents the token from being exposed to frontend JavaScript and enables rotation without editing the resource.
  • Use the /activity/summary endpoint for date ranges longer than a few days instead of /activity/worklog — summary returns pre-aggregated totals per user, reducing both response size and transformer complexity.
  • Always display productivity data with appropriate context — show productive percentage alongside total hours worked rather than in isolation, since a 90% productivity score on 2 hours of work tells a different story than 90% on 8 hours.
  • Enable query caching (5-10 minutes) on worklog and user list queries — Time Doctor data updates every few hours rather than in real time, so aggressive caching has no practical cost and reduces API load.
  • Separate the user list query from the worklog query and fetch users once per session — the user list changes infrequently and does not need to refresh every time the date range changes.
  • Add clear date range constraints in the Retool UI (e.g., maximum 31 days) — very long date ranges generate large worklog datasets that are slow to aggregate in JavaScript transformers and may exceed Retool's query result size limits.
  • When displaying screenshot data, show only thumbnails or count rather than full-resolution screenshots in the main Table — load full screenshots only when a user explicitly clicks to view them to keep dashboard performance fast.

Alternatives

Frequently asked questions

Does connecting Retool to Time Doctor expose screenshot images directly?

The Time Doctor API returns screenshot metadata (timestamp, file path, and a URL for each screenshot) rather than embedding the image data in the API response. In Retool, you can display screenshot thumbnails using an Image component bound to the screenshot URL field, or link to screenshots from a Table column. Screenshot URLs may require the API token as a query parameter to access — test the URL format from your Time Doctor account before building screenshot display functionality.

Can I query Time Doctor data for a specific employee without admin access?

The Time Doctor API has different access levels based on the account role of the token owner. Admin tokens can query data for all users in the company. Manager tokens can query data for the team members assigned to that manager. Employee-level tokens typically only return data for the token owner. For a team monitoring dashboard, ensure the API token belongs to an admin or manager account with visibility over the team you want to monitor.

How does Retool handle the large volume of raw worklog entries Time Doctor returns?

Time Doctor's worklog API returns individual time entries that can number in the thousands for a large team over a long date range. Use Retool JavaScript transformers to aggregate these entries by user and date before binding them to a Table. For date ranges longer than a week, use the /activity/summary endpoint instead — it returns one pre-aggregated record per user per day rather than individual session entries, making it far more efficient for dashboard use.

Can Retool trigger Time Doctor actions, such as starting a timer for a user?

The Time Doctor API is primarily read-focused for third-party integrations — you can read worklogs, user data, screenshots, and activity data, but starting or stopping timers for other users is not supported through the API for privacy reasons. Timer control is available only through the Time Doctor desktop and mobile apps operated by the individual user. Retool is best suited for reading and displaying Time Doctor data rather than controlling tracking.

RapidDev

Talk to an Expert

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

Book a free consultation

Integrations are where projects stall

We wire Retool integrations like this one every week — auth, webhooks, edge cases included. Fixed-price builds from $13K, delivered in 6–10 weeks.

Talk to an integration engineer

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.