Connect Retool to Withings using a REST API Resource with Withings Health API OAuth 2.0 authentication. Build health monitoring dashboards that display weight measurements, blood pressure readings, sleep quality scores, and activity data from Withings smart devices. Ideal for corporate wellness programs, health coaching platforms, and clinical operations teams tracking patient biometrics.
| Fact | Value |
|---|---|
| Tool | Withings |
| Category | Other |
| Method | REST API Resource |
| Difficulty | Intermediate |
| Time required | 30 minutes |
| Last updated | April 2026 |
Build a Withings Health Data Dashboard in Retool
Withings smart devices — scales, blood pressure monitors, sleep analyzers, and activity watches — generate rich longitudinal health data that is typically only accessible through the Withings mobile app and Health Mate platform. For organizations running corporate wellness programs, health coaching services, or clinical pilot programs, Retool provides a way to aggregate and visualize this biometric data in custom operational dashboards without building a full application.
The Withings Health API exposes measurement data across categories: body measurements (weight, BMI, fat mass, bone mass, muscle mass), cardiovascular metrics (systolic/diastolic blood pressure, heart rate), sleep data (duration, deep sleep, REM cycles, sleep score), and activity data (steps, calories, elevation). In Retool, you can combine these datasets into a single panel that shows health trends over time using Chart components, flags measurements outside target ranges, and compares individuals within a wellness cohort.
Withings uses an unconventional API design where nearly all endpoints use POST requests with an 'action' parameter in the request body rather than distinct REST paths. Understanding this pattern is essential for configuring Retool queries correctly. Once configured, Retool's server-side proxy handles OAuth token transmission transparently, and your team can build richly filtered health dashboards without any credential management overhead.
Integration method
Withings does not have a native Retool connector. You connect via a REST API Resource pointing to Withings Health API (wbsapi.withings.net) with OAuth 2.0 authentication. Withings uses a non-standard OAuth 2.0 implementation where all API requests use POST method with action parameters in the body rather than standard REST path segments. Once authenticated and configured, all Retool queries route through Retool's server-side proxy, keeping OAuth credentials off the client and eliminating CORS issues.
Prerequisites
- A Withings developer account at developer.withings.com — create a free account and register a new application to obtain Client ID and Client Secret
- At least one Withings device (scale, blood pressure monitor, sleep analyzer, or activity tracker) with data synced to the Withings Health Mate app
- A Retool account with permission to create Resources and Configuration Variables
- Familiarity with OAuth 2.0 concepts (authorization code flow, access tokens, refresh tokens)
- Understanding of Retool's REST API Resource query editor and JavaScript transformers
Step-by-step guide
Register a Withings application and complete OAuth authorization
To use the Withings Health API, you need to register an application and complete an OAuth 2.0 authorization flow to obtain an access token. Start at developer.withings.com — sign in with your Withings account (or create one) and navigate to 'My Applications'. Click 'Create Application', give it a name like 'Retool Integration', set the application type to 'Mobile Application' or 'Web Application', and enter a Redirect URI. For Retool internal tools, you can use https://oauth.pstmn.io/v1/callback as the redirect URI to complete the flow using Postman or a similar tool, since Retool does not have a built-in OAuth callback for custom resources. Note your Client ID and Client Secret from the application settings. To get an access token: construct an authorization URL in the format https://account.withings.com/oauth2_user/authorize2?response_type=code&client_id={YOUR_CLIENT_ID}&scope=user.metrics,user.activity,user.sleepevents&redirect_uri={YOUR_REDIRECT_URI}&state=random123. Open this URL in a browser while logged into your Withings account. After granting consent, you receive an authorization code in the redirect URL. Exchange this code for tokens by POSTing to https://wbsapi.withings.net/v2/oauth2 with action=requesttoken and your client credentials. The response contains access_token and refresh_token — store both in Retool's Settings → Configuration Variables as WITHINGS_ACCESS_TOKEN and WITHINGS_REFRESH_TOKEN, marking both as secret.
1// OAuth token exchange — send as form-encoded POST to Withings2// POST https://wbsapi.withings.net/v2/oauth23// Content-Type: application/x-www-form-urlencoded4{5 "action": "requesttoken",6 "grant_type": "authorization_code",7 "client_id": "YOUR_CLIENT_ID",8 "client_secret": "YOUR_CLIENT_SECRET",9 "code": "AUTHORIZATION_CODE_FROM_REDIRECT",10 "redirect_uri": "YOUR_REDIRECT_URI"11}Pro tip: Withings access tokens expire after 3 hours by default. Include a Retool Workflow that checks token expiry and refreshes using the refresh_token grant before running dashboard queries. Store the token expiry timestamp in a Retool Database table alongside the refresh token.
Expected result: You have a Withings access token and refresh token stored as secret configuration variables in Retool Settings.
Create the Withings REST API Resource in Retool
In Retool, click the Resources tab and then Add Resource. Select REST API from the resource type list. Name the resource 'Withings API'. In the Base URL field, enter https://wbsapi.withings.net — this is the base URL for all Withings Health API endpoints. Scroll to the Authentication section and select Bearer Token from the dropdown. In the token value field, enter {{ retoolContext.configVars.WITHINGS_ACCESS_TOKEN }} to reference your stored configuration variable. Scroll to the Headers section and add a default header: set key to Content-Type and value to application/x-www-form-urlencoded. This is critical — Withings' API expects all request bodies in URL-encoded form format, not JSON, even when making POST requests. This is a key difference from standard REST APIs and must be configured at the resource level to ensure all queries use the correct content type. Click Save Changes. Note: Withings' API is structured so that different types of measurements and actions all go to different path segments (/measure, /v2/sleep, /v2/activity) but always use POST method with an 'action' query parameter or body parameter specifying the operation. This makes the query editor configuration slightly different from typical REST APIs — you will set the path per query type rather than using a single endpoint.
Pro tip: If you encounter HTTPS certificate errors during testing, verify that the resource Base URL uses https:// (not http://). Withings enforces HTTPS for all API requests and will reject plaintext connections.
Expected result: A 'Withings API' resource appears in your Retool Resources list and is configured for Bearer Token authentication with form-encoded content type.
Build queries to retrieve weight and body composition measurements
Withings' measurement data is retrieved from a single endpoint with different 'meastype' parameters specifying which measurement categories to return. In the Retool Code panel, create a new query, select the Withings API resource, set Method to GET, and Path to /measure. Add URL parameters: key 'action', value 'getmeas'; key 'meastype', value '1,6,8' (1 = weight in kg, 6 = fat ratio %, 8 = fat mass weight in kg — add more types as needed); key 'category', value '1' (1 = real measurements, 2 = user goals); key 'startdate', value {{ Math.floor(new Date(dateRange.startDate).getTime() / 1000) }} (Withings uses Unix timestamps in seconds); key 'enddate', value {{ Math.floor(new Date(dateRange.endDate).getTime() / 1000) }}; key 'limit', value '200'. Name this query 'getBodyMeasurements'. The response returns a 'measuregrps' array where each group contains a 'measures' array with objects having 'type', 'value', and 'unit' fields. The actual measurement value = value * 10^unit — a value of 7000 with unit -3 means 7.0 kg. Write a JavaScript transformer to decode this into readable metrics. Create a second query for blood pressure: same path /measure with meastype '9,10' (9 = diastolic BP in mmHg, 10 = systolic BP in mmHg). Name it 'getBloodPressure'.
1// Transformer: decode Withings measurement groups into readable rows2const groups = data.body?.measuregrps || [];3const measureLabels = {4 1: 'weight_kg', 6: 'fat_ratio_pct', 8: 'fat_mass_kg',5 9: 'diastolic_bp', 10: 'systolic_bp', 11: 'heart_rate',6 12: 'temperature_c', 54: 'spo2_pct'7};89return groups.map(group => {10 const date = new Date(group.date * 1000).toLocaleDateString();11 const row = { date, measured_at: date };12 (group.measures || []).forEach(m => {13 const label = measureLabels[m.type];14 if (label) {15 row[label] = parseFloat((m.value * Math.pow(10, m.unit)).toFixed(2));16 }17 });18 return row;19}).filter(row => Object.keys(row).length > 2);Pro tip: Withings measure type 11 is heart rate (in bpm). You can retrieve it alongside blood pressure measurements using meastype='9,10,11' in a single query rather than making separate API calls.
Expected result: The getBodyMeasurements query returns an array of decoded measurement rows with human-readable column names and numeric values in real units.
Build queries for sleep and activity data
Sleep and activity data use different Withings API paths from the measurement endpoint. For sleep data, create a new query, select Withings API resource, set Method to GET, Path to /v2/sleep. Add URL parameters: 'action' = 'getsummary', 'startdateymd' = {{ dateRange.startDate }} (YYYY-MM-DD format — sleep API uses date strings, not Unix timestamps), 'enddateymd' = {{ dateRange.endDate }}, 'data_fields' = 'nb_rem_episodes,sleep_score,total_timeinbed,total_sleep_time,total_deep_sleep_time,total_light_sleep_time,wakeup_count'. Name this query 'getSleepSummary'. For activity data, create another query with Path /v2/activity and parameters: 'action' = 'getactivity', 'startdateymd' = {{ dateRange.startDate }}, 'enddateymd' = {{ dateRange.endDate }}, 'data_fields' = 'steps,calories,totalcalories,distance,elevation,soft,moderate,intense'. Name it 'getActivity'. Note that sleep and activity endpoints use ISO date strings (YYYY-MM-DD) while the measure endpoint uses Unix timestamps — this inconsistency in the Withings API requires careful parameter handling per query type. Write a transformer for sleep data that extracts the 'series' array from data.body and formats each night's metrics. Add all three queries to a Date Range Picker's change event handler so the entire dashboard refreshes when the user selects a new date window.
1// Transformer: format Withings sleep summary data2const series = data.body?.series || [];3return series.map(night => ({4 date: night.date,5 sleep_score: night.data?.sleep_score || 0,6 total_sleep_hours: night.data?.total_sleep_time7 ? (night.data.total_sleep_time / 3600).toFixed(1)8 : null,9 deep_sleep_minutes: night.data?.total_deep_sleep_time10 ? Math.round(night.data.total_deep_sleep_time / 60)11 : null,12 rem_episodes: night.data?.nb_rem_episodes || 0,13 wake_count: night.data?.wakeup_count || 0,14 time_in_bed_hours: night.data?.total_timeinbed15 ? (night.data.total_timeinbed / 3600).toFixed(1)16 : null17}));Pro tip: The Withings sleep summary API returns durations in seconds. Divide by 3600 for hours or by 60 for minutes in your transformer. Display sleep stage breakdown as a stacked Bar Chart in Retool using the Chart component's 'series' configuration.
Expected result: The getSleepSummary and getActivity queries return formatted arrays of nightly sleep metrics and daily activity data, ready to bind to Charts and Tables.
Build the health monitoring dashboard UI
With all data queries configured, build the dashboard layout. From the component panel, drag a Date Range Picker component onto the canvas and set default values spanning the last 30 days. Bind all query run triggers to this component's change event. Create a row of Stat components at the top showing key metrics: average weight from the last measurement, latest blood pressure reading, last sleep score, and total steps in the selected period — bind these to specific index positions in your query results using {{ getBodyMeasurements.data?.[0]?.weight_kg || 'N/A' }}. Below the stats row, drag a Chart component and configure it for a Line Chart type. Set the data source to {{ getBodyMeasurements.data }} with the date field as the X-axis and weight_kg as the Y-axis series. Add a title 'Weight Trend'. Add a second Chart component for sleep: set data to {{ getSleepSummary.data }}, configure as a Bar Chart with date on X-axis, and add three series for deep_sleep_minutes, rem_episodes (scaled), and total_sleep_hours (scaled to minutes for comparison). Add a Table component bound to {{ getBloodPressure.data }} with columns date, systolic_bp, diastolic_bp, and heart_rate. Use conditional column formatting to highlight rows where systolic_bp > 140 or diastolic_bp > 90 in red. For complex wellness program dashboards tracking cohorts of users across multiple Withings accounts, RapidDev's team can help design a multi-user OAuth architecture and aggregation layer in Retool.
1// Chart configuration example for weight trend2// Bind to Chart component's series property3[4 {5 "name": "Weight (kg)",6 "data": "{{ getBodyMeasurements.data.map(d => ({ x: d.date, y: d.weight_kg })) }}",7 "type": "line"8 }9]Pro tip: Use Retool's 'Refresh on variable change' query setting instead of manual event handlers for all health data queries — set each query to re-run automatically when dateRange changes, which keeps all charts in sync when users adjust the date window.
Expected result: A health monitoring dashboard shows weight trends, sleep quality metrics, and blood pressure history in synchronized Charts and Tables, all controlled by a shared date range picker.
Common use cases
Build a corporate wellness biometric tracking dashboard
Create a Retool panel that aggregates weight and BMI trends across wellness program participants who have connected their Withings accounts. Display weekly averages in a Line Chart, flag participants outside healthy ranges using conditional table formatting, and show aggregate program statistics for HR wellness coordinators.
Build a Retool dashboard showing Withings weight and BMI trends for a wellness program cohort. Display a Line Chart of weekly average weight over 12 weeks, a Table of participants with latest weight, BMI, and trend direction, and color-code rows based on BMI category (underweight/normal/overweight).
Copy this prompt to try it in Retool
Build a blood pressure monitoring panel for remote patient programs
Create a Retool health dashboard that queries Withings blood pressure measurements for enrolled patients. Display systolic/diastolic readings in a Scatter Chart with reference lines at clinical threshold values, show a Table of recent readings with hypertension classification, and highlight readings requiring clinical follow-up.
Build a Retool panel showing Withings blood pressure readings with a Scatter Chart of systolic vs diastolic values, reference lines at 120/80 and 140/90 mmHg, and a Table of readings flagged as Stage 2 hypertension needing follow-up.
Copy this prompt to try it in Retool
Build a sleep quality analytics dashboard
Create a Retool panel that queries Withings sleep data to show sleep duration, deep sleep percentage, REM duration, and Withings sleep scores over time. Display a stacked Bar Chart of sleep stage breakdown by night and a Table of nights with sleep scores below 50 that may indicate sleep disruption requiring attention.
Build a Retool sleep dashboard showing Withings sleep data with a stacked Bar Chart of deep/REM/light sleep duration per night, a Line Chart of sleep scores over 30 days, and a Table of poor-sleep nights with score below 50.
Copy this prompt to try it in Retool
Troubleshooting
Withings API returns status 401 with error 'invalid_token'
Cause: Withings access tokens expire after 3 hours by default. If the token stored in Retool's configuration variable has expired, all API calls return a 401 authentication error. This is more frequent than with other APIs that have longer-lived tokens.
Solution: Refresh the access token using the Withings OAuth refresh endpoint. Create a Retool Workflow that POSTs to https://wbsapi.withings.net/v2/oauth2 with action=requesttoken, grant_type=refresh_token, client_id, client_secret, and your refresh_token. Update the WITHINGS_ACCESS_TOKEN configuration variable with the new token returned in the response. For production use, schedule this Workflow to run every 2 hours to preemptively refresh tokens before expiry.
Measurement values look incorrect — weight showing as 65000 instead of 65
Cause: Withings returns measurements as integers with a separate 'unit' exponent field. The actual value is computed as value * 10^unit. Without applying this formula in the transformer, raw values appear as large integers (e.g., 65000 for 65.0 kg where unit is -3).
Solution: Apply the Withings unit conversion in every measurement transformer: const actual = m.value * Math.pow(10, m.unit). The unit field is always a negative integer representing the decimal places. For example, a weight value of 65000 with unit -3 = 65000 * 10^(-3) = 65.000 kg.
1// Correct Withings value decoding2const decodeValue = (m) => parseFloat((m.value * Math.pow(10, m.unit)).toFixed(2));Sleep query returns empty series array despite data existing in the Withings app
Cause: The Withings sleep summary API uses YYYY-MM-DD date format (not Unix timestamps), and the parameter name is 'startdateymd' not 'startdate'. Using the wrong parameter names or timestamp format causes the endpoint to silently return an empty dataset rather than an error.
Solution: Verify that your sleep query URL parameters use 'startdateymd' and 'enddateymd' with values in YYYY-MM-DD string format. Use JavaScript in the parameter value field to format dates: new Date(dateRange.startDate).toISOString().split('T')[0]. Confirm that the Withings account has sleep data synced for the selected date range by checking the Health Mate app.
Best practices
- Store Withings OAuth access tokens and refresh tokens in Retool Configuration Variables marked as secret — never place OAuth credentials directly in resource headers or query parameters
- Build a Retool Workflow for automatic token refresh that runs every 2 hours, since Withings access tokens expire after 3 hours — this prevents dashboard downtime due to expired credentials
- Always apply the Withings value-unit formula (value * 10^unit) in JavaScript transformers before displaying measurement values — raw Withings values are integers that require unit conversion to be human-readable
- Use date strings (YYYY-MM-DD) for sleep and activity endpoints and Unix timestamps (seconds) for the measure endpoint — Withings uses different date formats per API section, so parameterize date conversion per query type
- Limit measurement queries to 200 records per request using the 'limit' URL parameter and implement pagination with 'offset' for historical data dashboards to stay within Withings' API response size constraints
- Add Retool's query caching (60 seconds minimum) to all Withings read queries — health data updates infrequently and caching significantly reduces API calls when multiple team members view the dashboard simultaneously
- For cohort-based wellness programs tracking multiple users, design a database resource in Retool that stores anonymized user identifiers mapped to their Withings access tokens, rather than building separate Retool apps per user
Alternatives
Garmin Connect is a better fit if your team or patients use Garmin fitness wearables, as it provides richer activity and fitness performance data through the Garmin Health API partner program.
Fitbit's Web API offers a more developer-friendly OAuth 2.0 flow with PKCE and better activity tracking documentation, making it easier to integrate in Retool if users have Fitbit wearables rather than Withings devices.
If nutrition tracking alongside biometrics is the primary use case, MyFitnessPal's data (despite API deprecation) can be accessed via third-party data bridges — consider this when caloric and dietary data is as important as measurement data.
Frequently asked questions
Does Retool have a native Withings connector?
No, Retool does not include a native Withings connector. You connect Withings via a REST API Resource configured with OAuth 2.0 Bearer Token authentication pointing to the Withings Health API at wbsapi.withings.net. All requests route through Retool's server-side proxy, so OAuth credentials are never exposed to the browser.
How do I handle multiple Withings user accounts in one Retool dashboard?
For programs tracking multiple participants, store each user's Withings access token in a database table alongside their user identifier. In Retool, create a Select component that lets operators choose a participant, then use the selected user's token in a JavaScript query that dynamically sets the Authorization header before calling the Withings API. For enterprise cohort tracking, build a Retool Workflow that refreshes all user tokens and stores updated versions to your database on a schedule.
What measurement types does the Withings API support?
The Withings measure endpoint supports numeric type codes for different biometrics. Key types include: 1 (weight in kg), 4 (height in meters), 5 (fat-free mass in kg), 6 (fat ratio %), 8 (fat mass in kg), 9 (diastolic blood pressure mmHg), 10 (systolic blood pressure mmHg), 11 (heart rate bpm), 12 (temperature °C), 54 (SpO2 %), 71 (body temperature °C), 76 (muscle mass kg), and 77 (hydration %). Request multiple types in a single query using a comma-separated meastype parameter.
How often does Withings sync device data to the API?
Withings devices sync data to the cloud when the device is within Bluetooth range of a synced smartphone running the Health Mate app, or via Wi-Fi for compatible scale models. Sync frequency depends on the device and user behavior — some scales sync immediately after weighing, while activity trackers may sync in batches when opened in the app. For real-time dashboards, implement query polling in Retool rather than expecting continuous data availability, and display the last sync timestamp from the measurement group's 'created' field.
Can I write data back to Withings from Retool?
Yes, in limited scenarios. The Withings API supports creating manual measurements via POST to /measure with action=createmeas — useful for adding data from non-Withings devices or correcting erroneous readings. However, Withings does not allow writing sleep or activity data via API; those are device-only inputs. Use a Retool Form to collect manual measurement values and create a POST query that submits them to the Withings createstats endpoint with the appropriate measure type and timestamp.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation