Access your RescueTime data programmatically. Query activity logs, productivity metrics, daily summaries, alerts, highlights, and more.
This page gives an overview of the RescueTime Developer APIs, details on how to access them, and the types of data that can be retrieved.
The Resource API Documentation provides RESTful CRUD operations for managing RescueTime resources like projects, tasks, focus sessions, alerts, goals, and time entries.
The Analytic Data API (documented on this page) is designed for querying historical activity data and productivity metrics with flexible parameters.
User data, particularly activity logs, is synced to the RescueTime servers on a set interval depending on the user's plan subscription:
Once the RescueTime app has synced with our servers, the data is immediately available in API results.
The following table shows the productivity level equivalents referenced in the documentation below for various types of activities.
| Activity | Productivity Equivalent |
|---|---|
| Focus Work | Very Productive |
| Other Work | Productive |
| Neutral | Neutral |
| Personal | Distracting |
| Distracting | Very Distracting |
There are two ways to connect to a user's data in RescueTime: via API Keys or via an OAuth2 Connection. API keys are ideal for personal use, while web services wishing to offer a way for their users to use their RescueTime data should use an OAuth2 connection.
Users can set up an API key by going to their key management page and creating a new key. That key must be included with each API request. The user can revoke keys at any time.
Please contact us and we'll work with you to set up an OAuth2 application. After the user connects their account via OAuth2, an access token will be created. That access token must be included in each API request. The user can revoke access to a service at any time.
Once we have created your OAuth2 application, your app will be assigned a client_id and a client_secret.
These tokens can then be used, along with the secure redirect_uri provided in the request for an OAuth application,
in the following steps to authorize your application's user access to their RescueTime data:
GET request to:
https://www.rescuetime.com/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&response_type=code&scope=YOUR_SCOPES
auth_code, which will expire in 10 minutes.
POST request to:
https://www.rescuetime.com/oauth/token
{
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_APP_SECRET",
"grant_type": "authorization_code",
"code": "AUTH_CODE",
"redirect_uri": "YOUR_REDIRECT_URI"
}
access_token.
access_token:
https://www.rescuetime.com/api/oauth/data?access_token=ACCESS_TOKEN&by=interval&taxonomy=productivity&interval=hour&restrict_begin=2018-01-01&restrict_end=2018-01-31&format=json&scopes=time_data
When users connect their accounts to your application via OAuth2, you can specify access scopes to let the user know exactly how you will be using their RescueTime data. Scopes will be requested during the initial authorization request.
The following scopes are currently supported:
time_data - Access activity history and summary time data or post offline time for the authorized usercategory_data - Access how much time the authorizing user spent in specific categoriesproductivity_data - Access how much time the authorizing user spent in different productivity levelsalert_data - Access the authorizing user's alert historyhighlight_data - Read from and post to the authorizing user's daily highlights listfocustime_data - Access the authorizing user's Focus Session history and session starting and stoppingThere are several API endpoints that can be used to access different types of data within RescueTime.
Brings developers prepared and pre-organized data structures already familiar through the reporting views of www.rescuetime.com.
Provides a structured rollup of daily data about the time logged by a user including productivity levels and major categories.
Provides a feed of recent occurrences of user-defined alerts. Premium feature only.
Provides a feed of recently entered daily highlights. Premium feature only.
Allows users to post a daily highlight entry programmatically. Premium feature only.
Allows users to start Focus Session on their active devices programmatically. Premium feature only.
Provides a feed of recent Focus Session started/ended events. Premium feature only.
Allows users to post offline time to their account programmatically. Premium feature only.
RescueTime data is detailed and complicated. The Analytic Data API is targeted at bringing developers the prepared and pre-organized data structures already familiar through the reporting views of www.rescuetime.com. The data is read-only through the webservice, but you can perform any manipulations on the consumer side you want.
The Analytic Data API allows for parameterized access, which means you can change the subject and scope of data, and is especially targeted for developer use. The data can be accessed via the HTTP Query interface in several formats.
The base URL to reach this HTTP query API is:
https://www.rescuetime.com/anapi/datahttps://www.rescuetime.com/api/oauth/data - Least restrictive, requires time_data access scopehttps://www.rescuetime.com/api/oauth/overview_data - Top level category data only, requires category_data scopehttps://www.rescuetime.com/api/oauth/category_data - Sub-category data only, requires category_data scopehttps://www.rescuetime.com/api/oauth/productivity_data - Productivity data only, requires productivity_data scopeAbout restricted reports: Restricted reports may be useful if your application requires a less-granular rollup of the data, such as the category view, but NOT the actual activities themselves. These restricted reports help ensure the user's privacy, and may be a preferable option when asking them to link their accounts.
key - Your API key OR access_token - The access token from the OAuth2 Connectionformat - Output format: csv or jsonPrimary names are chosen for human reading. The short names are for when GET query length is at a premium. The alias is for understanding roughly how it maps into the language used in reporting views.
| Principle Name | Short | Alias | Values | Description |
|---|---|---|---|---|
perspective |
pv | by | [ 'rank' | 'interval' ] |
Consider this the X-axis of the returned data. Determines how data is organized for return.
|
resolution_time |
rs | interval | [ 'month' | 'week' | 'day' | 'hour' | 'minute' ] | Default is "hour". In an interval report, the X axis unit. Data is summarized into chunks of this size. "minute" returns data grouped into five-minute buckets, which is the most granular view available. |
restrict_begin |
rb | - | date (YYYY-MM-DD) | Sets the start day for data batch, inclusive (always at time 00:00, start hour/minute not supported). Format: ISO 8601 "YYYY-MM-DD" |
restrict_end |
re | - | date (YYYY-MM-DD) | Sets the end day for data batch, inclusive (always at time 00:00, end hour/minute not supported). Format: ISO 8601 "YYYY-MM-DD" |
restrict_kind |
rk | taxonomy |
[ 'category' | 'activity' | 'productivity' | 'document' ]
('efficiency' is option when perspective is 'interval') |
Allows you to preprocess data through different statistical engines. The perspective dictates the main grouping of the data,
this provides different aspects of that main grouping.
|
restrict_thing |
rt | taxon | name (of category, activity, or overview) | The name of a specific overview, category, application or website. For websites, use the domain component only if it starts with "www", e.g. "www.nytimes.com" would be "nytimes.com". The easiest way to see what name you should be using is to retrieve a list that contains the name you want, and inspect it for the exact names. |
restrict_thingy |
ry | sub_taxon | name | Refers to the specific "document" or "activity" we record for the currently active application, if supported. For example, the document name active when using Microsoft Word. Available for most major applications and web sites. |
restrict_source_type |
- | - | [ 'computers' | 'mobile' | 'offline' ] | Allows for querying by source device type. |
restrict_schedule_id |
rsi | schedule_id | id (integer id of user's schedule/time filter) | Allows for filtering results by schedule. |
The Analytic Data API supports CSV and JSON output.
csv - Layout provides rows of comma separated data with a header for column names at topjson - Returns a JavaScript ready object with these properties:
Request information about the user's productivity levels, by hour, for January 1, 2020:
https://www.rescuetime.com/anapi/data?key=YOUR_API_KEY&perspective=interval&restrict_kind=productivity&interval=hour&restrict_begin=2020-01-01&restrict_end=2020-01-01&format=json
Request a list of time spent in each top level category, ranked by duration, for January 1, 2020:
https://www.rescuetime.com/anapi/data?key=YOUR_API_KEY&perspective=rank&restrict_kind=overview&restrict_begin=2020-01-01&restrict_end=2020-01-01&format=csv
The Daily Summary Feed API provides a high level rollup of the time a user has logged for a full 24 hour period (defined by the user's selected time zone). This is useful for generating notifications that don't need to be real-time and don't require much granularity (for greater precision or more timely alerts, see the Alerts Feed API).
PLEASE NOTE: The Daily Summary Feed is 'point in time' data - use the data api or export CSVs from reports if you want your latest categorization results. This can be used to construct a customized daily progress report delivered via email. The summary can also be used to alert people to specific conditions. For example, if a user has more than 20% of their time labeled as 'uncategorized', that can be used to offer people a message to update their categorizations on the website.
The base URL to reach this Daily Summary Feed API is:
https://www.rescuetime.com/anapi/daily_summary_feedhttps://www.rescuetime.com/api/oauth/daily_summary_feedkey - Your API key OR access_token - The access token from the OAuth2 ConnectionThe Daily Summary Feed API returns an array of JSON objects representing rollup information for each day logged by the user in the previous two weeks. It does not include the current day, and new summaries for the previous day are available at 12:01 am in the user's local time zone. The returned value for each daily summary includes the following information:
General Information:
id - Unix Timestamp representation of the date. Can be useful for deduplication of items in the feeddate - Summary Dateproductivity_pulse - Overall productivity pulse. A scale between 0-100Percentage representation of time spent in different categories (Float with one decimal place. Min: 0, Max: 100):
very_productive_percentageproductive_percentageneutral_percentagedistracting_percentagevery_distracting_percentageall_productive_percentageall_distracting_percentageuncategorized_percentagebusiness_percentagecommunication_and_scheduling_percentagesocial_networking_percentagedesign_and_composition_percentageentertainment_percentagenews_percentagesoftware_development_percentagereference_and_learning_percentageshopping_percentageutilities_percentageNumeric representation of HOURS spent in different categories (Float with two decimal places):
total_hoursvery_productive_hoursproductive_hoursneutral_hoursdistracting_hoursvery_distracting_hoursall_productive_hoursall_distracting_hoursuncategorized_hoursbusiness_hourscommunication_and_scheduling_hourssocial_networking_hoursdesign_and_composition_hoursentertainment_hoursnews_hourssoftware_development_hoursreference_and_learning_hoursshopping_hoursutilities_hoursString representations of time spent in different categories (format - Xh Ym Zs):
total_duration_formattedvery_productive_duration_formattedproductive_duration_formattedneutral_duration_formatteddistracting_duration_formattedvery_distracting_duration_formattedall_productive_duration_formattedall_distracting_duration_formatteduncategorized_duration_formattedbusiness_duration_formattedcommunication_and_scheduling_duration_formattedsocial_networking_duration_formatteddesign_and_composition_duration_formattedentertainment_duration_formattednews_duration_formattedsoftware_development_duration_formattedreference_and_learning_duration_formattedshopping_duration_formattedutilities_duration_formattedRequest a list of Daily Summaries for a user:
https://www.rescuetime.com/anapi/daily_summary_feed?key=YOUR_API_KEY
The Alerts Feed API is a running log of recently triggered user defined alerts. This is a good event-based representation of data that the user cares about. Alerts are a premium feature and as such the API will always return zero results for users on the RescueTime Lite plan.
The base URL to reach the Alerts Feed API is:
https://www.rescuetime.com/anapi/alerts_feedhttps://www.rescuetime.com/api/oauth/alerts_feed - Requires the alert_data access scopekey - Your API key OR access_token - The access token from the OAuth2 Connectionop - Operation type: status or list
The op parameter determines what type of information about the alerts is returned. Passing op=list will
return a definition list of all the alerts currently defined by the user. This is useful for presenting a list of the user's alerts
to allow the user to select an alert_id value that will be used to filter subsequent queries.
Passing op a value of status is the default, and will return a list of recently triggered alerts in
reverse-chronological order.
alert_id - Integer ID of an alert to filter onWhen passing op=list:
The Alerts Feed API will return an array of JSON objects representing the currently active alerts that the user has defined:
{
"id": integer, // Unique id of the user-defined alert
"description": string, // String representation of the alert definition
"amount": float // Number of hours defined for this alert's threshold
}
When passing op=status:
The feed returns an array of JSON objects representing the actual triggering of alerts in reverse chronological order:
{
"id": integer, // Unique id for the occurrence of the alert triggering
"alert_id": integer, // Unique id of the user-defined alert
"description": string, // Message generated by the triggered alert
"created_at": datetime // Time the alert was triggered (in user's time zone)
}
Request a list of the user's active alerts:
https://www.rescuetime.com/anapi/alerts_feed?key=YOUR_API_KEY&op=list
Request a list of alert 12345 being triggered for the user:
https://www.rescuetime.com/anapi/alerts_feed?key=YOUR_API_KEY&op=status&alert_id=12345
The Highlights Feed API is a list of recently entered Daily Highlight events. These are user-entered strings that are meant to provide qualitative context for the automatically logged time about the user's activities. It is often used to keep a log of "what got done today". Highlights are a premium feature and as such the API will always return zero results for users on the RescueTime Lite plan.
The base URL to reach the Highlights Feed API is:
https://www.rescuetime.com/anapi/highlights_feedhttps://www.rescuetime.com/api/oauth/highlights_feed - Requires the highlight_data access scopekey - Your API key OR access_token - The access token from the OAuth2 ConnectionThe Highlights Feed API returns an array of JSON objects representing the highlights that have been entered by a user:
{
"id": integer, // Unique id, useful for polling for new items
"description": string, // Text of the highlight
"date": date, // Date the highlight was entered for (may differ from created_at)
"created_at": datetime // Timestamp when the highlight was entered
}
Request a list of the user's recently entered daily highlights:
https://www.rescuetime.com/anapi/highlights_feed?key=YOUR_API_KEY
The Highlights Post API makes it possible to post daily highlight events programmatically as an alternative to entering events manually on RescueTime.com. This is useful for capturing information from other systems and providing a view of the "output" that the user is creating (which is a counterpoint to the "input" attention data that RescueTime logs automatically). Examples include adding highlights whenever a code checkin is done, or marking an item in a to-do list application as complete.
The base URL to reach Highlights POST API is:
https://www.rescuetime.com/anapi/highlights_posthttps://www.rescuetime.com/api/oauth/highlights_post - Requires the highlight_data access scopeNote: A POST request must be used for this API.
key - Your API key OR access_token - The access token from the OAuth2 Connectionhighlight_date - A string representing the date the highlight will be posted for. Format: 'YYYY-MM-DD' (unix timestamp also acceptable)description - A 255 character or shorter string containing the text that will be entered for the highlight. Should be representative of an action taken by the usersource - A short string describing the 'source' of the action, or the label that should be applied to it.
Think of this as a category that can group multiple highlights together in the UI. In the reporting UI, they will be collapsed under the expandable source labelA successful post will return a status code of 200. If there is an error, a status code of 400 will be returned.
Post a highlight about a code checkin:
POST: https://www.rescuetime.com/anapi/highlights_post?key=YOUR_API_KEY&highlight_date=2020-01-01&description=CODE_CHECKIN_MESSAGE_HERE&source=check-in
The Focus Session Trigger API makes it possible to start/end Focus Session on active devices as an alternative to starting/ending it manually from the desktop app. This is useful for automating Focus Session from 3rd party applications. An example would be starting/ending Focus Session at a certain time of day.
Note: The RescueTime desktop app syncs with our servers on a 1 minute interval. Focus Session via the API is not a real-time transaction.
The base URL to reach Focus Session Trigger API is:
For connections with an API key:
https://www.rescuetime.com/anapi/start_focustimehttps://www.rescuetime.com/anapi/end_focustimeFor OAuth2 connections:
https://www.rescuetime.com/api/oauth/start_focustimehttps://www.rescuetime.com/api/oauth/end_focustimeRequires the focustime_data access scope to be granted by the user when the OAuth2 connection is initially set up.
Note: A POST request must be used for this API.
key - Your API key OR access_token - The access token from the OAuth2 Connectionduration - An integer representing the length of the Focus Session in minutes, and must be a multiple of 5 (5, 10, 15, 20...).
A value of -1 can be passed to start Focus Session until the end of the day.
Note: This parameter is not required for the end_focustime endpoint.
A successful post will return a status code of 200. If there is an error, a status code of 400 will be returned.
Start Focus Session for 30 minutes on the next desktop app sync:
POST: https://www.rescuetime.com/anapi/start_focustime?key=YOUR_API_KEY&duration=30
End an active Focus Session:
POST: https://www.rescuetime.com/anapi/end_focustime?key=YOUR_API_KEY
The Focus Session Feed API is a running log of recently triggered started/ended Focus Session sessions. This is useful for performing 3rd party app interactions whenever a new Focus Session has started/ended. Focus Session is a premium feature and as such the API will always return zero results for users on the RescueTime Lite plan.
The base URL to reach the Focus Session Feed API is:
For connections with an API key:
https://www.rescuetime.com/anapi/focustime_started_feedhttps://www.rescuetime.com/anapi/focustime_ended_feedFor OAuth2 connections:
https://www.rescuetime.com/api/oauth/focustime_started_feedhttps://www.rescuetime.com/api/oauth/focustime_ended_feedRequires the focustime_data access scope to be granted by the user when the OAuth2 connection is initially set up.
key - Your API key OR access_token - The access token from the OAuth2 ConnectionThe Focus Session Feed API returns an array of JSON objects representing the Focus Session started/ended events in reverse chronological order:
{
"id": float, // UNIX timestamp that represents a unique id for the event
"duration": integer, // Initial length of time in minutes for the session (focustime_started_feed only)
"created_at": datetime // Time the session was started (in user's time zone)
}
Request a list of recent Focus Session started Events:
https://www.rescuetime.com/anapi/focustime_started_feed?key=YOUR_API_KEY
The Offline Time Post API makes it possible to post offline time programmatically as an alternative to entering it manually on RescueTime.com. This is useful for capturing information from other systems. Examples include adding offline time after a meeting on a calendar app, or logging driving time based on location data.
The base URL to reach Offline Time POST API is:
https://www.rescuetime.com/anapi/offline_time_posthttps://www.rescuetime.com/api/oauth/offline_time_post - Requires the time_data access scope
Note: A POST request must be used for this API. Also, offline time posts via the API are limited to a
4 hour maximum duration, and they cannot be created for future dates.
key - Your API key OR access_token - The access token from the OAuth2 Connectionstart_time - A string representing the date/time for the start of the offline time block. Format: 'YYYY-MM-DD HH:MM:SS' (unix timestamp also acceptable)end_time/duration - Either a string representing the date/time for the end of the offline time block, OR an integer representing the duration of the offline time block in minutesactivity_name - A 255 character or shorter string containing the text that will be entered as the name of the activity (e.g. "Meeting", "Driving", "Sleeping", etc)activity_details - A 255 character or shorter string containing the text that will be entered as the details of the named activityA successful post will return a status code of 200. If there is an error, a status code of 400 will be returned.
Post offline time about a meeting that just ended:
A POST request to the following URL:
https://www.rescuetime.com/anapi/offline_time_post?key=YOUR_API_KEY
with a JSON body of:
{
"start_time": "2020-01-01 09:00:00",
"duration": 60,
"activity_name": "Meeting",
"activity_details": "Daily Planning"
}
When you enable access to your data, you generate a key that is saved in RescueTime's system. Essentially, this key provides an alternative read-only authentication to your data. You can keep this key private, in which case it's just as safe as your login and password, or publish it, without exposing your account to other access or risks beyond the scope of the data.
We assume data api access is being requested for use on the server side of things, presumably in some code of your own. In this case, you can protect the key as you would any other server side secret. It would never be seen in the browser, but used by your application to retrieve data from us then process and render yourself somehow. So in this case, the key provides read-only access to your data by arbitrary scope (within limits) through parameters.
As a user, you can revoke access to keys you have created by going to your Key Management Page. Any applications you have connected to via an OAuth2 connection, can be revoked by going to your connected applications page.