Skip to main content

Project configuration

Every project has one configuration document. The dashboard writes most of it when you create the project, set up an organisation, apply an access template or register a device; the configuration API writes the same keys from code. This page describes the keys you set and the shape they take. The project's FHIR store is provisioned for you and cannot be changed.

The keys you set​

{
"rbac": {
"default_access": "Forbidden",
"validation_rules": []
},
"device_auth": {
"token_expiry_minutes": 10
},
"playground": {
"enabled": false
}
}

There is no auth key. Which identity provider a project uses is not part of its configuration; see Identity providers.

rbac: who may do what​

"rbac": {
"default_access": "Forbidden",
"validation_rules": [
{
"client_role": "Patient",
"entity_name": "Observation",
"operation": "read",
"validator": "patient_compartment"
}
]
}

default_access is "Forbidden", so the project starts with nothing granted and each rule opens exactly one role/resource/operation triple. The rule above lets a Patient read Observations inside their own compartment, and nothing more: the same role cannot create an Observation, and cannot read a Patient, until a rule for each of those triples is added.

Two notes that catch people out:

  • A search with no search rule falls back to the read rule for the same resource. That is the only fallback; no other operation implies another. In particular a create rule grants nothing else, and grants no reads.
  • Compartment validators check the payload on writes. patient_compartment on a create or update requires the submitted resource to reference the caller as subject, patient or performer. A resource type with none of those fields, a Patient resource itself for instance, can never satisfy it, so pair those triples with a different validator.

default_access is compared literally and only "Forbidden" and "Allowed" are recognised; a misspelling is refused at publish time. See Writing access rules before editing rules by hand, and Requiring a practitioner role for the two optional keys a rule can carry.

device_auth: device tokens​

"device_auth": {
"token_expiry_minutes": 10
}

Device keys are issued when you register a device in the dashboard, and you never write them into the configuration; what the platform publishes carries only a SHA-256 hash of each key. token_expiry_minutes is the lifetime of the token a device gets in exchange for its key. A project created through the dashboard has it provisioned at 10; a project that publishes no value gets the platform default of 5. See Device authentication for the full contract.

playground: the interactive explorer​

"playground": {
"enabled": false
}

Off by default. When a project turns it on, /playground on the API host serves an interactive explorer for that project; when it is off, /playground and its data endpoint return 404. The /graphql endpoint your application calls is unaffected either way. See Reading and writing resources.

Troubleshooting​

SymptomLikely causeWhere to look
401 on every requestToken invalid, expired, or issued for another projectMaking authenticated requests
Searches return [], reads return null, no errorNo rule grants the role, resource and operationWriting access rules
A rule exists and still denies every writeThe resource type has none of the validator's write fieldsWhat a compartment validator asks of a write
Configuration refused when publisheddefault_access misspelled, or a rule names a validator that does not existWriting access rules