Authentication
The new birth message uses HelseID for both authentication and authorisation. The API requires a valid HelseID access token (JWT) sent in the Authorization header, with DPoP (Demonstrating Proof of Possession) ensuring that the token cannot be used by another party.
How to set up a HelseID client and obtain a token is described in the HelseID documentation on the Developer Portal.
Access (scope)
Each call requires the access token to have the corresponding scope:
| Scope | Grants access to |
|---|---|
nhn:birthsystem/read |
The status endpoints (GET /v1/birth/{messageId}, POST /v1/birth/get-by-hospital-child-identification-number) |
nhn:birthsystem/write |
Registration of a birth (POST /v1/birth) |
In addition, all endpoints require the token to be linked to an organisation (that the user's organisation number, orgnr_parent, is present).
Requirements for registering a birth (write)
To register a birth (POST /v1/birth), in addition to the nhn:birthsystem/write scope the authenticated person must fulfil the following:
- Midwife or doctor – the person is identified by the HPR number in the token and must be registered as a midwife or doctor. The system verifies this against the HPR (the Health Personnel Register), and uses userinfo data from HelseID if the HPR is not available.
- Assurance level 4 – the token must have an assurance level of at least 4.
- HPR number – the token must contain the HPR number.
These three requirements ensure that only authorised health personnel (midwives and doctors) can register births.
Note
The identity of the midwife/doctor is taken from the token, not from the birth message itself. When a birth is registered, the system looks up the person behind the token and links name, NIN, HPR number and organisation number to the message. This data is sent to the Population Register as jordmorEllerForloesendeLege.
DPoP
With DPoP the API cryptographically binds the access token to the client, so the token cannot be used by anyone else:
- Every request must contain a DPoP proof (
DPoPheader) generated with the same private key that was used to obtain the token. - The API has replay detection enabled: a DPoP proof can only be used once and is valid for a short time window (5 seconds).
This means that you as an integrator must implement DPoP according to the HelseID documentation: send both Authorization: DPoP <token> and an accompanying DPoP header with every call.
Error codes related to authentication
| HTTP status | Meaning |
|---|---|
401 Unauthorized |
The access token is missing, or the token is invalid, expired or unrecognised. Can also be caused by the DPoP proof not being verifiable. |
403 Forbidden |
The token is valid, but the user is missing the required scope, the organisation link, or does not fulfil the midwife/doctor requirements (write). |