API Documentation
API Overview
API Base URL
Development: http://localhost:8061/api/v1
Production: https://pdhc.se/api/v1
This API provides FHIR R5 compliant endpoints for healthcare resource management. All endpoints support JSON format and follow FHIR R5 standards.
Quick Endpoint Reference
| Category | Endpoints | Methods |
|---|---|---|
| FHIR Resources | /Patient, /CarePlan, /Observation, /PlanDefinition |
GET, POST, PUT, DELETE |
| Terminology | /ValueSet, /CodeSystem |
GET, POST, PUT, DELETE |
| Concepts | /concepts, /activities, /goals |
GET, POST, PUT, DELETE |
| Lookup Tables | /canonical-libs, /concept-types, /response-types, /units |
GET, POST, PUT, DELETE |
| Operations | /$batch, /$transaction, /$validate, /CodeSystem/$lookup |
POST |
| Monitoring | /health, /metrics, /status |
GET |
| Metadata | /metadata |
GET |
Concepts API
Manage healthcare concepts and related entities.
GET /api/v1/concepts
Retrieve all concepts with optional filtering and pagination.
Query Parameters:
page- Page number (default: 1)per_page- Items per page (default: 20)search- Search termconcept_type- Filter by concept typeresponse_type- Filter by response typecanonical_lib- Filter by canonical libraryhas_values- Filter by values (true/false)
Example:
GET /api/v1/concepts?search=blood&page=1&per_page=10
POST /api/v1/concepts
Create a new concept.
Required Fields:
canonical_lib- Canonical library UUIDconcept_name- Concept name
Example Request Body:
{
"canonical_lib": "123e4567-e89b-12d3-a456-426614174000",
"concept_name": "Blood Pressure",
"concept_display_text": "Blood Pressure Measurement",
"concept_explain": "Measurement of blood pressure",
"concept_type": "456e7890-e89b-12d3-a456-426614174001",
"response_type": "789e0123-e89b-12d3-a456-426614174002"
}
FHIR Resources
FHIR R5 compliant resource endpoints.
Patient Resources
GET /api/v1/Patient- Search patientsPOST /api/v1/Patient- Create patientGET /api/v1/Patient/{id}- Get patient by IDPUT /api/v1/Patient/{id}- Update patientDELETE /api/v1/Patient/{id}- Delete patient
Search Parameters:
name- Patient namegender- Patient genderbirthdate- Birth date
CarePlan Resources
GET /api/v1/CarePlan- Search care plansPOST /api/v1/CarePlan- Create care planGET /api/v1/CarePlan/{id}- Get care plan by IDPUT /api/v1/CarePlan/{id}- Update care planDELETE /api/v1/CarePlan/{id}- Delete care plan
Search Parameters:
subject- Patient referencestatus- Care plan statusintent- Care plan intent
Observation Resources
GET /api/v1/Observation- Search observationsPOST /api/v1/Observation- Create observationGET /api/v1/Observation/{id}- Get observation by IDPUT /api/v1/Observation/{id}- Update observationDELETE /api/v1/Observation/{id}- Delete observation
Search Parameters:
subject- Patient referencecategory- Observation categorycode- Observation code
Terminology API
FHIR terminology services for ValueSets and CodeSystems.
ValueSet Resources
GET /api/v1/ValueSet- Search ValueSetsPOST /api/v1/ValueSet- Create ValueSetGET /api/v1/ValueSet/{id}- Get ValueSet by IDPUT /api/v1/ValueSet/{id}- Update ValueSetDELETE /api/v1/ValueSet/{id}- Delete ValueSet
Operations:
GET /api/v1/ValueSet/{id}/$expand- Expand ValueSetPOST /api/v1/ValueSet/$validate-code- Validate code
CodeSystem Resources
GET /api/v1/CodeSystem- Search CodeSystemsPOST /api/v1/CodeSystem- Create CodeSystemGET /api/v1/CodeSystem/{id}- Get CodeSystem by ID
Operations:
POST /api/v1/CodeSystem/$lookup- Lookup code
Lookup Tables API
Manage lookup tables and reference data.
Canonical Libraries
GET /api/v1/canonical-libs- List all canonical librariesPOST /api/v1/canonical-libs- Create canonical libraryGET /api/v1/canonical-libs/{id}- Get canonical library by IDPUT /api/v1/canonical-libs/{id}- Update canonical libraryDELETE /api/v1/canonical-libs/{id}- Delete canonical library
Concept Types
GET /api/v1/concept-types- List all concept typesPOST /api/v1/concept-types- Create concept typeGET /api/v1/concept-types/{id}- Get concept type by IDPUT /api/v1/concept-types/{id}- Update concept type
Response Types
GET /api/v1/response-types- List all response typesPOST /api/v1/response-types- Create response typeGET /api/v1/response-types/{id}- Get response type by IDPUT /api/v1/response-types/{id}- Update response type
Units
GET /api/v1/units- List all unitsPOST /api/v1/units- Create unitGET /api/v1/units/{id}- Get unit by IDPUT /api/v1/units/{id}- Update unit
FHIR Operations
Advanced FHIR operations for batch processing and validation.
POST /api/v1/$batch
Execute a batch of FHIR operations.
Example Request:
{
"resourceType": "Bundle",
"type": "batch",
"entry": [...]
}
POST /api/v1/$transaction
Execute a transaction of FHIR operations (atomic).
POST /api/v1/$validate
Validate a FHIR resource against the specification.
POST /api/v1/CodeSystem/$lookup
Lookup a code in a CodeSystem.
Production Monitoring
Health checks, metrics, and system status endpoints.
GET /api/v1/health
Comprehensive health check endpoint.
GET /api/v1/metrics
Get system performance metrics.
GET /api/v1/status
Get system status information.
Metadata & Capability Statement
System metadata and capability information.
GET /api/v1/metadata
Retrieve FHIR CapabilityStatement with supported resources and operations.
This is the primary endpoint for discovering API capabilities.
Access:
GET http://localhost:8061/api/v1/metadata
Example Response:
{
"resourceType": "CapabilityStatement",
"id": "fhir-engine-capability",
"url": "http://localhost:8061/api/v1/metadata",
"version": "1.0.0",
"name": "FHIR Healthcare Transaction Engine",
"status": "active",
"fhirVersion": "5.0.0",
"rest": [{
"mode": "server",
"resource": [...]
}]
}
View Live Capability Statement
Authentication & User Management
Authentication, user management, and API key management endpoints.
Authentication Endpoints
POST /api/v1/auth/login- Login and get JWT tokenPOST /api/v1/auth/logout- Logout and invalidate tokenPOST /api/v1/auth/register- Register new userGET /api/v1/auth/me- Get current user informationGET /api/v1/auth/token- Get session token
User Management
GET /api/v1/users- List all usersGET /api/v1/users/{id}- Get user by IDPUT /api/v1/users/{id}- Update userDELETE /api/v1/users/{id}- Delete userPUT /api/v1/users/{id}/password- Update user passwordPOST /api/v1/users/{id}/password/reset- Reset user password
API Key Management
GET /api/v1/api-keys- List all API keysPOST /api/v1/api-keys- Create new API keyGET /api/v1/api-keys/{key_guid}- Get API key by GUIDPUT /api/v1/api-keys/{key_guid}- Update API keyDELETE /api/v1/api-keys/{key_guid}- Delete API keyGET /api/v1/api-keys/{key_guid}/usage- Get API key usage statisticsPOST /api/v1/api-keys/{key_guid}/rotate- Rotate API key
Activities & Goals
Manage healthcare activities and goals.
Activities
GET /api/v1/activities- List all activitiesPOST /api/v1/activities- Create new activityGET /api/v1/activities/{id}- Get activity by IDPUT /api/v1/activities/{id}- Update activityDELETE /api/v1/activities/{id}- Delete activityPOST /api/v1/activities/{id}/transactions- Create transaction for activityPUT /api/v1/transactions/{id}- Update transactionDELETE /api/v1/transactions/{id}- Delete transactionGET /api/v1/activities/{id}/fhir- Get activity as FHIR resource
Goals
GET /api/v1/goals- List all goalsPOST /api/v1/goals- Create new goalGET /api/v1/goals/{id}- Get goal by IDPUT /api/v1/goals/{id}- Update goalDELETE /api/v1/goals/{id}- Delete goal
Provider Management
Provider tasks and provider management endpoints.
Provider Tasks
GET /api/v1/provider-tasks- List all provider tasksGET /api/v1/provider-tasks/my- Get tasks for authenticated providerGET /api/v1/provider-tasks/{receipt_token}- Get task by receipt tokenPOST /api/v1/provider-tasks/{receipt_token}/accept- Accept a provider taskPOST /api/v1/provider-tasks/{receipt_token}/report- Submit task report/observationsGET /api/v1/provider-tasks/{receipt_token}/careplan-details- Get full CarePlan details for taskGET /api/v1/provider-tasks/debug- Debug endpoint for provider tasks
Providers
GET /api/v1/providers- List all providersGET /api/v1/providers/{id}- Get provider by ID
FHIR Server Integration
Integrate with external FHIR servers and terminology services.
Server Management
GET /api/v1/servers/status- Get status of all configured serversPOST /api/v1/servers/test- Test connection to a serverGET /api/v1/servers/test-all- Test all configured serversGET /api/v1/servers/{server_name}/search/{resource_type}- Search resources on external serverGET /api/v1/servers/{server_name}/{resource_type}/{resource_id}- Get resource from external serverPOST /api/v1/servers/{server_name}/validate- Validate resource on external serverPOST /api/v1/servers/{server_name}/{resource_type}- Create resource on external serverPUT /api/v1/servers/{server_name}/{resource_type}/{resource_id}- Update resource on external server
Terminology Services
GET /api/v1/terminology/{service_name}/expand- Expand ValueSet via terminology serviceGET /api/v1/terminology/{service_name}/lookup- Lookup code via terminology serviceGET /api/v1/terminology/{service_name}/validate-code- Validate code via terminology service
Synchronization
POST /api/v1/synchronize- Synchronize resources with external serverPOST /api/v1/batch- Execute batch operations on external serverGET /api/v1/health- Health check for server integration