Authentication and scopes
Every API request carries a key that belongs to one workspace and lists exactly what it may read. This page covers keys, scopes, the rule for patient-identifying fields, rate limits and errors, and the roles people hold inside a workspace.
API keys#
Send the key in the Authorization header. A key is never accepted in a query string or a body.
curl https://api.epic.direct/v1/hospitals \
-H "Authorization: Bearer edk_live_…"- A key starts with
edk_live_. Its first characters are kept as a prefix so you can recognise it in the workspace; the rest is stored only as a SHA-256 hash. - It is displayed once, when created. It cannot be shown again.
- It belongs to one workspace. The workspace is taken from the key, never from anything in the request.
- It can be given an expiry of 1 to 730 days, and can be revoked at any time. Revocation takes effect on the next request.
- Creating and revoking keys needs the Owner, Administrator or Developer role, and is written to the audit trail.
Two endpoints need no key: /v1/health and /v1/openapi.json.
Scopes#
A key carries an explicit list of scopes. Nothing is implied by another scope, and there is no scope that grants everything.
| Scope | Allows |
|---|---|
org:read | Read the workspace profile and enabled modules. |
hospitals:read | List hospitals and their connections. |
connections:read | Read connection status, health and capabilities. |
requisitions:read | Read requisitions. Patient identifiers are withheld without phi:read. |
protocols:read | Read hospital protocol options and rules. |
decisions:read | Read protocol suggestions and decisions. |
jobs:read | Read automation jobs and their outcomes. |
events:read | Read the event stream. |
phi:read | Include patient-identifying fields in responses. Grant deliberately. |
Which scope each endpoint needs:
| Endpoint | Scope |
|---|---|
GET /v1/health | None. No key needed. |
GET /v1/organization | org:read |
GET /v1/connector-types | Any valid key. |
GET /v1/hospitals | hospitals:read |
GET /v1/hospitals/{hospital_id}/protocols | protocols:read |
GET /v1/connections | connections:read |
GET /v1/requisitions | requisitions:read |
GET /v1/requisitions/{requisition_id} | requisitions:read |
GET /v1/decisions | decisions:read |
GET /v1/jobs | jobs:read |
GET /v1/events | events:read |
Patient-identifying fields#
requisitions:read alone returns requisitions with every identifying field set to null. The same request with phi:read fills them in. Each requisition says which it is in phi_included.
| Returned without phi:read | Returned only with phi:read |
|---|---|
| Status, source, hospital, connection, modality, study, body region, indication, priority, flags, timestamps | The source system's order id, accession number, patient (MRN, name, date of birth, sex), clinical information, ordering provider, location |
- Only an Owner or Administrator can create a key with
phi:read. A Developer cannot: returning patient identifiers is a clinical permission, not a developer one. decisions:readadds the suggestion, the decision and the submission state to each requisition, and opens/v1/decisions, which is de-identified.- Events and webhook payloads never carry patient data, whatever the key holds.
Rate limits#
Each key may make 120 requests per minute. The window is the clock minute, and every authenticated response reports where you stand:
| Header | Meaning |
|---|---|
x-ratelimit-limit | Requests allowed per minute for this key. |
x-ratelimit-remaining | Requests left in the current minute. |
x-ratelimit-reset | When the window resets, in Unix seconds. |
retry-after | On a 429 only: seconds to wait before trying again. |
Errors#
An error has one shape. request_id is also sent as the x-request-id header.
{
"error": {
"code": "insufficient_scope",
"message": "This key does not have the requisitions:read scope.",
"request_id": "req_…"
}
}| Status | Code | When |
|---|---|---|
| 401 | missing_key | No bearer token, or one that is not an API key. |
| 401 | invalid_key | The key is unknown, revoked or expired, or its workspace is not active. The answer is the same for all of them. |
| 403 | insufficient_scope | The key does not hold the scope the endpoint needs. The message names it. |
| 403 | module_not_enabled | The workspace does not have the module the endpoint belongs to, or does not have the API module at all. The message names it; GET /v1/organization lists the modules that are on. |
| 404 | not_found | No such endpoint, or no such record in this workspace. |
| 400 | invalid_limit | The limit parameter is not a number. |
| 400 | invalid_cursor | The cursor was not issued by this endpoint. |
| 400 | invalid_status | The status filter is not one of the listed values. |
| 429 | rate_limited | The key has used its requests for this minute. |
Other credentials#
API keys are one of four kinds of credential. They are not interchangeable.
| Credential | Form | Used by | Stored as |
|---|---|---|---|
| Session | Cookie on one workspace host, 12 hours | People signed in to a workspace or the admin console | Managed by the sign-in service |
| API key | edk_live_… | Systems reading the REST API | SHA-256 hash |
| Agent token | eda_… | An Epic.direct Agent, on the agent protocol | SHA-256 hash |
| Webhook secret | whsec_… | Your receiver, to verify deliveries | Sealed with AES-GCM |
Workspace roles#
People sign in with an account that was created by invitation, and hold one role per workspace. The role is read again on every call; the server checks the permission for each action, not the page.
| Role | For |
|---|---|
| Owner | Full control of the workspace, including members and credentials. |
| Administrator | Manages hospitals, connections, protocol libraries and members. |
| Radiologist | Reviews requisitions and approves protocol decisions. |
| Coordinator | Sees the worklist and requisition status; cannot approve protocols. |
| Developer | Manages API credentials and webhooks; no clinical data. |
| Viewer | Read-only access to operational status; no clinical data. |
| Permission | Owner | Administrator | Radiologist | Coordinator | Developer | Viewer |
|---|---|---|---|---|---|---|
clinical.readSee requisitions and studies, including patient-identifying fields. | Yes | Yes | Yes | Yes | No | No |
clinical.decideApprove, modify or reject a protocol: the clinical sign-off. | Yes | Yes | Yes | No | No | No |
connections.manageHospitals, connections, schedules and agents. | Yes | Yes | No | No | No | No |
credentials.manageEnter or rotate the credentials for a connection. | Yes | Yes | Yes | No | No | No |
protocols.manageProtocol options and rules, including approving proposed rules. | Yes | Yes | Yes | No | No | No |
members.manageMembers, roles and invitations. | Yes | Yes | No | No | No | No |
developer.manageAPI keys and webhooks. | Yes | Yes | No | No | Yes | No |
settings.manageWorkspace profile, retention, notifications, backups. | Yes | Yes | No | No | No | No |
ops.readOperational status: connection health, jobs, agents. No patient data. | Yes | Yes | Yes | Yes | Yes | Yes |
audit.readThe audit trail. | Yes | Yes | No | No | No | No |
The platform administrator is not on this table. That role is separate from every workspace role and grants infrastructure control only: see Security.