Error Handling
In the event that the API returns an error, the response body will contain a error message and error code in the JSON format shown below.
We're also sending all error codes in the response header nhn-error-code.
You can use this header if you're only interested in the error code to avoid parsing the response body.
When error response the HTTP status will be in the range 3xx-5xx. When ok response the HTTP status will be in the 2xx range.
In case the service sees too high load then the request might be rate limited and the client will in that case receive a response with status code 429 and empty body.
Example of an error response body returned from the API:
{
"errorCode": "PI-0009",
"errorMessage": "Not allowed to read/update data for this patient because their address is confidential",
"eventId": "c65f8f64-2c9c-4624-a4f0-3dbc4bde3300"
}
Error Codes
Error codes has prefix "PI".
| Error code | Cause |
|---|---|
| PI-0001 | Unknown technical error |
| PI-0002 | Unknown error |
| PI-0003 | Database error |
| PI-0004 | Data validation error - input is not correct |
| PI-0005 | Invalid code or code not in codeSystem |
| PI-0006 | Deserialization error, invalid request body |
| PI-0007 | Invalid user (not borger or helsepersonell) |
| PI-0008 | Patient is deceased, cannot write data for deceased patient |
| PI-0009 | Patient has confidential address, cannot read or write data |
| PI-0010 | Invalid auth role for the attempted action |
| PI-0011 | Invalid nin |
| PI-0012 | Resource already exists for patient |
| PI-0013 | Invalid version |
| PI-0014 | No resource to update, use create to create new records |
| PI-0015 | No patient info record found |
| PI-0016 | The user tried to lookup a patient but has been blocked by the patient (blokkering). |
| PI-0017 | The user is requesting access to data that the patient has set restricted access to (sperring). |
| PI-0018 | The user does not have access to the requested endpoint. See error message for details. |