Skip to main content

Authentication

Your key​

Every request carries your partner key in X-Api-Key.

X-Api-Key: pk_live_4f9c…

The key is issued by the Health Nexus team and shown once. Store it in a secret manager; never put it in a mobile app, a web page or a repository. If it leaks, ask for it to be rotated: the old key stops working at once.

Calls are server to server. A request that carries an Origin header, as browsers send, is refused with 403. A key can also be restricted to a list of IP addresses.

Naming the person​

Requests about one person name that person in headers.

HeaderRequiredValue
X-Api-KeyalwaysYour key.
X-Subject-Emailon every endpoint outside sign-in and sign-upThe person's email, lowercase.
X-Subject-Account-Idrecommendeduser.accountId from the sign-in reply.
X-Request-IdoptionalYour own trace id. It is kept in our audit log and helps when you report a problem.

The sign-in and sign-up endpoints take only your key: there the email travels in the body.

X-Subject-Account-Id is a check, not a key. When you send it, the person must be known at that account, otherwise the API answers 404. When one email holds two records, the header tells them apart; without it the API answers 400 with code: "ambiguous_subject".

Whom your key can reach​

Your key reaches the people who signed in or signed up through your integration and accepted the terms. Knowing someone's email is never enough.

ReplyMeaningWhat to do
403 code: "user_not_linked"The person has an account but has not signed in through you.Send them through sign-in.
403 code: "terms_required"Signed in, but the terms are not accepted yet.Record the acceptance.
404No such person.Start with check-email.

Scopes​

A key has the read scope, or read and write.

  • read: every GET.
  • write: signing people in and up, accepting terms, uploading, and every POST, PUT, PATCH and DELETE.

A read-only key that tries to write gets 403 with "Partner credential is read-only.".

No sessions​

The API never hands you a session token and there is nothing to refresh. A finished sign-in creates the link between the person and your key; after that, the same headers work on every call until the key is rotated or revoked.