API keys
Create a key, choose its mode, keep the secret safe and control what the key can do.
A key is a pair of values:
- Key ID — public. Sent in the
x-key-idheader and safe to log. - Secret — private. Signs your requests. Shown once, when the key is created.
One key serves the SDKs and the REST API. Live keys start with nk_live_, test keys with
nk_test_.
Key modes
| Mode | Use it for | Availability |
|---|---|---|
cloud | Cloud measurements and video processing. Results are computed by Neccessory and billed in tokens | Everyone. The default |
test | Automated tests and CI. Synthetic results, never billed | Everyone |
on_device | On-device measurements in the browser: the key can create model grants | After your on-device access request is approved |
The mode is set when you create the key and cannot be changed. For a different mode, create a new key.
Create a key
- Open Keys in the console and click New key.
- Choose the mode, and optionally a name and an expiry (365 days by default, or never).
- Choose the metric sets the key may request. Leave all selected to allow every set.
- Create the key and copy the secret. It is shown only once.
Keep the secret safe
- Store the secret in your server's environment or secret manager.
- Never put it in web pages, mobile apps or source control. Apps get short-lived session tokens or model grants from your server instead.
- If a secret leaks, rotate the key at once.
Key settings
Each key has limits you can change at any time in the console:
| Setting | Effect | Error when it applies |
|---|---|---|
| Metric sets | Sets the key may request: hrv, bp, spo2, emotion, gaze | 403 feature_not_allowed |
| Requests per minute | Limit on all signed requests, from 1 to 6,000. Empty means no limit | 429 rate_limited |
| Monthly cloud seconds | Cap on seconds of cloud processing per calendar month (UTC) | 403 quota_exceeded |
| Monthly spend cap | Cap on token spend per calendar month, entered in US dollars | 403 token_quota_exceeded |
| Model channel | stable or beta models, for on_device keys | — |
Test keys ignore the cloud seconds quota and the spend cap. See Limits & quotas.
Rotate, disable, delete
| Action | Result |
|---|---|
| Rotate | Issues a new secret. The old secret stops working immediately. This is also how you replace a lost secret |
| Disable | Blocks the key without deleting it. Requests return 401 unauthorized |
| Delete | Removes the key permanently |
To change secrets without downtime, create a second key, deploy it, then disable the old one.
Test keys
A test key signs requests exactly like a live key but never runs a real measurement. Use it to test signing, session creation, polling, webhooks and result parsing in CI.
- Results are synthetic and deterministic for each key. They carry
"test": true. - A result becomes available about 2 seconds after the session or job is created.
- Cloud sessions return
wsUrl: null. In the Web SDK, usedelivery: 'batch'with a test session. - Video jobs still need a real upload; the job then completes at once with a synthetic result.
hrv,bpandspo2are filled when requested;emotionandgazestaynull.- Nothing is billed and no quotas apply. Model grants are not available.
- The console hides test measurements unless you choose to show them.
On-device access
On-device mode puts the processing on the person's device. Apply for it in On-device in the console. The request asks for:
- the platforms you need: web, iOS, Android;
- your use case — where the measurement runs, what you are building and for whom;
- your company name and, optionally, the expected monthly number of measurements;
- two confirmations: on-device results are not attested and are not a basis for medical conclusions, and you will not extract or redistribute the models.
A concrete use case speeds up the review. You can have one open request at a time. The answer is approved, rejected or more information needed — in the last case, reply by email to support@neccessory.com. Access can later be revoked.
After approval, create new keys in On-device mode; existing keys keep their mode. While your request is reviewed, build on cloud mode — switching a web integration later changes one option.
Check a key
POST /sdk/v1/auth/test confirms that your signing works and returns the key's mode,
limits and your token balance. See Authentication.