Upload a custom FHIR profile

POST/fhir/profiles

Creates a custom profile from a FHIR StructureDefinition supplied as a JSON object. Metadata such as version, resource type, and url is read from the StructureDefinition; the lowercase StructureDefinition id becomes the profile's lookup key. When id is omitted, a random UUID is assigned. Code system configuration is auto-extracted from the snapshot. Optionally group the profile under a named implementation guide.

RequiresBearerauthentication

Body parameters

structure_definitionobjectrequired

A FHIR StructureDefinition as a JSON object. Must include url, type, and a snapshot with elements. Metadata such as version, resource type, and url is read from the StructureDefinition itself. The lowercase id becomes the profile's lookup key; when omitted, a random UUID is assigned.

implementation_guidestringoptional

Implementation Guide name to group this profile under. On create, defaults to "custom" if omitted; on update, omitting it preserves the profile's current guide. Cannot be "us_core" (reserved). Use this to organize custom profiles into named IGs that can be referenced when calling create/multi or document/multi endpoints.

Returns  

Profile successfully created

Response fields

idstringoptional

The lowercase StructureDefinition id, used as the profile's lookup key.

sourcestringoptional

The profile's origin. Listings currently return only custom (uploaded) profiles, so this is always "custom" today; built-in (US Core / R4 base) profiles would be surfaced via an opt-in parameter in a future release, not by changing the default behavior.

custombuiltin
resource_typestringoptional

The FHIR resource type from the StructureDefinition.

urlstringoptional

The canonical URL from the StructureDefinition.

versionstringoptional

The version from the StructureDefinition.version field.

fhir_versionstringoptional

The base FHIR version the StructureDefinition targets.

implementation_guidestringoptional

The implementation guide the profile belongs to.

created_atstring (date-time)optional
updated_atstring (date-time)optional
POSTRequest
# Get authentication token
PHENOML_TOKEN=$(curl -X POST "https://experiment.app.pheno.ml/v2/auth/token" \
  -u "$PHENOML_CLIENT_ID:$PHENOML_CLIENT_SECRET" \
  | jq -r '.access_token')

curl -X POST "https://experiment.app.pheno.ml/fhir/profiles" \
  -H "Authorization: Bearer $PHENOML_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "structure_definition": {
    "resourceType": "StructureDefinition",
    "id": "custom-patient",
    "url": "http://phenoml.com/fhir/StructureDefinition/custom-patient",
    "name": "CustomPatient",
    "status": "active",
    "fhirVersion": "4.0.1",
    "kind": "resource",
    "abstract": false,
    "type": "Patient",
    "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
    "derivation": "constraint",
    "snapshot": {
      "element": [
        {
          "id": "Patient",
          "path": "Patient",
          "min": 0,
          "max": "*"
        },
        {
          "id": "Patient.name",
          "path": "Patient.name",
          "min": 1,
          "max": "*"
        }
      ]
    }
  },
  "implementation_guide": "acme-cardiology"
}'
201 CreatedExample Response
{
  "id": "custom-patient",
  "source": "custom",
  "resource_type": "Patient",
  "url": "http://phenoml.com/fhir/StructureDefinition/custom-patient",
  "version": "1.0.0",
  "fhir_version": "4.0.1",
  "implementation_guide": "acme-cardiology",
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z"
}