
wcli
io.github.withingscli/wcli
Read Withings health data: weight, body composition, blood pressure, sleep, activity and ECG.
Documentation
withings
An agent-first CLI and MCP server for the
Withings Health Data API, in
Go. Binary name: wcli. Website: https://withingscli.com.
The command is called wcli, short for Withings CLI, because it is quick to
type; the project, the repository and the Go module keep the name withings.
Unofficial project.
wcliis an independent, community-built tool. It is not affiliated with, endorsed by, or sponsored by Withings. "Withings" and its product names are trademarks of their owner; this project uses them only to describe interoperability with the Withings API. It is not a medical device and gives no medical advice.
"Agent-first" means the primary caller is a language model, not a human at a terminal:
- stdout carries JSON, always: a single document, an NDJSON stream ending in a summary line, or a typed error envelope. Never prose.
- Self-describing.
wcli schemais a manifest of every command, flag, enum, OAuth scope and exit code, reflected off the live command tree. An agent loadswcli schema --summaryonce instead of scraping--help. - Typed failures. Every error is
{"error":{"kind","code","reason","message","hint","status"?}}with an exit code mapped 1:1 tokind, so an agent branches on.error.kindinstead of grepping stderr. - The awkward parts of the API are handled once. Withings answers every
call with HTTP 200 and a status number in the body, encodes measures as
value x 10^unit, mixes epoch seconds andYYYY-MM-DDbetween endpoints, silently truncates long windows and returns almost nothing unless you ask fordata_fields. The CLI normalizes all of that (see Dates and windows). - Secrets stay out of band. Tokens and the client secret live in the OS
keyring, or an encrypted file where there is none.
--dry-runredacts them. - MCP built in.
wcli mcp serveexposes the same operations as MCP tools. One endpoint registry drives the CLI, the schema manifest and the MCP tool list, so the three cannot drift apart.
Humans are welcome too: add --pretty to any command for indented JSON.
Status
v0.3.2 has been verified against Withings' OpenAPI document (every one of
its 63 operations is covered, checked by a test) and against a strict
in-process fake of the API that rejects requests the spec would not accept.
On 2026-12-02 the OAuth login over the http://localhost:8989/callback
loopback and every decoded read command were also run against one live
account with a BodyFit scale. That account has no watch, sleep, blood
pressure, ECG or stethoscope data, so those reads returned empty lists and
their decoding is still verified against the fake only: treat real responses
that differ from the documented ones as possible bugs and report them.
One thing in particular is unconfirmed: whether Withings accepts an
http://localhost Callback URL for a given app. The default login relies on
http://localhost:8989/callback. If the developer dashboard refuses it, or
the redirect never reaches the CLI, register the callback URL Withings does
accept and use the headless flow, wcli auth login --print-url followed
by wcli auth login --code, which works with any registered callback
(see Headless and remote machines).
Contents
- Status
- Install
- Look around without credentials
- Connect your Withings account
- Quick start: your scale
- Which command for which device
- Raw endpoint commands
- Dates and windows
- Pagination and
--all - Mutating commands and
--dry-run - Errors and exit codes
- Agent integration
- MCP
- Partner-only endpoints
- Plans, limits and missing data
- Security model
- Environment variables
Install
Homebrew (macOS and Linux). wcli is a cask in the
withingscli/homebrew-withings tap:
brew install withingscli/withings/wcli
GitHub releases. Download the archive for your platform from
https://github.com/withingscli/withings/releases
(wcli_<version>_<os>_<arch>.tar.gz; .zip on Windows; macOS, Linux and
Windows on amd64, plus arm64 for macOS and Linux) and put wcli on your
PATH. SECURITY.md shows how to verify the checksums and the
cosign signature.
Go.
go install github.com/withingscli/withings/cmd/wcli@latest
From source.
git clone https://github.com/withingscli/withings && cd withings && make build
Check it worked:
wcli version
{"commit":"9b4054c","date":"2026-12-02T15:04:27Z","version":"0.3.2"}
wcli --version prints the same JSON. For shell tab completion, run
wcli completion bash|zsh|fish|powershell and follow your shell's
instructions; that hidden command prints a shell script and is the only one
whose stdout is not JSON.
Look around without credentials
Withings has no public sandbox, but everything that does not need your data works before you log in:
wcli schema --summary --pretty # every command, one line each
wcli measure getactivity --help # one command's flags and notes: text on stderr, a JSON pointer on stdout
wcli measure getactivity --dry-run --pretty # the exact request, not sent
wcli doctor --pretty # config, keyring, network, clock
--dry-run prints the request the CLI would send and sends nothing:
{
"dry_run": true,
"sent": false,
"endpoint": "measure getactivity",
"mutating": false,
"auth": "bearer",
"method": "POST",
"url": "https://wbsapi.withings.net/v2/measure",
"headers": {
"Authorization": "Bearer <redacted>",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "withings-cli/0.3.2"
},
"params": {
"action": "getactivity",
"data_fields": "steps,distance,elevation,soft,moderate,intense,active,calories,totalcalories,hr_average,hr_min,hr_max,hr_zone_0,hr_zone_1,hr_zone_2,hr_zone_3",
"enddateymd": "2026-12-01",
"startdateymd": "2026-11-24"
}
}
A data command without credentials fails cleanly with exit code 2:
wcli weight
{"error":{"kind":"auth","code":2,"reason":"no_credentials","message":"no Withings credentials are configured","hint":"run 'wcli auth login', or set WITHINGS_TOKEN to an access token"}}
Connect your Withings account
Withings has no personal access tokens and no public OAuth client: you
register your own free developer app once, and wcli logs in with that
app's client ID and secret.
Step 1: create a developer app
-
Go to https://developer.withings.com, sign in with your Withings account and open the developer dashboard.
-
Create an application and choose the Public API integration (the self-serve Health Data API). Name and description can be anything.
-
As the Callback URL enter exactly:
http://localhost:8989/callbackIt must match character for character. It points at your own computer; nothing is exposed to the internet. (Whether the dashboard accepts a localhost URL for your app is unconfirmed, see Status; if it does not, register an HTTPS URL you control and log in with the headless flow.)
-
Save. The dashboard shows a Client ID and a Client Secret.
The 10-user caveat. Withings puts an application whose callback URL uses HTTP, localhost or a non-standard port into restricted mode: at most 10 linked users, meant for development and testing. That is fine for reading your own data, which is what this CLI is for. An app for more users needs a public HTTPS callback URL (and Withings' review); see Headless and remote machines for how to log in with one.
Step 2: log in
wcli auth login
It asks for the client ID and the client secret (hidden as you paste it),
opens the Withings consent page in your browser and captures the redirect on a
local listener. When you approve, the terminal prints a secret-free summary
with "stored": true. From then on the 3-hour access token is refreshed
automatically.
To avoid the prompts, or to log in from a script, put the app credentials in
the environment. --client-secret exists but exposes the secret in the
process list.
export WITHINGS_CLIENT_ID=... # from the developer dashboard
export WITHINGS_CLIENT_SECRET=...
wcli auth login
The default scopes are user.info,user.metrics,user.activity. Add
user.sleepevents with --scopes if you want bed-in/bed-out notifications:
wcli auth login --scopes user.info,user.metrics,user.activity,user.sleepevents
Headless and remote machines
The authorization code in the redirect is valid for 30 seconds, so the hand-off has to be quick. Two ways to log in where no browser can reach the CLI's listener:
-
Paste. Run
wcli auth login --no-browserin a terminal. It prints the URL to open; after you approve, your browser lands onhttp://localhost:8989/callback?code=...&state=...(the page may fail to load, only the URL matters). Paste that URL into the waiting prompt. -
Two steps, for agents and scripts.
wcli auth login --print-urlprints the authorize URL as JSON and remembers the
statefor an hour:{ "authorize_url": "https://account.withings.com/oauth2_user/authorize2?client_id=cid&redirect_uri=http%3A%2F%2Flocalhost%3A8989%2Fcallback&response_type=code&scope=user.info%2Cuser.metrics%2Cuser.activity&state=-fjcxvd-yFm2cMf374qbAYbhSU9kx9gmtILM6-TE780", "code_valid_seconds": 30, "demo": false, "next": "have the user open authorize_url and approve; their browser is redirected to redirect_uri?code=...&state=... (the page may fail to load — only the URL matters). Within 30 seconds run: wcli auth login --code '<that full redirected URL>' (client secret via WITHINGS_CLIENT_SECRET)", "redirect_uri": "http://localhost:8989/callback", "scopes": [ "user.info", "user.metrics", "user.activity" ] }(Run with
WITHINGS_CLIENT_ID=cid; the client ID and state above are placeholders from that run.) Open the URL, approve, then within 30 seconds:wcli auth login --code 'http://localhost:8989/callback?code=...&state=...'Pass the whole redirected URL rather than the bare code so the
stateis verified.
If your app's Callback URL is a public HTTPS address, pass it with
--redirect-uri https://your.domain/path (to --print-url as well; --code
then reuses it). The CLI cannot receive that redirect, so it always uses the
paste or --code path. This is also the fallback if Withings does not accept
the localhost callback for your app.
Demo user
Withings offers a demo account with dummy data. You still need a developer app, but no devices:
wcli auth login --demo
This adds mode=demo to the authorize URL: the consent page opens already
signed in as the demo user. auth status and whoami then report
"demo": true. (wcli oauth2 getdemoaccess --scope-oauth2 user.metrics
is the raw signed endpoint for the same thing; it prints the tokens on stdout
instead of storing them, so keep it away from logs and agents.)
Check it
wcli doctor --pretty # every check should say "ok": true
wcli auth status # how you are logged in; never prints a token
wcli whoami # user id, scopes, demo flag
doctor always exits 0; read "ok" and the per-check hint. Its checks are
config_dir, credential_backend, credentials_present, network,
clock_skew, token_valid, token_expiry and version.
wcli auth logout revokes the grant at Withings (which also removes the
app's notification subscriptions for you) and deletes the stored credentials
(the keyring entry, or credentials.enc together with its credentials.key);
--no-revoke only deletes the local copy.
To change scopes later, log in again with the complete list: --scopes
replaces the grant, it does not add to it. When a call fails for a missing
scope, the error's hint gives the full command (your current scopes plus the
missing one).
When login goes wrong
Read the hint in the error. The common ones:
reason | What it means | Fix |
|---|---|---|
missing_client_id, missing_client_secret | No app credentials and no terminal to prompt on | Set WITHINGS_CLIENT_ID and WITHINGS_CLIENT_SECRET |
code_exchange_failed | Withings refused the code: it is older than 30 seconds, was already used, the client ID/secret is wrong, or the redirect URI differs from the app's Callback URL | Fix the cause and run wcli auth login again |
state_mismatch | The pasted redirect belongs to a different login attempt | Run wcli auth login again and use the redirect from that attempt |
authorization_timeout | Nobody approved in the browser within --login-timeout (300 seconds) | Log in again, or use --print-url then --code |
invalid_token | Withings rejected the access token | wcli auth login |
not_refreshable | The stored token came from --token-stdin and has no refresh token | wcli auth login |
Quick start: your scale
The decoded commands read measure getmeas and do the arithmetic for you.
Each measure becomes one record with value already scaled and a unit.
wcli weight --latest # the newest weigh-in
wcli weight --pretty # the last 30 days
wcli body --latest --pretty # weight, fat, muscle, bone, water, ...
wcli bp --pretty # systolic, diastolic, pulse
wcli weighins --latest # the newest step on the scale, every reading in one record
wcli weighins --units imperial # the same in lb, with the kg value kept beside it
wcli measures --types weight,fat_ratio --start 2026-11-01 --end 2026-11-30
wcli devices --pretty # model, battery, last sync
wcli goals --pretty # steps, sleep and weight goals
The example output in this README was produced by the real binary talking to a local fake server (
WITHINGS_API_BASEplusWITHINGS_TOKEN). The shapes are what the CLI emits; the measurement values, ids and device names are illustrative, not captured from a Withings account.
wcli weight --latest
{"measures":[{"time":"2026-11-30T13:00:00+01:00","type":1,"key":"weight","value":72.345,"unit":"kg","grpid":1001,"deviceid":"f0e1d2c3b4a5968778695a4b3c2d1e0f","category":1,"attrib":0,"attrib_name":"device","ambiguous":false,"model":"Body+","raw":{"value":72345,"exponent":-3}}],"count":1,"more":false,"offset":null,"timezone":"Europe/Paris","updatetime":"2026-11-30T12:01:00Z","window":{"end":"2026-12-02T19:24:41Z","start":"2026-11-02T19:24:41Z"},"units":"metric"}
time is in the account's timezone, raw keeps Withings' original integer
and exponent, and window is the time range that was queried. attrib_name
says in words how Withings attributed the measurement and ambiguous is
true when the device could not tell whose it was (see "Whose measurement
is it"). units is the unit system of the values (see "Units").
wcli body --latest --pretty
{
"measures": [
{
"time": "2026-11-30T13:00:00+01:00",
"type": 1,
"key": "weight",
"value": 72.345,
"unit": "kg",
"grpid": 1001,
"deviceid": "f0e1d2c3b4a5968778695a4b3c2d1e0f",
"category": 1,
"attrib": 0,
"attrib_name": "device",
"ambiguous": false,
"model": "Body+",
"raw": {
"value": 72345,
"exponent": -3
}
},
{
"time": "2026-11-30T13:00:00+01:00",
"type": 6,
"key": "fat_ratio",
"value": 18.25,
"unit": "%",
"grpid": 1001,
"deviceid": "f0e1d2c3b4a5968778695a4b3c2d1e0f",
"category": 1,
"attrib": 0,
"attrib_name": "device",
"ambiguous": false,
"model": "Body+",
"raw": {
"value": 1825,
"exponent": -2
}
}
],
"count": 6,
"more": false,
"offset": null,
"timezone": "Europe/Paris",
"updatetime": "2026-11-30T12:01:00Z",
"window": {
"end": "2026-12-02T19:24:41Z",
"start": "2026-11-02T19:24:41Z"
},
"units": "metric"
}
(Four of the six records are cut from the listing above.)
| Command | Returns | Flags |
|---|---|---|
wcli measures | every measure type, or the ones in --types (keys such as weight,fat_ratio or numeric ids) | --types, --start, --end, --last-update, --latest, --category, --offset, --units, --all |
wcli weight | weight | same, without --types |
wcli body | weight, fat_free_mass, fat_ratio, fat_mass_weight, muscle_mass, hydration, bone_mass, heart_pulse, fat_free_mass_segments, fat_mass_segments, muscle_mass_segments, intracellular_water, extracellular_water, visceral_fat, basal_metabolic_rate, metabolic_age, vascular_age, pulse_wave_velocity | same |
wcli bp | diastolic_bp, systolic_bp, heart_pulse | same |
wcli weighins | one record per weigh-in with every reading of the wcli body set in it (see "One weigh-in, one record") | same as measures; --types defaults to the body set |
wcli devices | {devices:[...], count}; each device gains last_session_time | none |
wcli goals | {goals:{steps, sleep_seconds, weight:{value, unit, metric?, raw}}} | --units |
wcli whoami | user id, scopes, demo flag, from the stored credentials; no network call | none |
wcli body asks for every reading Withings lists for the BodyFit scale (16
of them) plus fat ratio and metabolic age. Segment readings (types 173, 174
and 175) arrive as one record per limb, each with the vendor's position
code and a position_name: right_arm (2), left_arm (3), left_leg (10),
right_leg (11), torso (12). --latest keeps the newest record per type
and per limb, so limbs never collapse into one value. Which of these your
account actually returns depends on your scale and on Withings' plan rules
(see "Plans, limits and missing data").
A position code without a known name keeps its number and simply has no
position_name; it stays a record of its own, in the flat output and under
--latest, so a reading from a zone this version cannot name is never lost
or folded into another limb.
--latest returns only the newest measure of each type in the window and
follows every page itself. --last-update returns everything created or
modified since a time, for incremental sync; it replaces --start/--end.
--category goals returns the user's objectives instead of measurements.
The default window is the last 30 days.
Withings offers ordinary applications no profile endpoint (name, email,
birthdate), so whoami reports the user id only.
One weigh-in, one record
One step on the scale can reach the API as several measure groups: same
device, same second, different grpid. wcli weighins puts them back
together and returns one record per weigh-in.
wcli weighins --latest
{"weighins":[{"time":"2025-12-01T09:00:00+01:00","deviceid":"synthetic-bodyfit","model":"Body Fit","category":1,"attrib":0,"attrib_name":"device","ambiguous":false,"grpids":[6001,6002],"readings":{
"weight":{"type":1,"value":72.345,"unit":"kg","grpid":6001,"raw":{"value":72345,"exponent":-3}},
"fat_mass_weight":{"type":8,"value":15.2,"unit":"kg","grpid":6001,"raw":{"value":15200,"exponent":-3}},
"heart_pulse":{"type":11,"value":61,"unit":"bpm","grpid":6001,"raw":{"value":61,"exponent":0}},
"muscle_mass_segments":{"type":175,"unit":"kg","segments":{
"right_arm":{"type":175,"position":2,"position_name":"right_arm","value":2.95,"unit":"kg","grpid":6002,"raw":{"value":2950,"exponent":-3}},
"left_arm":{"type":175,"position":3,"position_name":"left_arm","value":2.9,"unit":"kg","grpid":6002,"raw":{"value":2900,"exponent":-3}},
"left_leg":{"type":175,"position":10,"position_name":"left_leg","value":9.3,"unit":"kg","grpid":6002,"raw":{"value":9300,"exponent":-3}},
"right_leg":{"type":175,"position":11,"position_name":"right_leg","value":9.4,"unit":"kg","grpid":6002,"raw":{"value":9400,"exponent":-3}},
"torso":{"type":175,"position":12,"position_name":"torso","value":25.75,"unit":"kg","grpid":6002,"raw":{"value":25750,"exponent":-3}},
"position_99":{"type":175,"position":99,"value":1.234,"unit":"kg","grpid":6002,"raw":{"value":1234,"exponent":-3}}
}},
"pulse_wave_velocity":{"type":91,"value":7.2,"unit":"m/s","grpid":6002,"raw":{"value":7200,"exponent":-3}}
}}],"count":1,"more":false,"offset":null,"timezone":"Europe/Paris","updatetime":"2025-12-01T08:01:00Z","window":{"end":"2025-12-02T23:59:59Z","start":"2025-11-02T23:59:59Z"},"units":"metric"}
(Illustrative: the real binary against a local fake serving a synthetic BodyFit weigh-in that arrives as two groups. Reformatted to one reading per line, and 11 of the 16 readings are cut from the listing.)
readingsis keyed by measure key, in the order Withings sent them. Each reading hastype,value,unit, thegrpidit came from andraw. A whole-body reading the scale tags with a position (a BodyFit sendsposition6,between_legs) keepspositionandposition_nameand is still a plain reading.- The three per-segment readings (
fat_free_mass_segments,fat_mass_segments,muscle_mass_segments) hold asegmentsobject keyed by limb:right_arm,left_arm,left_leg,right_leg,torso. A position code without a known name is kept asposition_<code>(position_99above), so a zone this version cannot name is not dropped and cannot overwrite a limb. - A measure type this version does not know is kept as
type_<id>. - A second value for a reading the weigh-in already has is kept in
duplicates, never dropped. grpidslists the measure groups that were merged.
The grouping rule. Measure groups are one weigh-in when they have the
same device, the same second, the same category and the same attribution.
Two kinds of group are never merged with anything, and are each a weigh-in
of their own: a group without a device (a manual entry), and an ambiguous
group (attrib 1), because two ambiguous groups from one scale in the same
second may be two different people and each has to be confirmed by its own
grpid.
--latest returns the single newest weigh-in in the window, whole, and
follows every page itself. Without it one call is one page; when more is
true the last weigh-in on the page can continue on the next page, so use
--all (which joins a weigh-in split across pages) or --latest when that
matters. --types narrows the readings; the default is the wcli body set.
Whose measurement is it
Every decoded record, and every weigh-in, carries Withings' attribution
three ways: the vendor's number (attrib), a name (attrib_name) and a
boolean (ambiguous).
attrib | attrib_name | ambiguous | Meaning |
|---|---|---|---|
| 0, 8 | device | false | captured by a device, known to be this user's |
| 1 | device_ambiguous | true | captured by a device that could not tell which user it measured |
| 2 | manual | false | typed in by the user |
| 4 | manual_at_creation | false | typed in when the account was created; may be inaccurate |
| 5 | bpm_auto | false | blood pressure monitor's automatic best-of-several reading |
| 7 | confirmed | false | confirmed by the user |
| 15 | guided_conditions | false | taken in guided conditions (Nerve Health Score) |
A code outside this table keeps its number and has no attrib_name.
When a response holds an ambiguous group, the page gains warnings, which
lists the groups and names the exact command that settles each one:
wcli weighins
[
{
"code": "ambiguous_attribution",
"message": "1 measure group(s) here were captured by a device that could not tell which user it measured (attrib 1, device_ambiguous). They may belong to someone else: do not report them as this user's until they are confirmed.",
"grpids": [
6003
],
"resolve": "for each grpid listed, run wcli measure confirmuser --grpid 6003 --is-confirmed=true if the measurement is this user's, or wcli measure confirmuser --grpid 6003 --is-confirmed=false if it is not. It writes to Withings, takes one group per call and is a partner-plan operation."
}
]
(Illustrative, from the same local fake; the warnings member of the page.)
--latest reads the whole window but returns only the newest record, so it
also warns about an ambiguous group that is older than what it returned: the
grpids are listed all the same and the message says they are "not among the
records returned". The ambiguous weigh-in itself:
{"time":"2025-11-30T09:00:00+01:00","deviceid":"synthetic-bodyfit","model":"Body Fit","category":1,"attrib":1,"attrib_name":"device_ambiguous","ambiguous":true,"grpids":[6003],"readings":{"weight":{"type":1,"value":81,"unit":"kg","grpid":6003,"raw":{"value":81000,"exponent":-3}}}}
wcli measure confirmuser --grpid <grpid> --is-confirmed=true tells
Withings the group is this user's, --is-confirmed=false that it is not. It
writes to Withings and Withings documents it for partner programs, so an
ordinary application may be refused. With --all the same warnings are in
the summary line. Over MCP the warning names the
withings_measure_confirmuser tool instead.
Units
Withings sends SI values and so does wcli by default. --units imperial
on measures, weight, body, bp, weighins and goals converts what a
person would expect to see converted:
| Metric | Imperial | Exact factor |
|---|---|---|
| kg | lb | 1 lb = 0.45359237 kg |
| m | in, plus feet_inches:{feet, inches} | 1 in = 0.0254 m |
| °C | °F | F = C x 9/5 + 32 |
Pulse wave velocity stays in m/s under either setting: it is a clinical
measure that is quoted in m/s everywhere, and ft/s would mean nothing to the
person reading it. Percentages, bpm, mmHg, years, kcal/day, scores, concentrations and unitless
values are left as they are. The conversion is done in exact rational
arithmetic from the decoded decimal and rounded once, half away from zero,
to 2 decimal places; trailing zeros are not printed. A converted record keeps
the metric value in metric:{value, unit} next to raw, so nothing is lost.
feet_inches splits the already rounded inches, so the two always agree.
wcli weighins --units imperial --latest
{"weighins":[{"time":"2025-12-01T09:00:00+01:00","deviceid":"synthetic-bodyfit","model":"Body Fit","category":1,"attrib":0,"attrib_name":"device","ambiguous":false,"grpids":[6001,6002],"readings":{
"weight":{"type":1,"value":159.49,"unit":"lb","metric":{"value":72.345,"unit":"kg"},"grpid":6001,"raw":{"value":72345,"exponent":-3}},
"fat_mass_weight":{"type":8,"value":33.51,"unit":"lb","metric":{"value":15.2,"unit":"kg"},"grpid":6001,"raw":{"value":15200,"exponent":-3}},
"heart_pulse":{"type":11,"value":61,"unit":"bpm","grpid":6001,"raw":{"value":61,"exponent":0}},
"muscle_mass_segments":{"type":175,"unit":"lb","segments":{
"right_arm":{"type":175,"position":2,"position_name":"right_arm","value":6.5,"unit":"lb","metric":{"value":2.95,"unit":"kg"},"grpid":6002,"raw":{"value":2950,"exponent":-3}},
"left_arm":{"type":175,"position":3,"position_name":"left_arm","value":6.39,"unit":"lb","metric":{"value":2.9,"unit":"kg"},"grpid":6002,"raw":{"value":2900,"exponent":-3}},
"left_leg":{"type":175,"position":10,"position_name":"left_leg","value":20.5,"unit":"lb","metric":{"value":9.3,"unit":"kg"},"grpid":6002,"raw":{"value":9300,"exponent":-3}},
"right_leg":{"type":175,"position":11,"position_name":"right_leg","value":20.72,"unit":"lb","metric":{"value":9.4,"unit":"kg"},"grpid":6002,"raw":{"value":9400,"exponent":-3}},
"torso":{"type":175,"position":12,"position_name":"torso","value":56.77,"unit":"lb","metric":{"value":25.75,"unit":"kg"},"grpid":6002,"raw":{"value":25750,"exponent":-3}},
"position_99":{"type":175,"position":99,"value":2.72,"unit":"lb","metric":{"value":1.234,"unit":"kg"},"grpid":6002,"raw":{"value":1234,"exponent":-3}}
}},
"pulse_wave_velocity":{"type":91,"value":7.2,"unit":"m/s","grpid":6002,"raw":{"value":7200,"exponent":-3}}
}}],"count":1,"more":false,"offset":null,"timezone":"Europe/Paris","updatetime":"2025-12-01T08:01:00Z","window":{"end":"2025-12-02T23:59:59Z","start":"2025-11-02T23:59:59Z"},"units":"imperial"}
(Illustrative, same fake, same trimming as above.)
wcli goals --units imperial
{"goals":{"sleep_seconds":28800,"steps":10000,"weight":{"metric":{"value":70.5,"unit":"kg"},"raw":{"value":70500,"exponent":-3},"unit":"lb","value":155.43}}}
Which command for which device
Every personal reading has a decoded command. A decoded command asks Withings for every field, then returns records a person can read without a lookup table: RFC 3339 times, a name beside every numeric code, the unit in the field name, and lists where Withings sends objects keyed by timestamp.
| Device family | What it records | Command |
|---|---|---|
| Scales (Body, Body+, Body Cardio, Body Smart, Body Comp, Body Scan, BodyFit, ...) | weight, body composition, segments, pulse wave velocity, vascular age, nerve scores | wcli weighins, wcli body, wcli weight |
| Watches and trackers (ScanWatch, Steel HR, Pulse HR, Move, ...) | steps, distance, calories, heart rate, workouts, sleep, SpO2, ECG | wcli activity, wcli intraday, wcli workouts, wcli nights, wcli sleep-stages, wcli ecg, wcli measures |
| Sleep sensors (Sleep, Sleep Analyzer, Sleep Rx) | nights, stages, overnight heart and breathing, snoring, apnea index | wcli nights, wcli sleep-stages |
| Blood pressure monitors (BPM Connect, BPM Core, BPM Pro 2, BPM Vision) | blood pressure, pulse; BPM Core also ECG and stethoscope | wcli bp, wcli ecg, wcli stethoscope |
| Thermo, BeamO | temperature; BeamO also SpO2, ECG and stethoscope | wcli measures --types ..., wcli ecg, wcli stethoscope |
| U-Scan | urine biomarkers | wcli measures --types ... |
| any | which devices the account has | wcli devices |
docs/DEVICE-READINGS.md lists every reading of every device with the measure type or field it arrives as, and a test checks that each one is reachable and named through one of these commands.
What every decoded command has in common:
- Windows.
--startand--endacceptYYYY-MM-DD, RFC 3339 or unix seconds.activity,workoutsandnightsdefault to the last 7 days and also take--last-update;sleep-stagesdefaults to the last 24 hours;intraday,ecgandstethoscopesend no window unless you give one. - One page by default,
{<records>:[...], count, more, offset, window};--allstreams every record as NDJSON and ends with a summary line. - Codes keep their number.
category,state,afib,model,wearpositionand the rest stay as Withings sent them; the name is an extra field (category_name,state_name, ...) that is present only when Withings documents one. Nothing Withings sends is dropped: a field the command does not know is passed through under its own name. - Units are in the key:
_seconds,_m,_kcal,_bpm,_ms,_percent,_celsius,_floors,_breaths_per_min,_per_min,_mmhg,_hz.--units imperialadds a second key beside each distance and temperature (_mi,_ft,_yd,_fahrenheit) and keeps the metric one. - Device names. A record with a documented model id gains
model_namefrom one table shared by every command. A model Withings has not documented (Body Scan 2 is one) passes through unchanged and nothing depends on recognising it.
Scales
wcli weighins (one record per step on the scale), wcli body and
wcli weight are covered in Quick start: your scale.
Readings outside the body composition set are reached by name:
wcli measures --types nerve_health_score_feet,nerve_health_score_left_foot,nerve_health_score_right_foot,electrochemical_skin_conductance
Watches and trackers
wcli activity --start 2025-11-30 --end 2025-12-01 --units imperial # one record per day
{"activities":[{"date":"2025-11-30","timezone":"Europe/Paris","deviceid":"w1","hash_deviceid":"w1","brand":1,"brand_name":"withings","is_tracker":true,"model":"ScanWatch 2","model_id":94,"model_name":"ScanWatch 2","modified":"2025-12-01T09:00:00+01:00","steps":8123,"distance_m":6100.5,"distance_mi":3.79,"elevation_floors":12,"soft_seconds":3600,"moderate_seconds":1800,"intense_seconds":600,"active_seconds":2400,"calories_kcal":410.2,"totalcalories_kcal":2350.7,"hr_average_bpm":68,"hr_min_bpm":49,"hr_max_bpm":141,"hr_zone_0_light_seconds":50000,"hr_zone_1_moderate_seconds":1200,"hr_zone_2_intense_seconds":300,"hr_zone_3_maximal_seconds":0}],"count":1,"more":false,"offset":0,"window":{"end":"2025-12-01","start":"2025-11-30"},"units":"imperial"}
(Illustrative: real output of the binary talking to a local fake API, with made-up values.)
wcli intraday --start 2025-12-01T08:00:00Z --end 2025-12-01T09:00:00Z # samples in time order, at most 24 hours per call
{"samples":[{"time":"2025-12-01T08:00:00Z","timestamp":1764576000,"deviceid":"w1","model":"ScanWatch 2","model_id":94,"model_name":"ScanWatch 2","steps":40,"elevation_floors":1,"calories_kcal":2.5,"distance_m":30.5,"duration_seconds":60,"heart_rate_bpm":61,"spo2_auto_percent":97,"rmssd_ms":42,"sdnn1_ms":55,"hrv_quality":2,"core_body_temperature_celsius":36.6,"rr_breaths_per_min":14},{"time":"2025-12-01T08:01:00Z","timestamp":1764576060,"deviceid":"w1","model":"ScanWatch 2","model_id":94,"model_name":"ScanWatch 2","steps":12,"duration_seconds":60,"heart_rate_bpm":63},{"time":"2025-12-01T08:02:00Z","timestamp":1764576120,"deviceid":"w1","model":"ScanWatch 2","model_id":94,"model_name":"ScanWatch 2","duration_seconds":60,"heart_rate_bpm":64}],"count":3,"window":{"end":"2025-12-01T09:00:00Z","start":"2025-12-01T08:00:00Z"},"units":"metric"}
(Illustrative: real output of the binary talking to a local fake API, with made-up values.) Withings sends series as an object keyed by epoch seconds; here it
is a list sorted by time, and the key is kept as timestamp.
wcli workouts --start 2025-11-30 --end 2025-12-01 --units imperial
{"workouts":[{"id":9001,"category":7,"category_name":"Swimming","date":"2025-12-01","timezone":"Europe/Paris","start":"2025-12-01T09:00:00+01:00","end":"2025-12-01T10:00:00+01:00","duration_seconds":3600,"deviceid":"w1","model":93,"model_name":"ScanWatch","attrib":7,"attrib_name":"confirmed","modified":"2025-12-01T10:06:40+01:00","calories_kcal":310.5,"intensity":50,"hr_average_bpm":120,"hr_min_bpm":80,"hr_max_bpm":160,"hr_zone_0_light_seconds":600,"hr_zone_1_moderate_seconds":1500,"hr_zone_2_intense_seconds":1200,"hr_zone_3_maximal_seconds":300,"pause_duration_seconds":120,"spo2_average_percent":96,"pool_laps":40,"strokes":900,"pool_length_m":25,"pool_length_yd":27.34}],"count":1,"more":false,"offset":0,"window":{"end":"2025-12-01","start":"2025-11-30"},"units":"imperial"}
(Illustrative: real output of the binary talking to a local fake API, with made-up values.) category_name comes from the 159 workout categories Withings
documents; duration_seconds is end minus start.
Spot readings from a watch are measures:
wcli measures --types spo2,vo2_max,skin_temperature,afib_result,afib_ppg_result,qrs_interval,pr_interval,qt_interval,qtc_interval --latest
afib_result (type 130, from an ECG) carries its meaning. afib_ppg_result
(type 139, from the optical sensor) is a code whose values Withings does not
publish, so the record says so instead of pretending to be decoded:
{"time":"2025-12-01T09:00:00+01:00","type":139,"key":"afib_ppg_result","value":1,"unit":"code","note":"undocumented code: Withings publishes no value table for meastype 139 (atrial fibrillation from PPG), so the value is passed through as received and must not be read with the table of type 130","grpid":6003,"deviceid":"w1","category":1,"attrib":0,"attrib_name":"device","ambiguous":false,"model":"ScanWatch 2","model_id":94,"model_name":"ScanWatch 2","raw":{"value":1,"exponent":0}}
(Illustrative: real output of the binary talking to a local fake API, with made-up values.)
An ECG recording and its waveform:
wcli ecg --start 2025-12-01 --end 2025-12-01
{"recordings":[{"time":"2025-12-01T08:00:00Z","timestamp":1764576000,"deviceid":"bpm1","model":44,"model_name":"BPM Core","ecg":{"signalid":555,"afib":1,"afib_name":"positive","afib_details":11,"afib_details_name":"positive_normal_hr"},"bloodpressure":{"diastole_mmhg":80,"systole_mmhg":121},"heart_rate_bpm":78,"modified":"2025-12-01T08:01:40Z"},{"time":"2025-12-01T10:00:00Z","timestamp":1764583200,"deviceid":"w1","model":93,"model_name":"ScanWatch","ecg":{"signalid":558,"afib":0,"afib_name":"negative","afib_details":9,"afib_details_name":"negative_normal_hr"},"heart_rate_bpm":61}],"count":2,"more":false,"offset":0,"window":{"end":"2025-12-01T23:59:59Z","start":"2025-12-01T00:00:00Z"}}
wcli ecg-signal --signalid 558
{"signalid":558,"signal":[10,-20,30,-40,50,-60],"signal_unit":"µV","sample_count":6,"sampling_frequency_hz":300,"duration_seconds":0.02,"wearposition":1,"wearposition_name":"left_wrist","model":93,"model_name":"ScanWatch","heart_rate":{"grpid":4001,"value":66,"unit":"bpm","time":"2025-12-01T08:00:00Z","is_deleted":false}}
(Illustrative: real output of the binary talking to a local fake API, with made-up values.) A real signal holds about 10,000 samples.
Sleep sensors and sleep on a watch
wcli nights --start 2025-11-30 --end 2025-12-01 # one record per night
{"nights":[{"id":7001,"date":"2025-12-01","timezone":"Europe/Paris","start":"2025-12-01T00:00:00+01:00","end":"2025-12-01T08:00:00+01:00","model":32,"model_type":"sleep_monitor","model_id":63,"model_name":"Aura Sensor V2","hash_deviceid":"s1","completed":true,"created":"2025-12-01T08:10:00+01:00","modified":"2025-12-01T08:26:40+01:00","total_timeinbed_seconds":28800,"total_sleep_time_seconds":25200,"lightsleepduration_seconds":14400,"remsleepduration_seconds":5400,"deepsleepduration_seconds":5400,"sleep_efficiency":0.875,"sleep_latency_seconds":900,"wakeup_latency_seconds":300,"wakeupduration_seconds":2400,"wakeupcount":3,"waso_seconds":1200,"apnea_hypopnea_index":4,"hr_average_bpm":54,"hr_min_bpm":47,"hr_max_bpm":71,"rr_average_breaths_per_min":14,"snoring_seconds":1260,"sleep_score":82,"night_events":[{"time":"2025-12-01T00:00:00+01:00","event":1,"event_name":"got_in_bed","offset_seconds":0},{"time":"2025-12-01T00:15:00+01:00","event":2,"event_name":"fell_asleep","offset_seconds":900},{"time":"2025-12-01T07:30:00+01:00","event":3,"event_name":"woke_up","offset_seconds":27000},{"time":"2025-12-01T08:00:00+01:00","event":4,"event_name":"got_out_of_bed","offset_seconds":28800}]}],"count":1,"more":false,"offset":0,"window":{"end":"2025-12-01","start":"2025-11-30"},"units":"metric"}
(Illustrative: real output of the binary talking to a local fake API, with made-up values.) night_events arrives from Withings as offsets chained by event
type; here each event has its own time.
wcli sleep-stages --start 2025-11-30T22:00:00Z --end 2025-12-01T08:00:00Z # at most 24 hours per call
{"model":32,"model_type":"sleep_monitor","segments":[{"start":"2025-11-30T23:00:00Z","end":"2025-12-01T00:00:00Z","duration_seconds":3600,"state":1,"state_name":"light","model":"Aura Sensor V2","model_id":63,"model_name":"Aura Sensor V2","hr_bpm":[{"time":"2025-11-30T23:00:00Z","timestamp":1764543600,"value":58}]},{"start":"2025-12-01T00:00:00Z","end":"2025-12-01T00:30:00Z","duration_seconds":1800,"state":2,"state_name":"deep","model":"Aura Sensor V2","model_id":63,"model_name":"Aura Sensor V2","hr_bpm":[{"time":"2025-12-01T00:00:00Z","timestamp":1764547200,"value":52},{"time":"2025-12-01T00:10:00Z","timestamp":1764547800,"value":51},{"time":"2025-12-01T00:20:00Z","timestamp":1764548400,"value":50}],"rr_breaths_per_min":[{"time":"2025-12-01T00:00:00Z","timestamp":1764547200,"value":13}],"snoring_seconds":[{"time":"2025-12-01T00:00:00Z","timestamp":1764547200,"value":0}],"mvt_score":[{"time":"2025-12-01T00:00:00Z","timestamp":1764547200,"value":4}]}],"count":2,"window":{"end":"2025-12-01T08:00:00Z","start":"2025-11-30T22:00:00Z"}}
(Illustrative: real output of the binary talking to a local fake API, with made-up values.) Each per-minute or per-second map inside a segment (hr, rr,
snoring, sdnn_1, rmssd, mvt_score, ...) is a list sorted by time.
sleep get reports no timezone, so these times are UTC; nights has the
night's timezone.
Blood pressure monitors
wcli bp returns systolic, diastolic and pulse. BPM Core also records an ECG
(wcli ecg, where bloodpressure rides along) and heart sounds:
wcli stethoscope
{"recordings":[{"time":"2025-12-01T09:00:00+01:00","timestamp":1764576000,"timezone":"Europe/Paris","hash_deviceid":"b1","signalid":801,"vhd":0}],"count":1,"more":false,"offset":0,"window":{}}
wcli stethoscope-signal --signalid 801
{"signalid":801,"signal":[213,85,84,212],"signal_encoding":"G.711 A-law","sample_count":4,"frequency_hz":4000,"duration":20,"format":1,"size":80000,"resolution":8,"channel":1,"model":71,"model_name":"BeamO","position":18,"position_name":"cardiovascular_mitral_area","vhd":0}
(Illustrative: real output of the binary talking to a local fake API, with made-up values.) signal is G.711 A-law audio, not PCM. Withings documents no meaning
for vhd, format, size, resolution and channel and no unit for
duration; they are passed through as they are.
Thermo and BeamO
wcli measures --types temperature,body_temperature,skin_temperature --units imperial
wcli measures --types spo2,heart_pulse,afib_result --latest # BeamO
wcli ecg # BeamO
wcli stethoscope # BeamO
U-Scan
wcli measures --types urinary_ph,urine_specific_gravity,urinary_nitrites,urinary_ketones,urinary_vitamin_c,urinary_calcium,urinary_creatinine,urinary_calcium_creatinine_ratio
Devices
wcli devices
{"count":2,"devices":[{"battery":"high","deviceid":"a","hash_deviceid":"a","last_session_date":1764576000,"last_session_time":"2025-12-01T08:00:00Z","model":"Body Comp","model_id":18,"model_name":"Body Comp","timezone":"Europe/Paris","type":"Scale"},{"battery":"medium","deviceid":"b","hash_deviceid":"b","last_session_date":1764576000,"last_session_time":"2025-12-01T08:00:00Z","model":"Body Fit","model_id":4242,"timezone":"Europe/Paris","type":"Scale"}]}
(Illustrative: real output of the binary talking to a local fake API, with made-up values.) The second device is a model Withings has not documented: it keeps
its model and model_id and gains no model_name.
Raw endpoint commands
Every Withings service action is also a raw command, wcli <service> <action>, that prints Withings' body unchanged. Flag names are the vendor's
parameter names (--startdateymd, --data-fields, ...). Reach for one when
you need the untouched response, a --dry-run of the exact request, a
narrower --data-fields, or an endpoint that has no decoded command (the
notification, partner and OAuth endpoints).
wcli measure getactivity --pretty # daily steps, distance, calories (last 7 days)
wcli measure getworkouts --pretty # workout summaries (last 7 days)
wcli measure getintradayactivity --startdate 2026-11-30 --enddate 2026-11-30 # one day, minute level
wcli sleep getsummary --pretty # one summary per night (last 7 days)
wcli sleep get --startdate 2026-11-30T22:00:00Z # sleep stages, 24 hours from the start
wcli heart list --pretty # ECG recordings with AFib classification
wcli heart get --signalid 12345 # one ECG signal (id from heart list)
wcli measure getmeas --meastypes 1,6 --startdate 2026-11-01 --enddate 2026-11-30 # raw value/unit groups
wcli measure getactivity --pretty
{
"activities": [
{
"date": "2026-11-29",
"timezone": "Europe/Paris",
"deviceid": null,
"hash_deviceid": null,
"brand": 1,
"is_tracker": true,
"steps": 8421,
"distance": 6312.4,
"elevation": 9,
"soft": 5400,
"moderate": 1800,
"intense": 600,
"active": 2400,
"calories": 412.7,
"totalcalories": 2305.1,
"hr_average": 68,
"hr_min": 49,
"hr_max": 141,
"hr_zone_0": 70000,
"hr_zone_1": 2100,
"hr_zone_2": 500,
"hr_zone_3": 0,
"modified": 1796040000,
"model": "ScanWatch",
"modelid": 93
}
],
"more": false,
"offset": 0
}
(Illustrative values, as above.)
Running a service with no action lists its actions as JSON, for example
wcli measure. The services are measure, sleep, heart, stetho,
user, notify, oauth2 and signature, plus the
partner-only ones. docs/API-COVERAGE.md
maps all 63 endpoints to their command and MCP tool, and
docs/API-ENDPOINTS.md is the API reference this tool
was built from.
Dates and windows
- Any date flag accepts
YYYY-MM-DD, RFC 3339 or unix seconds. Withings wants epoch seconds on some endpoints (startdate,enddate,lastupdate) andYYYY-MM-DDon others (startdateymd,enddateymd); the CLI converts. A plain date is local midnight, or 23:59:59 for an end date, so--startdate 2026-11-30 --enddate 2026-11-30is that whole day. - Default windows.
measures,weight,body,bp,weighins: the last 30 days.activity,workouts,nightsand the rawmeasure getactivity,measure getworkouts,sleep getsummary: the last 7 days.sleep-stagesandsleep get: the last 24 hours, or 24 hours from the start.intraday,ecg,stethoscopeand the rawmeasure getmeas,heart list,stetho listandmeasure getintradayactivitysend no dates unless you pass them. - 24-hour limit.
sleep getandmeasure getintradayactivity(and sosleep-stagesandintraday) return at most 24 hours per call, and Withings silently drops the rest. The CLI refuses a longer window with awindow_too_largeusage error; pass--allto fetch the whole window in 24-hour chunks. lastupdateinstead of a window.--lastupdate(--last-updateon the decoded commands) returns everything created or modified since that time. It cannot be combined with a start/end window.data_fieldsdefault. For activity, workouts and sleep, Withings returns almost nothing unlessdata_fieldsnames the metrics. When you omit--data-fieldsthe CLI sends every documented field; pass it to narrow the response. Unknown names are rejected client-side with the valid list.
Pagination and --all
Withings pages with more and offset in the response body. more is an
integer (0/1) on measure getmeas and a boolean elsewhere; treat it as
truthy.
By hand: when more is truthy, repeat the same call with --offset set
to the returned offset.
wcli weight --start 2026-11-01
wcli weight --start 2026-11-01 --offset 2
--all: follow every page and stream NDJSON, one record per line, ending
with exactly one summary line.
wcli bp --all
{"time":"2026-11-30T12:00:00+01:00","type":10,"key":"systolic_bp","value":118,"unit":"mmHg","grpid":1004,"deviceid":"f0e1d2c3b4a5968778695a4b3c2d1e0f","category":1,"attrib":0,"attrib_name":"device","ambiguous":false,"model":"BPM Connect","raw":{"value":118,"exponent":0}}
{"time":"2026-11-30T12:00:00+01:00","type":9,"key":"diastolic_bp","value":76,"unit":"mmHg","grpid":1004,"deviceid":"f0e1d2c3b4a5968778695a4b3c2d1e0f","category":1,"attrib":0,"attrib_name":"device","ambiguous":false,"model":"BPM Connect","raw":{"value":76,"exponent":0}}
{"time":"2026-11-30T12:00:00+01:00","type":11,"key":"heart_pulse","value":61,"unit":"bpm","grpid":1004,"deviceid":"f0e1d2c3b4a5968778695a4b3c2d1e0f","category":1,"attrib":0,"attrib_name":"device","ambiguous":false,"model":"BPM Connect","raw":{"value":61,"exponent":0}}
{"command":"bp","count":3,"ok":true,"requests":2,"type":"summary"}
(Illustrative values.) The summary line is how a consumer tells "pagination
finished" from "the process died mid-stream". On raw commands --all streams
the records of the endpoint's list (measuregrps, activities, series,
...). --all exists on every command whose stdout in wcli schema is
json|ndjson(--all). requests is the number of API calls made, including
one that failed.
If a later page fails, the stream still ends with one summary line carrying
"ok":false and the error, and the exit code is the error's:
{"command":"weight","count":2,"error":{"kind":"api","code":5,"reason":"not_implemented","message":"measure getmeas: Withings status 2554 (not implemented): Not implemented","hint":"Withings does not know this service/action for your application; check WITHINGS_API_BASE if it is set","status":2554},"ok":false,"requests":2,"type":"summary"}
A failure before the first page prints the ordinary error envelope instead.
Ctrl-C (or SIGTERM) does not cut the stream off: the request in flight is
canceled, the stream still ends with its summary line ("ok":false with a
network/canceled error) and the exit code is 6. Without --all, an
interrupted command prints the network/canceled envelope and exits 6.
Mutating commands and --dry-run
Commands that change state at Withings are marked [mutating] in their help
and "mutating": true in wcli schema. For an ordinary app those are
notify subscribe, notify update, notify revoke, oauth2 revoke and
oauth2 requesttoken. They are sent once and never retried.
Every raw <service> <action> command takes --dry-run, which validates the
flags, prints the exact request with secrets redacted and sends nothing. Run
it before any mutating command:
wcli notify subscribe --callbackurl https://example.com/hook --appli 1 --dry-run --pretty
{
"dry_run": true,
"sent": false,
"endpoint": "notify subscribe",
"mutating": true,
"auth": "bearer",
"method": "POST",
"url": "https://wbsapi.withings.net/notify",
"headers": {
"Authorization": "Bearer <redacted>",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "withings-cli/0.3.2"
},
"params": {
"action": "subscribe",
"appli": "1",
"callbackurl": "https://example.com/hook"
}
}
--dry-run needs no credentials. The decoded commands (weight, body, ...)
are read-only and have no --dry-run.
Six raw commands print credentials on stdout, because that is what their
endpoints return: oauth2 requesttoken and oauth2 getdemoaccess (tokens),
oauth2 createclient (a client secret) and oauth2 recoverauthorizationcode,
user activate and dropshipment createuserorder (an authorization code).
They are tagged [prints secrets] in help and "returns_secrets": true in
the schema; see Security model.
Errors and exit codes
Every failure prints one JSON object on stdout and nothing else there; a human-readable copy goes to stderr.
{"error":{"kind":"usage","code":3,"reason":"bad_date","message":"invalid --start \"bogus\": not a date or time","hint":"use YYYY-MM-DD, RFC 3339 (2026-11-30T08:00:00Z) or unix seconds"}}
When Withings itself refused the call, status carries its status number:
{"error":{"kind":"ratelimit","code":7,"reason":"rate_limited","message":"measure getmeas: Withings status 601 (too many requests): Too Many Requests","hint":"Withings allows 120 requests/minute per application on the free plan and sends no Retry-After: wait 60 seconds, then retry with exponential backoff","status":601}}
kind and the process exit code always agree:
| code | kind | meaning | what to do |
|---|---|---|---|
| 0 | ok | success | continue |
| 1 | internal | internal error (bug) | report it |
| 2 | auth | missing/invalid/expired credentials (Withings status 100-102, 200, 401) | run wcli auth login; do not loop |
| 3 | usage | bad flags, values or dates, caught client-side or reported by Withings as invalid params | fix the invocation via wcli schema |
| 4 | config | config or keyring problem | run wcli doctor |
| 5 | api | Withings failed or refused the request for another reason (not implemented, bad state, generic error) | inspect .error.reason and .error.status |
| 6 | network | network failure or timeout reaching Withings (including status 522) | retry with backoff |
| 7 | ratelimit | rate limited (Withings status 601; 120 requests/minute per app on the free plan) | wait 60 seconds, then retry with backoff |
| 8 | forbidden | not entitled: missing OAuth scope, API plan, or partner contract (Withings status 214, 277, 2553, 2555) | do not retry; re-authorize with the needed scopes or tell the user |
The same table is in wcli schema under exit_code_docs. Read-only calls
are retried up to three times on transport errors and status 522 before the
error is reported; a stored token that Withings rejects is refreshed once and
the call repeated.
Agent integration
AGENTS.md is the operating manual for a model driving this CLI. The short version:
wcli schema --summary # compact index: path, short, audience, mutating, stdout
wcli schema weight # one command in full
wcli schema measure getactivity
wcli schema # everything (about 180 KB)
A scoped schema entry lists each flag with its type, default, required,
enum and enum_descriptions, plus the command's stdout shape,
exit_codes, audience, mutating, deprecated, returns_secrets,
mcp_tool (the command's own MCP tool: withings_weight for weight),
auth, scopes and the underlying endpoint. The top level adds
global_flags, exit_code_docs and env.
Global flags: --pretty, --timeout (seconds, default 30, 0 for none; a
negative value is a usage error), --config (config directory) and --token
(access token override; prefer WITHINGS_TOKEN).
--help, -h and wcli help [command] keep the stdout contract: the
help text goes to stderr and stdout gets one JSON document pointing at the
schema entry for the same command.
wcli measure getactivity --help 2>/dev/null
{"command":"wcli measure getactivity","help":"the help text was printed to stderr; the machine-readable description of this command is the schema","schema":"wcli schema measure getactivity","short":"Daily activity aggregates (steps, distance, calories, heart-rate zones)","usage":"wcli measure getactivity [flags]"}
JSON output is never HTML-escaped, so URLs such as the one from
wcli auth login --print-url contain a literal &.
MCP
wcli mcp serve runs a Model Context Protocol server on stdio, built with
the official Go MCP SDK. It
uses the credentials stored by wcli auth login, so log in first. It is
listed in the official MCP Registry
as io.github.withingscli/wcli, and each release carries an MCP bundle
(wcli_X.Y.Z.mcpb) for clients that install bundles; see
docs/MCP.md.
Claude Code:
claude mcp add withings -- wcli mcp serve
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"withings": {
"command": "wcli",
"args": ["mcp", "serve"]
}
}
}
Any other stdio MCP client: run the command wcli with the arguments
mcp serve. stdout belongs to the protocol; progress goes to stderr. If the
client does not inherit your PATH, give the absolute path of the binary.
By default the server exposes only public, read-only tools. Two flags widen it:
| Flags | Tools | What is added |
|---|---|---|
| (none) | 35 | the 17 decoded tools, withings_auth_status, withings_version and the 16 public read-only endpoints |
--allow-write | 39 | the 4 public mutating endpoints (notify subscribe/update/revoke, oauth2 revoke) |
--partner | 50 | the 15 partner read-only endpoints |
--allow-write --partner | 76 | also the 22 partner mutating endpoints |
Tokens never reach the model: the six endpoints whose response contains
tokens, a client secret or an authorization code (oauth2 requesttoken,
oauth2 getdemoaccess, oauth2 createclient,
oauth2 recoverauthorizationcode, user activate,
dropshipment createuserorder) are not MCP tools under any flag combination.
Every endpoint tool takes dry_run, and a tool rejects any argument its
schema does not declare.
claude mcp add withings-rw -- wcli mcp serve --allow-write
{
"mcpServers": {
"withings": {
"command": "wcli",
"args": ["mcp", "serve", "--allow-write", "--partner"]
}
}
}
Tools are named withings_<service>_<action> (withings_measure_getactivity)
or after the decoded command (withings_weight, withings_sleep_stages for
wcli sleep-stages). A tool result is Withings'
body as JSON text; a failure is the same error envelope the CLI prints, with
isError set. There is no --all over MCP: page with offset.
docs/MCP.md has the full tool list and argument reference.
Partner-only endpoints
41 of the 63 endpoints are marked [partner]: the dropshipment,
order, device, rawdata, survey, answers, nudge and nudgecampaign
services, five user actions (activate, addtorpm, get, link,
unlink), three oauth2 actions (createclient, listusers,
recoverauthorizationcode) and measure confirmuser. They exist for companies with a Withings contract (a
partner or enterprise plan, remote patient monitoring, cellular devices,
research). An app created in the self-serve dashboard is rejected by them, and
the CLI reports that as a forbidden error (exit 8) whose hint says a partner
plan is needed.
They are implemented so the tool covers the whole API, but they could not be
tested against a real partner account. Most are signed with the application's
client ID and secret (a nonce plus an HMAC) rather than a user token; the CLI
does the signing with the credentials stored by auth login or
WITHINGS_CLIENT_ID/WITHINGS_CLIENT_SECRET. Contracted US-cloud partners
can point the CLI at their host with WITHINGS_API_BASE.
In wcli schema they carry "audience": "partner". Over MCP they are
hidden unless the server runs with --partner.
Plans, limits and missing data
These are Withings' rules, summarized from docs/API-ENDPOINTS.md; they can change.
- Rate limit. The free plan allows 120 requests per minute across the
whole application. Beyond it Withings answers status 601 with no
Retry-After; the CLI reportsratelimit(exit 7) and does not retry. Withings' guidance is not to poll a user more often than every 10 minutes; use--lastupdatefor incremental sync. - 10 users. A free app is limited to 10 users until Withings reviews it, and an app with an HTTP, localhost or non-standard-port callback URL stays in restricted mode at 10 users.
- Withings+. Per Withings' plans page, accounts created after October 12, 2026 need an active Withings+ membership to share data with a free-plan app.
- Advanced biomarkers. The free plan covers the core data: activity,
sleep, body and heart. ECG intervals, AFib results, pulse wave velocity,
vascular age, VO2 max, skin temperature, visceral fat, segmental body
composition, extra/intracellular water, nerve health scores and basal
metabolic rate need Withings' Advanced Biomarkers plan. On the free plan
those measure types are simply absent from the response, with no error.
So
wcli bodymay return fewer types than it lists, and an empty result does not mean your device never measured it. - Token lifetime. Access tokens last 3 hours; the CLI refreshes them and stores the rotated refresh token each time.
Security model
- Where credentials live.
auth loginstores the access token, refresh token, client ID and client secret in the OS keyring: macOS Keychain, Windows Credential Manager, or libsecret/Secret Service on Linux. - Encrypted-file fallback. Where no keyring is reachable (headless Linux,
containers, CI) they go to
credentials.encin the config directory, encrypted with AES-256-GCM under a random key stored beside it incredentials.key(mode 0600). This is obfuscation at rest, not a substitute for a keyring: anyone who can read both files can read the credentials.auth statusanddoctorreport which backend is active ("keyring"or"encrypted-file").WITHINGS_KEYRING_BACKEND=fileforces the file. - Config directory. The platform config directory plus
withings(for example~/Library/Application Support/withingson macOS,~/.config/withingson Linux). Override it with--configorWITHINGS_CONFIG_DIR. - Environment variables.
WITHINGS_TOKENis used as-is in place of the stored credentials and is never refreshed (it dies within 3 hours).WITHINGS_CLIENT_IDandWITHINGS_CLIENT_SECRETsupply the app credentials without putting them in argv. Environment variables are visible to the process and its children; prefer the keyring on a shared machine. - Nothing sensitive on stdout.
auth login,auth status,auth refreshandwhoaminever print a token.--dry-runredacts the bearer token, the signature and secret parameters. stderr is stripped of ANSI, bidi and zero-width characters. - Exception: six raw endpoints return credentials.
oauth2 requesttokenandoauth2 getdemoaccessprint access and refresh tokens,oauth2 createclienta client secret, andoauth2 recoverauthorizationcode,user activateanddropshipment createuserorderan authorization code, because that is what those endpoints answer. Their help says so ([prints secrets]and a warning),wcli schemamarks them"returns_secrets": true, and--dry-runon them prints nothing secret. Usewcli auth logininstead unless you want exactly that output. - Tokens never reach a model's context over MCP. Those six endpoints are
not MCP tools under any flag combination,
--allow-write --partnerincluded. The rule is an attribute in the endpoint registry and is enforced by a test. - Requests go only to
wbsapi.withings.netand, in your browser,account.withings.com, unless you override them withWITHINGS_API_BASE/WITHINGS_AUTHORIZE_URL. Redirects are never followed. There is no telemetry.
Report vulnerabilities privately; see SECURITY.md.
Environment variables
| Variable | Purpose |
|---|---|
WITHINGS_TOKEN | access token used as-is instead of stored credentials (never refreshed; tokens last 3 hours) |
WITHINGS_CLIENT_ID | OAuth client id, for auth login and signed endpoints |
WITHINGS_CLIENT_SECRET | OAuth client secret, for auth login and signed endpoints |
WITHINGS_CONFIG_DIR | config directory holding stored credentials (same as --config) |
WITHINGS_KEYRING_BACKEND | set to file to force the encrypted-file credential store instead of the OS keyring |
WITHINGS_API_BASE | endpoint override: API base URL (default https://wbsapi.withings.net) for every call, including login, refresh and revoke |
WITHINGS_AUTHORIZE_URL | endpoint override: browser consent URL (default https://account.withings.com/oauth2_user/authorize2) |
The last two are endpoint overrides, useful for testing against a local fake
server (the examples in this README were produced that way); contracted
US-cloud partners can also point WITHINGS_API_BASE at their host. Leave them
unset otherwise. They receive your tokens and client secret, so each must be
an https:// URL; plain http:// is accepted for localhost only. Anything
else makes every command fail with a config error (bad_endpoint_override,
exit 4) before a request is sent.
Documentation
- AGENTS.md: operating manual for an LLM driving the CLI
- docs/MCP.md: MCP tools, arguments and errors
- docs/API-COVERAGE.md: every Withings endpoint and where it lives in the CLI and MCP server
- docs/API-ENDPOINTS.md: the Withings API reference this tool was built from
- docs/DEVICE-READINGS.md: what each device records and which command returns it
- docs/DESIGN.md: how the tool is built
- CHANGELOG.md, CONTRIBUTING.md, SECURITY.md
License
Apache-2.0. See LICENSE.
This project is unofficial. It is not affiliated with, endorsed by, or sponsored by Withings, and it is not a medical device.
https://github.com/withingscli/withings/releases/download/v0.3.2/wcli_0.3.2.mcpb# mcpb: https://github.com/withingscli/withings/releases/download/v0.3.2/wcli_0.3.2.mcpb