Developer API Keys
A developer API key lets you configure your own project from code — a script, a CI job, your own agent — instead of the dashboard. It reaches the configuration API at /config/v1/ and nothing else.
A developer API key cannot read patient data. Not FHIR resources, not AuditEvent, not analytics. This is not a rule that refuses those requests: no route that returns them exists on the surface a key can reach. Outside /config/v1/ a key is not a credential at all: a request carrying one is treated as unauthenticated.
That is what makes the key reasonable to keep in CI. Treat it as a secret anyway — see what a leaked key can do.
Getting a key
In the dashboard, open your project, then Developer Tools → API Keys, and create a key. Choose its scopes and its lifetime.
The key is shown once, at creation, and never again. There is no way to recover it. If it is lost, create a new key and revoke the old one.
A key can be revoked from the same page, by the member who created it or by a member who can manage the project's settings.
Sending a key
GET /config/v1/status HTTP/1.1
Host: api.medbackend.com
Authorization: Bearer mbk_...
Keys begin with mbk_ and an environment segment, followed by a non-secret prefix the dashboard shows to tell your keys apart.
A developer API key goes in Authorization: Bearer. A device API key is sent differently and is exchanged for a token first. The two credentials are not interchangeable, and neither works on the other's endpoints.
The project comes from the key. You do not need X-Project-ID. If you send it anyway, it must name the key's own project. A key presented with another project's id is refused, not ignored.
Scopes
| Scope | Grants | Default |
|---|---|---|
config:read | Read the project's configuration | Yes — a key created without choosing a scope gets this one |
config:write | Change the project's configuration and publish it | No |
inventory:read | List the project's devices and LLM agents — see Devices & Agents. Issuing it requires permission to view both devices and LLM agents | No |
A key can never hold more than the member who created it. To issue a scope, you must already be able to do in the dashboard what that scope allows. If the member who created the key is removed from the project, is deactivated, or loses that access, the key stops working on the next request.
Removing a member from a project, or lowering their role, silently stops every key they created. If a CI pipeline runs on a departing colleague's key, issue a replacement from an account that is staying before you remove them. The project owner's keys are not affected by membership changes.
Lifetime
Every key expires. The default is 90 days and the maximum is 365 days. There is no option for a key that never expires.
A key stops working when any of the following happens:
- it is revoked
- it expires
- the member who created it is removed from the project or deactivated
- that member no longer holds the access behind the key's scopes
There is no automatic rotation. To rotate, create a new key, switch your integration to it, then revoke the old key.
Errors
Every rejected key gets the same response: 401 with Invalid API key. The body does not say whether the key was revoked, expired, mistyped, sent to the wrong path or sent with another project's id. Work through the list above when you see it.
| Status | When |
|---|---|
401 | The key is missing, malformed, revoked, expired, or no longer backed by its creator's access, or it was sent outside /config/v1/ or with another project's X-Project-ID |
403 | The key is valid but lacks the scope this route and method need. A dashboard session token gets 403 on every /config/v1/ route: this API accepts project API keys only |
405 | The route does not support this method |
Routes
Reading any route with GET needs config:read (or inventory:read for devices and agents). Every POST, PUT, PATCH and DELETE needs config:write.
None of the routes takes a path parameter. Writes name what they change in the request body.
Reading
| Route | Returns |
|---|---|
GET /config/v1/project | uid, name, description, status, fhir_version, created_at, updated_at |
GET /config/v1/status | Whether the current configuration is published: status, config_published, config_published_at, config_publish_failed_at |
GET /config/v1/resources | The FHIR resource types you can configure rules for |
GET /config/v1/vocabularies | The accepted values for client roles, operations and validators |
GET /config/v1/connection | The FHIR endpoint, the OAuth issuer and JWKS URL, and one entry per registered user flow: entity_type, name, client_id, authorize_url, token_url, allowed_redirect_uris, redirect_uris_configured, upstream_providers, upstream_allowed_domains |
GET /config/v1/rbac | The access matrix: default_access, has_unpublished_changes, last_published_at, every rule and every validator's settings |
GET /config/v1/webhooks | Webhook settings and the webhooks managed in the dashboard. The signing secret is never returned, only has_hmac_secret |
GET /config/v1/devices · GET /config/v1/agents | See Devices & Agents (inventory:read) |
Writing
| Route | Does |
|---|---|
PATCH /config/v1/project | Change the project's name (up to 100 characters) and description. Nothing else is writable |
PATCH /config/v1/connection | Change one user flow's sign-in settings: its name (see Flow name), allowed_redirect_uris, and Sign in with Google (upstream_providers, upstream_allowed_domains) |
PATCH /config/v1/rbac | Set default_access |
PUT /config/v1/rbac/rules | Create or update the rule of a client_role / resource / operation triple. Returns 409 when the triple holds several rules (one per practitioner role, managed in the dashboard) |
DELETE /config/v1/rbac/rules | Delete every rule of a triple |
PUT /config/v1/rbac/validators | Create or update one validator's settings |
DELETE /config/v1/rbac/validators | Remove one validator's settings |
POST /config/v1/rbac/resources · DELETE /config/v1/rbac/resources | Track or untrack a resource type for a client role. Untracking also deletes every rule for that client role and resource type |
POST /config/v1/rbac/publish | Publish the configuration, so it takes effect |
A successful write returns 201 when it created something and 200 when it changed or deleted something. A DELETE that matched nothing returns 200 with "deleted": false, so retrying a delete is safe.
A write the API refuses because of its content returns 422 with a detail that names the problem. Two exceptions: an invalid PATCH /config/v1/project body returns 400, and the rbac rule, validator and resource write routes and PATCH /config/v1/rbac return 404 if the project has no access configuration yet.
Changes take effect when the project is published
Writes are stored, not applied. They take effect at the project's next publish. That is usually your POST /config/v1/rbac/publish, but a publish started from the dashboard, or by registering or removing a device, applies them too. So write and publish in the same run, and never leave a half-finished change stored.
GET /config/v1/rbac shows has_unpublished_changes: true when the configuration was edited after the last publish from this API or the dashboard's access-rules page. A publish triggered by registering or removing a device does not clear it, so treat it as a hint, not proof that a change is not live.
POST /config/v1/rbac/publish HTTP/1.1
Host: api.medbackend.com
Authorization: Bearer mbk_...
A successful publish returns 200 with published, version and published_at. A 422 means the configuration itself cannot be published, and the detail says why. Fix it and publish again. A 502 means the publish failed on our side: retry later, and contact support if it persists.
The exception is PATCH /config/v1/connection, which applies immediately. See below.
Rules
A rule is identified by three fields: client_role, the resource type and operation. A PUT with the same three values updates that rule. A PUT with new values creates one.
{
"client_role": "Practitioner",
"resource_name": "Observation",
"operation": "read",
"validator": "practitioner_compartment"
}
| Field | |
|---|---|
client_role | Required. One of the client roles from GET /config/v1/vocabularies |
resource_name or entity_name | Required. The resource type. Both names are accepted, so a rule read from GET /config/v1/rbac can be sent back unchanged. If you send both and they differ, the request is refused |
operation | Required. One of the operations from GET /config/v1/vocabularies |
validator | Optional. Defaults to forbidden when the rule is created. Refused if this validator can never grant this client role access, or if this resource type falls outside its compartment |
required_role_system, required_role_code | Optional. See Requiring a Practitioner Role |
pre_request_hook_url, pre_request_hook_enabled, post_response_hook_url, post_response_hook_enabled | Optional. This rule's webhooks. A hook URL must use https://, otherwise 422; send null to remove a hook |
On an update, any optional field you leave out keeps its current value.
DELETE takes the same three identifying fields.
What the validators do is described under Validation.
Webhooks are set per rule
To configure a webhook, set the hook fields on the rule it belongs to, then publish. POST, PATCH and DELETE on /config/v1/webhooks are always refused with 422, and the detail points you to PUT /config/v1/rbac/rules. GET /config/v1/webhooks still works.
Validators
PUT /config/v1/rbac/validators takes the validator's name (from GET /config/v1/vocabularies) and any of enabled (boolean), role_inheritance_levels (a non-negative integer) and additional_settings (an object, which may not contain enabled or role_inheritance_levels, otherwise 422). DELETE takes the name alone.
Tracked resources
POST and DELETE /config/v1/rbac/resources take client_role and entity_name. DELETE also deletes every rule for that client role and resource type. Creating a rule with PUT /config/v1/rbac/rules starts tracking its resource type for you.
Default access
PATCH /config/v1/rbac takes default_access. The only accepted value is Forbidden: anything no rule matches is denied.
Redirect URIs
{
"entity_type": "Patient",
"allowed_redirect_uris": ["https://app.example.com/callback", "exampleapp://callback"]
}
- The list replaces the flow's current list. It is not merged. To add a URI, read the current list from
GET /config/v1/connectionand send it back with the new entry. - At least one URI and at most 20, each up to 2000 characters.
- Every URI needs a scheme (
https://,http://, or your app's own scheme). Script and local-content schemes such asjavascript:anddata:are refused. - The user flow must already be registered. Before it is, the request is refused with
422.
The same route also takes the flow's name (Flow name) and upstream_providers and upstream_allowed_domains, which control Sign in with Google. Send any of the four fields together with entity_type. A field you leave out is not changed.
This change applies immediately. It does not wait for a publish.
A 422 whose detail says the authorization service refused the values will not succeed on retry: correct the value. A 502 means the outcome is unknown: the change may or may not have been applied. Read GET /config/v1/connection before you retry.
What a key can never do
These operations are not on the surface a key can reach, under any scope:
- read FHIR data of any kind, including
AuditEventand analytics - read any secret: OAuth client secrets, device or agent keys, the webhook signing secret
- invite, add or remove members, or change their roles
- register, change or remove a device or LLM agent
- create or delete a project
- create, extend or widen a key, including itself
Do these in the dashboard.
What a leaked key can do
Within its own project, and only that project:
- with
config:read, read the project's configuration: the access rules, the connection details and the webhook settings, but no secret - with
config:write, change the access rules and validator settings and publish them, change the OAuth redirect URIs, turn Sign in with Google on or off and change its allowed domains, and rename the project and its sign-in flows
That second half matters. A config:write key cannot read patient data itself, but it can change what other credentials may read, and redirect URIs decide where a login sends its authorization code. Treat a config:write key as you would an administrator's session: give it the shortest lifetime your pipeline can live with, prefer config:read wherever reading is enough, and revoke a key the moment you suspect it has leaked.
The configuration API keeps no per-key log of what a key did. Record which pipeline holds which key, so you know what to revoke.