Measurements
Creating measures, sending recorded video or images, and reading the result back.
A measurement goes through three states: created, started, then ended. You can drive it in one call, or in two.
The routes
| Method | Path | What it does |
|---|---|---|
POST | /measures | Create a measure without running it |
GET | /measures | List your measures |
GET | /measures/rppg, /measures/cppg | List only your measures run from a camera (rppg) or from a contact sensor (cppg) |
GET | /measures/{measureId} | Read one measure |
GET | /measures/{measureId}/rppg, /measures/{measureId}/cppg | Read one ended measure, only if it is of that kind; otherwise 404 |
DELETE | /measures/{measureId} | Delete a measure and its media |
POST | /measures/rppg/video | Create and run, from a video file |
POST | /measures/rppg/images | Create and run, from image files |
POST | /measures/rppg/captures | Create and run, from raw captures you cropped yourself |
POST | /measures/rppg/signal, /measures/cppg/signal | Create and run, from a signal already extracted |
POST | /measures/{measureId}/rppg/video, …/rppg/images, …/rppg/captures, …/rppg/signal, …/cppg/signal | Run an existing measure, from the same sources |
GET | /external-users/{externalId} | Whether a person you identify by externalId has measurements, and a blood-pressure calibration |
The create-and-run routes are the ones to reach for. They answer 201 Created; running an existing measure answers 200 OK. Both return the measurement. The two-step form exists for when you need the identifier before you have the file — that is how the v1 widget works: your server creates the measure, and the widget runs it. A measure runs once: running one that has already started is refused with 400.
POST /measures takes the fields below as a JSON body (Content-Type: application/json; the body may be empty); the create-and-run routes take them as multipart parts. The routes that run an existing measure take the media alone: the person’s data, tags, the variables and computeOptions are those given when the measure was created.
If the response is lost
These routes hold the connection for the whole computation — from a few seconds to some twenty, and longer when the platform is busy. If the connection drops while you wait for the response, the measurement still runs to its end and is charged as usual. Sending the file again would make a second measurement, charged a second time: look for the first before doing so.
Two ways to find it again:
- Create it first.
POST /measures, then run it withPOST /measures/{measureId}/rppg/video, or the route for the source you send (see the table above). You hold the identifier before the computation starts, andGET /measures/{measureId}tells where it stands:created(the execution never began: send it again),started(the computation is running) orended(the result is there). Running it again once it has started is refused with400. - Label it. Put a unique label in
tags, and find the measure withGET /measures?filters={"operator":"contains","name":"tags","values":["<label>"]}— see filtering by tag.
A create-and-run call refused after the measure was created — a rate limit, for instance — leaves that measure created: it stays in your list, and a label in tags finds it again.
This page details the video and images routes. The bodies of the captures and signal routes are in the OpenAPI reference.
The captures routes (POST /measures/rppg/captures, POST /measures/{measureId}/rppg/captures) and the rPPG signal routes (POST /measures/rppg/signal, POST /measures/{measureId}/rppg/signal) receive the captures with their timestamps, times, and judge them as a measurement made in the widget would be judged: a collection lasts about thirty seconds.
timesholds one instant per capture, in milliseconds, in ascending order — two equal instants are accepted, an instant smaller than the one before it is not. In a multipart body, send one part per instant, or one part holding them separated by commas (0,33,66): an empty element (0,,33) is refused, and a comma is never a decimal mark.- The first instant is
0, and the last lies between29000and31000. A single capture is therefore never valid. - A request carries at most 960 captures.
Any other body is refused with 400, and the error names times or captures; nothing is measured. The signal routes are the one exception: they also accept a request with no capture and no instant (times and captures left out or empty), and physicalAge, which reads three captures, then comes back with MISSING_CAPTURES.
Describing the person
Several variables cannot be computed from the signal alone. userData is where you say what is needed.
| Field | Type | Bounds |
|---|---|---|
externalId | string | From 1 to 300 characters. Your own identifier for the person. Leave it out for a person you do not identify: an empty string is refused. |
sex | "M" | "F" | |
age | integer | 18 to 110 |
dateOfBirth | date string | An ISO 8601 date (1990-05-17), instead of age; the age it gives today stays within the same bounds. If both are sent, age is used and dateOfBirth is ignored |
weight | integer | 20 to 200, in kilograms |
height | integer | 100 to 250, in centimetres |
smokingStatus | "smoker" | "non-smoker" |
Every field is optional. What you omit simply narrows what can be computed:
| Variable | Needs |
|---|---|
hr, br, hrv, strs, physicalAge, faceBmi | Nothing — read from the face (physicalAge stays within three years of the person’s age when you supply it) |
bmi | weight and height |
bpClass | weight, height, age and sex |
healthScore | weight, height, age, sex and smokingStatus |
bp | externalId, and a calibration for that person |
bp is calibrated per person. It needs an externalId, and an earlier measurement of that same person that ended with a qualityScore of 100 and for which a reference blood pressure was entered — only the end-of-measurement form of the v1 widget records one today. Without it, bp comes back with NOT_CALIBRATED. GET /external-users/{externalId} answers { "externalId", "rppgCalibrated", "cppgCalibrated" }, or 404 when none of your measurements carries that identifier.
A missing field is not a failed measurement
Variables that could not be computed come back with an error code, usually one naming exactly what was missing, while the rest of the measurement finishes normally. You do not lose the heart rate because you did not know the person’s height.Choosing variables
Two optional arrays narrow what is computed:
{
"desiredVariables": ["hr", "br"],
"unwantedVariables": ["faceBmi"]
}
Omit both and the measurement computes everything your account is entitled to.
These narrow; they do not grant
Asking for a variable your account is not entitled to does not enable it. What your account may receive is set on the account. These fields can only narrow it further, never widen it.Two more optional fields sit beside them. tags is a list of your own labels — at most 10, each from 1 to 300 characters, with no null character — returned with the measure and usable to filter the list. More than ten, an empty label or a longer one is refused with 400, and the error names tags. A measure created before this bound keeps the labels it has, even above ten, and stays readable. computeOptions adjusts how a variable is expressed: { "bpClass": { "scale": 2 } } returns bpClass on two levels — normal, or not — instead of three. scale is 2 or 3 (three by default, unless your account is set to another); any other value is refused.
Each array holds at least one name from the table above; an empty array or an unknown name is refused with 400, and tags cannot be empty either — leave a field out rather than sending it empty or as null. A field the API does not know is ignored, not refused: a misspelt name is simply lost. In a multipart list, blanks belong to the value: write hr,br, not hr, br.
Sending a recorded video
POST /measures/rppg/video
Authorization: Bearer <apiKey>
Content-Type: multipart/form-data
| Part | Notes |
|---|---|
video | Up to 100 MB. video/mp4, video/webm, video/x-msvideo, video/vnd.avi, video/quicktime, video/mov |
userData[…] | Named parts, one per field — or a single userData part of serialised JSON |
desiredVariables, unwantedVariables | Comma-separated, or one part per value |
tags | Comma-separated, or one part per value — at most 10, each from 1 to 300 characters |
computeOptions | The object, serialised as JSON |
userData: named parts, or one JSON part
Write userData[weight], userData[height], userData[age] — each as its own multipart field. In a named part, a number is written with digits only and, for a decimal mark, a point — no comma, no unit: userData[weight]=75,5 and userData[weight]=75kg are refused with 400 (age, weight and height are integers, so 75.5 is refused too).
You can also send a single userData part holding the object serialised as JSON, for example {"sex":"M","weight":75,"height":180}. A value outside its bounds, or a part that is not valid JSON, is refused with 400, and nothing is measured. userData is one object: an array, a string that is not JSON or null is refused with 400.
The call below goes to Production. Send it to Test while you are still checking your pipeline: measurements made there never appear in your Production data.
| Environment | API base |
|---|---|
| Production | https://api.saphere.ai |
| Test | https://api.test.saphere.ai |
curl -sX POST https://api.saphere.ai/measures/rppg/video \
-H "Authorization: Bearer $SAPHERE_API_KEY" \
-F "video=@./capture.mp4;type=video/mp4" \
-F "userData[sex]=F" \
-F "userData[age]=35" \
-F "userData[weight]=58" \
-F "userData[height]=171" \
-F "userData[smokingStatus]=non-smoker" \
-F "tags=cohort-a,pilot"
The response, 201 Created, is the completed measurement — the same shape the widget delivers.
The same measurement in two steps: create it with a JSON body, then run it with the video alone.
# Create the measure: the person's data goes in a JSON body
curl -sX POST https://api.saphere.ai/measures \
-H "Authorization: Bearer $SAPHERE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "userData": { "sex": "F", "age": 35, "weight": 58, "height": 171, "smokingStatus": "non-smoker" }, "tags": ["cohort-a", "pilot"] }'
# Run it with the video alone: MEASURE_ID is the id returned by the call above
curl -sX POST https://api.saphere.ai/measures/$MEASURE_ID/rppg/video \
-H "Authorization: Bearer $SAPHERE_API_KEY" \
-F "video=@./capture.mp4;type=video/mp4"
Sending images
POST /measures/rppg/images
| Part | Notes |
|---|---|
images | At most 3 files. Each between 4 KB and 30 MB. image/jpeg, image/jpg, image/png, image/bmp, image/x-ms-bmp, image/webp, image/heic |
The other parts are those of the video route.
Images and video do not compute the same variables
A still image carries no pulse. From images, only faceBmi is computed — plus bmi, which needs only weight and height. Every variable read from the pulse comes back with MISSING_CAPTURES, and signal is null. The three that also need userData — bp, bpClass and healthScore — check it first: when a field they need is missing, they come back with the matching MISSING_USER_DATA… code instead.
The reverse holds for a video: it yields every variable except faceBmi, which reads still images and comes back with MISSING_IMAGE.
The captures routes can carry images too (up to three, under the same bounds): then faceBmi is computed alongside the variables read from the pulse.
Reading a measurement back
GET /measures/{measureId}
Authorization: Bearer <apiKey>
Measures belonging to another client return 404, exactly as a non-existent one does.
Listing your measurements
GET /measures
Authorization: Bearer <apiKey>
You only ever see your own. Another client’s measurements are not refused, they are simply absent.
| Parameter | Notes |
|---|---|
take | 1 to 1000. Defaults to 100. |
skip | 0 or more. Defaults to 0. |
filters | Restricts what is returned. See below. |
The list is sorted by creation date, oldest first, so pages follow one another without overlapping or skipping a measurement; one created while you go through it joins the end. filters applies to all three lists — GET /measures, GET /measures/rppg and GET /measures/cppg — with the same syntax.
Filtering by tag
A filter is a condition — a field, an operator, and the values to compare it to:
{ "operator": "contains", "name": "tags", "values": ["cohort-a"] }
It travels as one query parameter, written either serialised or spread — both are accepted, and mean the same thing:
GET /measures?filters={"operator":"contains","name":"tags","values":["cohort-a"]}
GET /measures?filters[operator]=contains&filters[name]=tags&filters[values][0]=cohort-a
In a real URL the serialised form is percent-encoded like any query value; curl -G --data-urlencode 'filters={…}' does it for you.
tags holds several values, so a condition compares a list to a list. That is what the three operators are for. In the table, values is ["cohort-a", "pilot"] and each example is the list of tags a measurement carries:
| Operator | Keeps a measurement when its tags… | A measurement tagged… is kept |
|---|---|---|
contains | carry every value you list | ["cohort-a", "pilot"], ["cohort-a", "pilot", "other"] |
overlaps | carry at least one of them | ["cohort-a"], ["pilot", "other"] |
contained-by | carry no tag outside the ones you list | ["cohort-a"], ["pilot"], [] |
| Field | Accepted values |
|---|---|
operator | contains, overlaps, contained-by |
name | tags |
values | One or more tags |
Combining conditions
To combine conditions, wrap them in and:
{ "operator": "and", "operands": [{ "operator": "contains", "name": "tags", "values": ["cohort-a"] }] }
Only tags can be filtered today, and a field is named once, so an and carries exactly one condition: a single condition needs no wrapper, and an and with more than one operand is refused with 400.
Name a field once, and list every value
A field may appear in only one condition: two conditions ontags are refused with 400. This is not a limitation to work around — ask for several tags by listing them in values, which is what the operators above compare against.What is filterable is a closed list
name accepts tags and nothing else. An unknown field, an unknown operator, an and carrying no condition, a filters that is an array or null, or an operand that is null or not an object is refused with 400 before anything is looked up — so a typo comes back as a rejected request, never as an empty page you might read as “no results”.Deleting a measurement
DELETE /measures/{measureId}
Authorization: Bearer <apiKey>
This removes the stored media — captures, images, video and signals — and then the measurement itself, and answers 200 OK with an empty body. A file that is already gone is not an error, so a deletion interrupted halfway can simply be issued again. Once a deletion has completed, the measure no longer exists, and a second call answers 404.
This is the call that keeps a privacy promise
If your product tells users that a scan leaves nothing behind, this is what makes that true. Nothing else removes the media.The result
{
"id": "3f1a5c88-0b2d-4e6a-9c11-7d5e8a2b4f60",
"status": "ended",
"createdAt": "2026-08-24T14:57:44.000Z",
"startedAt": "2026-08-24T14:57:46.000Z",
"endedAt": "2026-08-24T14:58:22.000Z",
"desiredVariables": null,
"unwantedVariables": null,
"returnedVariables": ["hr", "br", "strs", "bp"],
"signal": { "qualityScore": { "value": 100, "error": null } },
"variables": {
"hr": { "value": { "mean": 72.4 }, "error": null },
"br": { "value": { "mean": 15.1 }, "error": null },
"strs": { "value": { "level": 2, "scale": { "min": 1, "max": 5 } }, "error": null },
"bp": { "value": null, "error": "MISSING_USER_DATA_EXTERNAL_ID" }
},
"userData": {
"externalId": null, "sex": "F", "age": 35,
"weight": 58, "height": 171, "smokingStatus": "non-smoker"
},
"tags": ["cohort-a"]
}
A measure that has not ended stops at its state: a created one carries neither startedAt nor anything after it, a started one has no endedAt, returnedVariables, signal or variables. userData is null when none was given, and a field you did not send is null inside it; a dateOfBirth comes back as the age it gave.
returnedVariables is an entitlement, not an outcome
This is the field most often misread. It lists the variables your client account is allowed to receive, narrowed by any desiredVariables / unwantedVariables you passed. It does not list what succeeded.
returnedVariables: [] means the account grants nothing you asked for
It is not a processing failure. An account on which no variable has been enabled ends every one of its measurements with an empty list — even when the capture went perfectly.
The signature to recognise: a present signal, and empty variables. Look at the account, not at the capture.
Value shapes
Every variable is one of two things: a value with error: null, or value: null with an error code.
| Variables | Shape on success |
|---|---|
hr, br, hrv | { "value": { "mean": 72.4 }, "error": null } |
strs, bpClass | { "value": { "level": 2, "scale": { "min": 1, "max": 5 } }, "error": null } |
bp | { "value": { "systole": 118, "diastole": 76 }, "error": null } |
physicalAge, bmi, faceBmi, healthScore | { "value": 24.1, "error": null } |
| any | { "value": null, "error": "CONFORMITY_POOR_LIGHT" } |
scale gives the range of level: 1 to 5 for strs, 1 to 3 for bpClass — or 1 to 2 when you asked for two levels.
Always branch on error first:
const hr = result.variables.hr
if (hr?.error === null)
console.log("heart rate:", hr.value.mean)
else if (hr)
console.warn("heart rate unavailable:", hr.error)
else
console.warn("heart rate not granted to this account")
Error codes
An error is a code to act on, not a message to show.
| Code | What it says |
|---|---|
CONFORMITY_FACE_PRESENCE, CONFORMITY_FACE_SIZE, CONFORMITY_INITIALISATION, CONFORMITY_HIGH_FPS, CONFORMITY_LOW_FPS, CONFORMITY_UNKNOWN_FPS, CONFORMITY_MISSING_SIGNAL, CONFORMITY_MUCH_VARIATIONS, CONFORMITY_ONDULATIONS, CONFORMITY_POOR_LIGHT | The capture itself: the face, its size, the frame rate, the light, the stability of the signal |
MISSING_USER_DATA, MISSING_USER_DATA_AGE, MISSING_USER_DATA_EXTERNAL_ID, MISSING_USER_DATA_HEIGHT, MISSING_USER_DATA_SEX, MISSING_USER_DATA_SMOKING_STATUS, MISSING_USER_DATA_WEIGHT | A field of userData the variable needs was not sent |
MISSING_CAPTURES, MISSING_IMAGE, MISSING_SIGNAL, EXCEEDING_MAX_IMAGE, INVALID_IMAGE_SIZE, INVALID_IMAGE_TYPE | The source sent cannot yield this variable |
BAD_VIDEO_FORMAT, VIDEO_DURATION_ERROR, NO_FRAME_FOUND | The video sent cannot be measured: it cannot be read, it is too short, or no frame could be extracted from it. The same video will always get the same answer. Conditions for a good measurement lists what a recorded file must satisfy |
MISSING_BP_CLASSIFICATION, MISSING_PROCESSOR, NOT_CALIBRATED | Something the variable depends on is missing — for NOT_CALIBRATED, the person’s calibration |
BAD_RMSSD, OUT_OF_RANGE, PROCESSOR_FAIL, UNKNOWN | The computation refused the input, or did not complete |
CREDIT_EXCEEDED | Your account has no credit left for the month; the measurement is not charged |
The quality indicator
"signal": { "qualityScore": { "value": 100, "error": null } }
signal is null when the measurement had no pulse signal to assess — a measurement made from images, for instance.
qualityScore is a binary indicator: 100 when the signal yielded at least one window usable to calibrate blood pressure, 0 when it did not.
Do not build a threshold on it
qualityScore reports on the signal itself, not on the measurement as a whole, and it is not a grade of how exploitable that measurement was. A rule of the form “reject below n” reads it for something it does not say.To judge whether a measurement is usable, read the individual variables and their error codes: a variable that could not be computed names the reason itself, which is the information a threshold was standing in for.
Work that out on Test data first. Rights and credits are set per account, so what a Test account returns is not necessarily what your Production account will return. Environments sets out the separation.