Sending measurements
This API brings body measurements from any scale, app or automation into training mcp. Where they come from doesn't matter, the format does. Your language model then reads the values through the body-metrics tool.
POST https://api.training-mcp.app/api/ingest/v1/bodyCreating a token
You need a separate API token. It may only send measurements to /api/ingest. It can't read anything and can't reach other routes. An MCP token or the app's token won't work here.
- Open ‘Connections’ in your account.
- Under ‘Own measurements’, click ‘Generate API token’ and give it a name, such as that of the scale or the automation.
- Copy the token. It is shown in plain text only once. If you lose it, revoke it and create a new one.
One token per device or automation has an advantage: if one gets into the wrong hands, you only revoke that one.
Request
A POST with JSON in the body. The token goes in the Authorization header, preceded by ‘Bearer ’. One call may contain up to 100 measurements.
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
Accept: application/json{
"measurements": [
{
"measured_at": "2026-10-05T07:12:00+02:00",
"device": "Tanita RD-545",
"context": "morning_fasted",
"weight_kg": 96.05,
"body_fat_pct": 30.1,
"muscle_mass_kg": 63.4,
"body_water_pct": 50.2,
"bone_mass_kg": 3.3,
"visceral_fat": 14,
"bmr_kcal": 2034,
"metabolic_age": 52,
"segments": {
"trunk": { "fat_pct": 34.6, "muscle_mass_kg": 33.1 },
"left_leg": { "fat_pct": 24.0, "muscle_mass_kg": 10.9 }
}
}
]
}Fields of a measurement
Only measured_at is required, plus at least one value. The unit is part of the field name. The server rejects unknown fields instead of quietly ignoring them, so a typo shows up straight away and not weeks later.
| Field | Type | Range | Meaning |
|---|---|---|---|
| measured_at | string | ISO 8601 | Time of the measurement, ISO 8601 with time zone, for example 2026-10-05T07:12:00+02:00. A measurement without a time zone is rejected. |
| device | string | ≤ 120 | Scale or app as free text, at most 120 characters. Shown next to the value later. |
| context | string | morning_fasted, morning_other, midday, evening, post_exercise, unknown | Condition of the measurement. Only measurements taken under the same condition are comparable; the trend rests on the fasted morning measurements (morning_fasted). If omitted, the condition stays open. |
| external_id | string | ≤ 120 | Your own ID for the measurement, at most 120 characters. Sending the same ID again updates the same measurement. |
| weight_kg | number | 20 – 400 | Body weight in kilograms. |
| body_fat_pct | number | 1 – 75 | Body fat as a percentage of weight. |
| muscle_mass_kg | number | 5 – 200 | Muscle mass in kilograms. |
| body_water_pct | number | 20 – 85 | Body water as a percentage of weight. |
| bone_mass_kg | number | 0.5 – 10 | Bone mass in kilograms. |
| visceral_fat | number | 1 – 59 | Visceral fat as the scale's rating, without a unit. |
| bmr_kcal | integer | 500 – 5000 | Basal metabolic rate in kilocalories per day, whole number. |
| metabolic_age | integer | 10 – 120 | Metabolic age in years, whole number. |
| bmi | number | 10 – 80 | Body mass index as the scale reports it. |
| segments | object | Values per body part, see below. |
Segments
Scales with segmental measurement report values per body part. Allowed are trunk, left_arm, right_arm, left_leg and right_leg, each with fat_pct (1 to 75) and muscle_mass_kg (0.1 to 80). A missing part stays empty.
Response
The server checks each measurement on its own. One faulty measurement doesn't fail the whole batch: you get a status per measurement in the order you sent them, plus a summary.
- received
- newly accepted
- updated
- same measurement with changed values, updated
- known
- already stored exactly like this, nothing changed
- rejected
- rejected, the reason is in reason
{
"results": [
{ "index": 0, "status": "received", "measured_at": "2026-10-05T05:12:00Z" },
{ "index": 1, "status": "rejected", "reason": "weight_kg is 960, outside 20 to 400." }
],
"summary": { "received": 1, "rejected": 1 }
}HTTP status
- 200
- The batch was processed. Whether individual measurements were rejected is in results.
- 401
- No token, or the token has been revoked.
- 403
- The token isn't valid for this route, or consent to processing health data has been withdrawn (code consent_revoked).
- 422
- measurements is missing, empty or has more than 100 entries.
- 429
- More than 120 calls per minute. Wait for the time given in Retry-After.
Rules
- Repeatable: sending the same measurement twice leaves one record. It is recognised by external_id, or without an ID by time and device. You can safely resend the whole day after every run of your automation.
- Updates add up: a changed measurement overwrites the values you send. Values you leave out this time stay as they are.
- Time with zone: measured_at needs a time zone. The server rejects measurements more than ten minutes in the future, which almost always means a clock is set wrong.
- Limits: at most 100 measurements per call and 120 calls per minute. Numbers are rounded to two decimal places.
- Write only: nothing comes back through this API. The values are read over MCP (body-metrics) with the source ‘ingest’ and the device from device.
Examples
curl -X POST https://api.training-mcp.app/api/ingest/v1/body \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"measurements":[{"measured_at":"2026-10-05T07:12:00+02:00","device":"Tanita RD-545","weight_kg":96.05,"body_fat_pct":30.1}]}'Shortcut on the iPhone
For a scale whose app only offers text to share, or for values you enter by hand:
- Create a new shortcut, switch on ‘Show in Share Sheet’ if needed, input: Text.
- Use ‘Match Text’ to pull out the numbers, for example with the pattern Weight: ([0-9,.]+) for the weight. If the number has a decimal comma, swap it for a point with ‘Replace Text’.
- Create a ‘Dictionary’ with the fields measured_at (Current Date in ISO 8601 format), device and weight_kg, as a number, not as text. Then a second dictionary with the key measurements and a list containing the first one.
- ‘Get Contents of URL’: the address above, method POST, header Authorization with ‘Bearer ’ and your token, header Accept application/json, request body JSON with the dictionary.
- To check, output the response with ‘Show Result’. If it says received or known, the measurement has arrived.
Home Assistant
With a rest_command, triggered by an automation as soon as the scale's sensor reports a new value. The token, preceded by ‘Bearer ’, goes into secrets.yaml.
# configuration.yaml
rest_command:
training_mcp_body:
url: https://api.training-mcp.app/api/ingest/v1/body
method: POST
headers:
Authorization: !secret training_mcp_token # "Bearer YOUR_TOKEN"
Accept: application/json
content_type: application/json
payload: >
{"measurements":[{
"measured_at": "{{ now().isoformat() }}",
"device": "Withings Body+",
"weight_kg": {{ states('sensor.scale_weight') | float }},
"body_fat_pct": {{ states('sensor.scale_fat') | float }}
}]}
# automations.yaml
- alias: Scale to training mcp
trigger:
- platform: state
entity_id: sensor.scale_weight
action:
- service: rest_command.training_mcp_bodyPython
import requests
r = requests.post(
"https://api.training-mcp.app/api/ingest/v1/body",
headers={"Authorization": "Bearer YOUR_TOKEN", "Accept": "application/json"},
json={"measurements": [{
"measured_at": "2026-10-05T07:12:00+02:00",
"device": "Tanita RD-545",
"weight_kg": 96.05,
"body_fat_pct": 30.1,
}]},
timeout=10,
)
r.raise_for_status()
print(r.json()["summary"])Machine-readable
The API describes itself as OpenAPI 3.1. If you have someone build an integration, a language model included, hand over this file.
https://api.training-mcp.app/api/ingest/v1/openapi.jsonPrivacy
Body measurements are health data. They are stored on servers in Germany and only go to the language model you connect yourself. If you withdraw consent to processing health data, the API stops accepting anything. If you delete your account, these values are gone as well.
Privacy policy