A command-line utility and Python module for discovering FHIR endpoints and related API metadata.
ifhir.py searches for FHIR and related endpoints on a given URL/host, including:
- FHIR metadata (CapabilityStatement)
- SMART-on-FHIR discovery endpoints
- OIDC discovery endpoints
- OAuth2 discovery endpoints
- Swagger/OpenAPI documentation
- API documentation UIs
pip install inspectorfhirpython ifhir.py --url https://example.com/fhir--url, -U, -u: Full FHIR URL where metadata should be found (e.g.,https://example.com/fhir)--hostname, -H: Target server hostname (e.g.,https://example.com)--fhir_prefix, -F: FHIR API prefix (e.g.,/fhir) - used with--hostname--all, -A: Include full details of each endpoint check in the output
Using a full URL:
python ifhir.py --url https://example.com/fhir/metadataUsing hostname and prefix separately:
python ifhir.py --hostname https://example.com --fhir_prefix /fhirInclude detailed results:
python ifhir.py --url https://example.com/fhir --allfrom inspectorfhir.ifhir import fhir_recognizerParameters:
url(str): The FHIR endpoint URL to checkinclude_details(bool): Whether to include detailed response data (default:True)
Returns: Dictionary containing discovery results
from inspectorfhir.ifhir import fhir_recognizer
import json
# Check a FHIR endpoint with full details
result = fhir_recognizer('https://example.com/fhir', include_details=True)
print(json.dumps(result, indent=2))
# Check without detailed response data
result = fhir_recognizer('https://example.com/fhir', include_details=False)
print(json.dumps(result, indent=2))The response includes a report section with discovery results:
{
"report": {
"fhir_metadata": {"url": "...", "found": true},
"oidc_discovery": {"url": "...", "found": false},
"oauth2_discovery": {"url": "...", "found": false},
"smart_discovery_1": {"url": "...", "found": true},
"smart_discovery_2": {"url": "...", "found": false},
"documentation_ui": {"found": true, "https://...": true},
"swagger_json": {"found": true, "https://...": true}
}
}When include_details=True, a details section contains full HTTP responses and data from each endpoint.