Skip to main content

Zero to First FHIR Call

This page is for a developer building an application against MedBackend — you signed up, or someone invited you, and you want a working Patient query as fast as possible. It needs nothing you have to install.

By the end of this page you will have registered a device, obtained a token, and run a GraphQL query that returns a real (if empty) result. Every step below is something you do once, by hand, to get your first response. The device token you end up with is also what your application code uses at runtime — see Device Authentication for the full reference once this page has you working.

1. Sign in​

Open your MedBackend dashboard and click Sign In. There is no in-platform signup: account creation goes through the platform's identity provider, reachable from the same screen (Create Account). If you don't have an account yet, use that link — what it allows (self-registration vs. invite-only) is configuration outside this platform, so it isn't described here.

2. Create a project​

From the dashboard, create a new project — name, a short description, and a location are all it asks for. This kicks off infrastructure provisioning for your project's FHIR server, which typically takes 5–10 minutes. The project starts in pending status and becomes active once provisioning finishes; the dashboard shows this, and you can also poll GET /projects/{project_uid}/health.

Wait for active before continuing

Every step below — bootstrapping an organisation, applying an RBAC template, registering a device — either requires an active project directly or depends on something that does. Issuing them back-to-back with project creation will fail. Wait for the status change first.

3. Finish the setup checklist​

Once your project is active, the dashboard shows a "Finish setting up this project" checklist. For this walkthrough you need two of its items:

  • Set up an organisation
  • Grant access to something (choose an RBAC template)

A third item, adding a practitioner, only appears once an organisation exists and is not required for what follows — it matters if you're modelling clinicians, not for a device integration.

3a. Set up the organisation​

Click Set one up. The form asks for an organisation name, an admin practitioner's name, a role (defaults to ICT professional), and one question with no default: whether patients who sign up should be recorded as belonging to this organisation (patient_custodianship: "organization" or "none"). Either answer is fine to get started — it decides who can reach patient data by organisation membership later, not whether this quickstart works.

This step exists for more than tidiness: registering a device requires the project to have an organisation. Without one, device registration is refused outright.

3b. Apply an RBAC template​

Click Choose a template. A project's access configuration is default_access: Forbidden: every request is denied unless a rule allows it, and denied silently — searches come back [] and reads come back null, with no error to tell you why. The template is what decides which callers get a yes, so pick the one that matches what you are building rather than keeping whichever is already selected.

Pick Medical Device Integration. It grants the Device role project-wide reads on Patient, Observation, Device and DeviceMetric, plus create on Observation, DeviceMetric and Media — the shape a script, worker, or AI agent needs. (The other templates target different callers — Patient Portal for patient-facing apps, Clinical Provider (EHR) for practitioner-facing ones — see the template picker for the full list.)

The developer API key is not this credential

The dashboard also has a self-serve API key, generated from Settings → API Keys. It authenticates only against the configuration surface — project settings, RBAC rules and publishing, and webhook configuration — and structurally cannot read or write FHIR data, register devices, or invite members. Using it as a Bearer token against /graphql will not work. The credential that reaches FHIR data is the device token from the next step.

4. Register a device​

Open Devices and click Register New Device. Give it a name (this becomes its device_id) and leave the type as medical_device unless you have a reason to change it. If the project has no organisation yet, this screen tells you so and links back to step 3a rather than letting you proceed.

The registration response shows the device's API key once — this is the api_key half of the credential pair, alongside the device_id you chose. Store it then: it cannot be read back later, and a lost key is replaced by rotating it.

5. Get a token​

Exchange the device credentials for a short-lived JWT:

POST https://backbone.medbackend.com/api/account/token/device/
Content-Type: application/json
X-Project-ID: <your-project-id>

{
"device_id": "<the name you gave the device>",
"api_key": "<the api key from registration>"
}
{
"access": "header.payload.signature",
"expires_in": 600
}

Your project id is on the project's page in the dashboard (also returned as id by the projects API). expires_in is in seconds — 600 (10 minutes) is what a project's own published configuration sets. The 5-minute value quoted as the general default in Device Authentication applies when a project publishes no device configuration of its own; a project created through the dashboard has token_expiry_minutes provisioned at 10 unless you change it. Re-run this request to get a fresh token once it expires — there's no refresh flow, just re-issuance.

6. Make your first query​

Everything after this point is an ordinary authenticated GraphQL call — the same shape your application will use. Confirm your identity first:

POST https://backbone.medbackend.com/graphql
Authorization: Bearer <token from step 5>
X-Project-ID: <your-project-id>
Content-Type: application/json

{"query": "{ Me { reference } }"}

This should return something like {"data": {"Me": {"reference": "Device/<id>"}}}. If it does, your token and project header are wired correctly. Now the query that matters:

query {
PatientList {
id
name { given family }
}
}

On a brand-new project this returns "PatientList": [] — an empty list, not an error. That's a successful, correctly-authorized query against a project that has no patients yet, which is exactly where a fresh project starts. If you instead get a permission error or a null, re-check that the RBAC template from step 3b was actually applied to this project's active configuration.

You have now gone from a signed-in account to a working, authorized FHIR query, without provisioning any infrastructure yourself.

Where to go next​

  • Making Authenticated Requests — the full request contract: headers, project binding, error shapes.
  • Device Authentication — what a device token can reach, what a leaked one exposes, and how to scope it down.
  • Project Configuration Guide — the settings.json shape this quickstart set up on your behalf, if you want to read or hand-edit it directly.
  • FHIR API Requests Guide — creating, updating, searching and deleting resources once you're past your first read.
  • RBAC basics — writing rules of your own once the shipped templates stop being enough.