FHIR Complete

API Overview

Base URLs, authentication, and common patterns for all APIs

Base URLs

ServiceURL
FHIR APIhttps://rkyywwxpkzzkvopnobvt.supabase.co/functions/v1/fhir-api
SMART Authhttps://rkyywwxpkzzkvopnobvt.supabase.co/functions/v1/smart-auth
HR APIhttps://rkyywwxpkzzkvopnobvt.supabase.co/functions/v1/hr-api
Inventory APIhttps://rkyywwxpkzzkvopnobvt.supabase.co/functions/v1/inventory-api

Authentication

All API requests (except smart-auth and public endpoints) require a SMART on FHIR JWT:

Authorization: Bearer <jwt-token>

Obtain a token via the Staff Login or Patient Login endpoints.

Common Request Patterns

Search (GET)

All FHIR resource searches support these common parameters:

ParameterTypeDescription
_countnumberPage size (default: 20)
_offsetnumberPagination offset (default: 0)
_sortstringSort field (prefix - for descending)
_summarystringcount returns only total count

Example:

GET /Patient?name=John&_count=10&_offset=0

Search Response (FHIR Bundle)

{
  "resourceType": "Bundle",
  "type": "searchset",
  "total": 42,
  "entry": [
    {
      "resource": {
        "resourceType": "Patient",
        "id": "patient-001",
        "name": [{ "given": ["John"], "family": "Doe" }]
      }
    }
  ]
}

Create (POST)

POST /Patient
Content-Type: application/json

{
  "resourceType": "Patient",
  "name": [{ "given": ["John"], "family": "Doe" }]
}

Read (GET)

GET /Patient/patient-001

Update (PUT)

PUT /Patient/patient-001
Content-Type: application/json

{ "resourceType": "Patient", "id": "patient-001", ... }

Delete (DELETE)

DELETE /Patient/patient-001

Error Responses

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "not-found",
      "diagnostics": "Patient/unknown-id not found"
    }
  ]
}
HTTP StatusMeaning
200Success
201Created
400Bad request / validation error
401Unauthorized (missing/invalid token)
403Forbidden (insufficient permissions)
404Resource not found
500Internal server error

CORS

All Edge Functions return appropriate CORS headers. Preflight OPTIONS requests are handled automatically.

Public Endpoints

These endpoints do NOT require authentication:

EndpointDescription
GET /metadataFHIR CapabilityStatement
GET /Organization/search-publicSearch public organizations
GET /Organization/{id}/public-profilePublic org profile
GET /specializationsList practice specialties
GET /.well-known/smart-configurationSMART metadata