REST API
Shareable reports
Turn a measurement into an end-to-end encrypted link your user can open or share.
Turn a stored measurement into a private web page your end user can open or share, for example with a clinician. The report is end-to-end encrypted: Neccessory stores only ciphertext.
Create a report
POST /sdk/v1/measurements/{id}/reportThe measurement must belong to the signing key.
| Field | Type | Default | Description |
|---|---|---|---|
ttlHours | number | 72 | Lifetime in hours, 1–168. Values outside the range are clamped |
burnAfterRead | boolean | false | The first opening consumes the report |
locale | string | "en" | Language of the report page: en or ru |
import { neccessory } from './neccessory.js';
const report = await neccessory(
'POST',
'/sdk/v1/measurements/meas_9c1f4b7ae2d05138b6a37f42/report',
{ ttlHours: 48, burnAfterRead: true, locale: 'en' },
);neccessory is the helper from Authentication.
Response
201 Created:
{
"ok": true,
"data": {
"reportId": "rpt_Qm7ZkT2pXc9LwR4vN8bYs1HdJ6fGa3Ue",
"url": "https://neccessory.com/en/report/rpt_Qm7ZkT2pXc9LwR4vN8bYs1HdJ6fGa3Ue#pJ0x7uVv2kqzH1cR9mEwT4nY8sL3bF6gA5dK0iO2eZQ",
"expiresAt": 1790172800000,
"burnAfterRead": true
}
}| Field | Type | Description |
|---|---|---|
reportId | string | Report ID, rpt_… |
url | string | The link to hand to the user. The part after # is the decryption key |
expiresAt | number | When the report stops opening, epoch milliseconds |
burnAfterRead | boolean | Whether the first opening consumes the report |
Errors
| HTTP | error.code | Cause |
|---|---|---|
| 400 | validation_error | locale is not en or ru, or ttlHours is not a number |
| 401 | unauthorized | Signature or key problem |
| 404 | not_found | The measurement does not exist or belongs to another key |
| 429 | rate_limited | More than 30 reports in an hour for this key |
Security model
- Each report is encrypted with its own random key.
- The key exists only in the URL fragment, after
#. Browsers do not send the fragment to servers, and Neccessory does not keep the key. Only someone with the full link can read the report. - Neccessory stores the ciphertext until
expiresAt. - With
burnAfterRead, the first opening consumes the report. - A report that does not exist, has expired or was consumed returns the same "not found" page. A report ID reveals nothing on its own.
Using the link
- Give
urlto the user exactly as returned. Without the fragment the page cannot decrypt the report. - Treat the full URL as a secret. Do not write it to logs or analytics.
- Create reports when the user asks to share, not in bulk. Each key can create 30 per hour.
- Choose the shortest
ttlHoursthat fits, andburnAfterReadfor one-time viewing. - A report is a snapshot of the measurement at creation time.
What the report shows
The link opens https://neccessory.com/{locale}/report/{reportId}. The page decrypts the report
in the browser and shows:
- when the report was created;
- signal quality;
- heart rate, SDNN, RMSSD, breathing rate and stress index;
- systolic and diastolic blood pressure and SpO2;
- the wellness score and disclaimers.
Values that were not measured stay empty. The page is not indexed by search engines.