Skip to content

API Reference

  • Base URL: http://localhost:8080 (configurable)
  • FHIR Version: R4 (4.0.1)
HeaderValues
Acceptapplication/fhir+json, application/json
Content-Typeapplication/fhir+json, application/json

OctoFHIR supports all standard FHIR R4 resource types. Common resources include:

  • Clinical: Patient, Observation, Condition, Procedure, DiagnosticReport
  • Administrative: Organization, Practitioner, Location, Encounter
  • Financial: Claim, Coverage, ExplanationOfBenefit
  • Workflow: Task, ServiceRequest, Appointment
Terminal window
GET /metadata

Returns the server’s CapabilityStatement describing supported operations.

Terminal window
POST /{resourceType}
Content-Type: application/fhir+json
{resource body}

Response: 201 Created with Location header

Terminal window
GET /{resourceType}/{id}

Response: 200 OK with resource body

Terminal window
PUT /{resourceType}/{id}
Content-Type: application/fhir+json
If-Match: W/"{versionId}" # Optional, for conditional update
{resource body with id}

Response: 200 OK with updated resource

Terminal window
DELETE /{resourceType}/{id}

Response: 204 No Content

Terminal window
GET /{resourceType}?{parameters}
POST /{resourceType}/_search
Content-Type: application/x-www-form-urlencoded
{parameters}

Response: 200 OK with Bundle of type searchset

See Search Parameters for detailed search documentation.

Terminal window
# Instance history
GET /{resourceType}/{id}/_history
# Type history
GET /{resourceType}/_history
# System history
GET /_history
Terminal window
GET /{resourceType}/{id}/_history/{versionId}
Terminal window
POST /
Content-Type: application/fhir+json
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [...]
}

All-or-nothing execution. See Transactions for details.

Terminal window
POST /
Content-Type: application/fhir+json
{
"resourceType": "Bundle",
"type": "batch",
"entry": [...]
}

Independent execution of each entry.

Terminal window
POST /{resourceType}/$validate
POST /{resourceType}/{id}/$validate

Validate a resource against profiles.

Terminal window
GET /ValueSet/$expand?url={valuesetUrl}
POST /ValueSet/$expand

Expand a ValueSet. See Terminology for details.

Terminal window
GET /ValueSet/$validate-code?url={valuesetUrl}&code={code}&system={system}
POST /ValueSet/$validate-code
Terminal window
GET /Patient/{id}/$everything

Returns a Bundle with all resources related to the patient.

ParameterTypeDescription
_idtokenResource logical ID
_lastUpdateddateLast modification timestamp
_profileuriProfiles the resource conforms to
_tagtokenTags on the resource
_securitytokenSecurity labels
_sourceuriSource URI
ModifierTypesDescription
:exactstringCase-sensitive exact match
:containsstringSubstring match
:missingallElement present/absent
:texttokenMatch display text
:nottokenExclude matching codes
:intokenCode in ValueSet
:not-intokenCode not in ValueSet
:belowtokenCode or descendants
:abovetokenCode or ancestors
ParameterDescription
_countNumber of results per page
_offsetPagination offset
_sortSort by parameter(s)
_elementsReturn only specified elements
_summaryReturn summary (true, false, text, data, count)
_includeInclude referenced resources
_revincludeInclude resources that reference results

All errors return an OperationOutcome:

{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "not-found",
"diagnostics": "Resource Patient/xyz not found"
}
]
}
CodeMeaning
200Success (search, read)
201Created
204No Content (delete)
400Bad Request
401Unauthorized
403Forbidden
404Not Found
409Conflict (version mismatch)
412Precondition Failed
422Unprocessable Entity
500Internal Server Error
HeaderDescription
AcceptResponse format
Content-TypeRequest body format
If-MatchConditional update (ETag)
If-None-MatchConditional read
If-None-ExistConditional create (search params)
PreferReturn preference (return=minimal, return=representation)
X-Request-IdCorrelation ID for tracing
X-Skip-ValidationSkip validation (if enabled)
HeaderDescription
LocationURL of created/updated resource
ETagResource version (W/"1")
Last-ModifiedResource modification timestamp
Content-LocationCanonical URL
Terminal window
GET /health
GET /health/ready
GET /health/live
Terminal window
GET /admin/cache/stats
POST /admin/cache/clear
Terminal window
GET /admin/config
GET /admin/config/{category}
PUT /admin/config/{category}/{key}
Terminal window
GET /admin/features
GET /admin/features/{flag}
PUT /admin/features/{flag}
Terminal window
GET /admin/db/stats
GET /admin/indexes/suggestions

Search results include pagination links:

{
"resourceType": "Bundle",
"type": "searchset",
"total": 150,
"link": [
{"relation": "self", "url": "...?_count=10"},
{"relation": "first", "url": "...?_count=10&_offset=0"},
{"relation": "next", "url": "...?_count=10&_offset=10"},
{"relation": "previous", "url": "...?_count=10&_offset=0"},
{"relation": "last", "url": "...?_count=10&_offset=140"}
],
"entry": [...]
}

When rate limiting is enabled:

HeaderDescription
X-RateLimit-LimitRequests allowed per window
X-RateLimit-RemainingRequests remaining
X-RateLimit-ResetWindow reset timestamp
Retry-AfterSeconds until retry (when limited)

CORS is enabled by default for browser-based clients:

  • Allowed origins: Configurable
  • Allowed methods: GET, POST, PUT, DELETE, OPTIONS
  • Allowed headers: Content-Type, Authorization, Accept, X-Request-Id