PIT-API overview
Pasientinformasjonstjenesten (PIT) provides endpoints for submitting and retrieving patient information. Patient resources are represented using the FHIR standard, version R4.
Available environments
| Environment | FQDN |
|---|---|
| Test | api.pit.test.nhn.no |
Access control
Accessing the PIT API requires clients to be authenticated using HelseID and DPoP (Demonstrating Proof-of-Possession):
- Scope: Clients must request the appropriate scope (
nhn:pit/api.readornhn:pit/api.write). - Claim: Access token must include claim
helseid://claims/client/claims/orgnr_parent. - DPoP required: Only requests including DPoP tokens are accepted.
- Authorization header: Access token must be sent using the
DPoPprefix (i.e., notBearer). - DPoP-Proof: Requests must include a
DPoPheader with a signed proof generated by the client.
See HelseID Dokumentasjon - DPoP for implementation details.
Submitting patient resources
Patient resources are submitted by making POST requests to the Patient endpoint.
Endpoint format: POST /v1/Patient
A successful submission returns 202 Accepted. Processing is asynchronous — the resource is queued for
internal processing after being accepted.
Note
There is a request size limit of approximately 900 KB for this endpoint.
Retrieving patient resources
Patient resources are retrieved by making GET requests to the Patient endpoint.
Endpoint format: GET /v1/Patient
The response is a FHIR Bundle containing matching Patient resources.
Filtering
_lastUpdatedlimits results based on when resources were last updated in PIT. Requires a prefix (gt,ge,lt,le) with at least minute precision. Example:ge2024-01-01T12:00Z.
Pagination
Keyset pagination (also known as seek pagination) limits the number of resources returned per request.
An opaque cursor parameter is used to retrieve the next page of results. The response Bundle includes a next
link containing the cursor value.
_countcontrols the page size (1–50, default 20)._sortcontrols the sort order:_lastUpdatedfor ascending (default) or-_lastUpdatedfor descending.
Cursor constraints:
- Treat the
cursorvalue as completely opaque — do not attempt to decode or modify it. - Combining filter parameters (
_lastUpdated) with a cursor is not allowed and will result in a400error. - When a cursor is provided, the
_sortparameter is ignored.
Pagination example
GET /v1/Patient?_count=10&_sort=-_lastUpdated
The response Bundle includes self and next link elements:
{
"resourceType": "Bundle",
"type": "searchset",
"link": [
{
"relation": "self",
"url": "https://api.pit.test.nhn.no/v1/Patient?_count=10&_sort=-_lastUpdated"
},
{
"relation": "next",
"url": "https://api.pit.test.nhn.no/v1/Patient?cursor=ZXlKTVlYTjB..."
}
]
}
To fetch the next page, follow the next link via GET.