HAPI FHIR Test Server
hapi.fhir.org · Health
Public FHIR R4 test server for developers learning FHIR — create, read, update, and delete patients, observations, conditions, medications, and all FHIR resources. Free, no auth for public test data.
Authentication
No authentication requiredFree to use with no key needed.
Sample Requests
GET
Search patients
Search for patients with surname Smith.
https://hapi.fhir.org/baseR4/Patient?_count=5&family=Smith&_format=json
Hover any highlighted part to learn what it does
curl -X GET "https://hapi.fhir.org/baseR4/Patient?_count=5&family=Smith&_format=json"
import requests
params = {
"_count": "5",
"family": "Smith",
"_format": "json"
}
response = requests.get(
"https://hapi.fhir.org/baseR4/Patient",
params=params,
)
print(response.json())const url = new URL('https://hapi.fhir.org/baseR4/Patient');
url.searchParams.set('_count', '5');
url.searchParams.set('family', 'Smith');
url.searchParams.set('_format', 'json');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://hapi.fhir.org/baseR4/Patient")
q := baseURL.Query()
q.Set("_count", "5")
q.Set("family", "Smith")
q.Set("_format", "json")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://hapi.fhir.org/baseR4/Patient")
uri.query = URI.encode_www_form({
"_count" => "5",
"family" => "Smith",
"_format" => "json"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://hapi.fhir.org/baseR4/Patient?" . http_build_query([
"_count" => "5",
"family" => "Smith",
"_format" => "json"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
Get observations
Get blood pressure observations (LOINC 55284-4).
https://hapi.fhir.org/baseR4/Observation?code=55284-4&_count=5&_format=json
Hover any highlighted part to learn what it does
curl -X GET "https://hapi.fhir.org/baseR4/Observation?code=55284-4&_count=5&_format=json"
import requests
params = {
"code": "55284-4",
"_count": "5",
"_format": "json"
}
response = requests.get(
"https://hapi.fhir.org/baseR4/Observation",
params=params,
)
print(response.json())const url = new URL('https://hapi.fhir.org/baseR4/Observation');
url.searchParams.set('code', '55284-4');
url.searchParams.set('_count', '5');
url.searchParams.set('_format', 'json');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://hapi.fhir.org/baseR4/Observation")
q := baseURL.Query()
q.Set("code", "55284-4")
q.Set("_count", "5")
q.Set("_format", "json")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://hapi.fhir.org/baseR4/Observation")
uri.query = URI.encode_www_form({
"code" => "55284-4",
"_count" => "5",
"_format" => "json"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://hapi.fhir.org/baseR4/Observation?" . http_build_query([
"code" => "55284-4",
"_count" => "5",
"_format" => "json"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- No API key needed
- Base URL: https://hapi.fhir.org/baseR4/
- Always add ?_format=json for JSON output
- Search patients: GET /Patient?name=john&_count=5&_format=json
- FHIR resources: Patient, Observation, Condition, Medication, Encounter, DiagnosticReport
- Never store real patient data on this public server