Skip to content

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.

Request
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.

ScopeAllows
org:readRead the workspace profile and enabled modules.
hospitals:readList hospitals and their connections.
connections:readRead connection status, health and capabilities.
requisitions:readRead requisitions. Patient identifiers are withheld without phi:read.
protocols:readRead hospital protocol options and rules.
decisions:readRead protocol suggestions and decisions.
jobs:readRead automation jobs and their outcomes.
events:readRead the event stream.
phi:readInclude patient-identifying fields in responses. Grant deliberately.

Which scope each endpoint needs:

EndpointScope
GET /v1/healthNone. No key needed.
GET /v1/organizationorg:read
GET /v1/connector-typesAny valid key.
GET /v1/hospitalshospitals:read
GET /v1/hospitals/{hospital_id}/protocolsprotocols:read
GET /v1/connectionsconnections:read
GET /v1/requisitionsrequisitions:read
GET /v1/requisitions/{requisition_id}requisitions:read
GET /v1/decisionsdecisions:read
GET /v1/jobsjobs:read
GET /v1/eventsevents: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:readReturned only with phi:read
Status, source, hospital, connection, modality, study, body region, indication, priority, flags, timestampsThe 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:read adds 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:

HeaderMeaning
x-ratelimit-limitRequests allowed per minute for this key.
x-ratelimit-remainingRequests left in the current minute.
x-ratelimit-resetWhen the window resets, in Unix seconds.
retry-afterOn 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.

403 Forbidden
{
  "error": {
    "code": "insufficient_scope",
    "message": "This key does not have the requisitions:read scope.",
    "request_id": "req_…"
  }
}
StatusCodeWhen
401missing_keyNo bearer token, or one that is not an API key.
401invalid_keyThe key is unknown, revoked or expired, or its workspace is not active. The answer is the same for all of them.
403insufficient_scopeThe key does not hold the scope the endpoint needs. The message names it.
403module_not_enabledThe 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.
404not_foundNo such endpoint, or no such record in this workspace.
400invalid_limitThe limit parameter is not a number.
400invalid_cursorThe cursor was not issued by this endpoint.
400invalid_statusThe status filter is not one of the listed values.
429rate_limitedThe key has used its requests for this minute.

Other credentials#

API keys are one of four kinds of credential. They are not interchangeable.

CredentialFormUsed byStored as
SessionCookie on one workspace host, 12 hoursPeople signed in to a workspace or the admin consoleManaged by the sign-in service
API keyedk_live_…Systems reading the REST APISHA-256 hash
Agent tokeneda_…An Epic.direct Agent, on the agent protocolSHA-256 hash
Webhook secretwhsec_…Your receiver, to verify deliveriesSealed 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.

RoleFor
OwnerFull control of the workspace, including members and credentials.
AdministratorManages hospitals, connections, protocol libraries and members.
RadiologistReviews requisitions and approves protocol decisions.
CoordinatorSees the worklist and requisition status; cannot approve protocols.
DeveloperManages API credentials and webhooks; no clinical data.
ViewerRead-only access to operational status; no clinical data.
PermissionOwnerAdministratorRadiologistCoordinatorDeveloperViewer
clinical.readSee requisitions and studies, including patient-identifying fields.YesYesYesYesNoNo
clinical.decideApprove, modify or reject a protocol: the clinical sign-off.YesYesYesNoNoNo
connections.manageHospitals, connections, schedules and agents.YesYesNoNoNoNo
credentials.manageEnter or rotate the credentials for a connection.YesYesYesNoNoNo
protocols.manageProtocol options and rules, including approving proposed rules.YesYesYesNoNoNo
members.manageMembers, roles and invitations.YesYesNoNoNoNo
developer.manageAPI keys and webhooks.YesYesNoNoYesNo
settings.manageWorkspace profile, retention, notifications, backups.YesYesNoNoNoNo
ops.readOperational status: connection health, jobs, agents. No patient data.YesYesYesYesYesYes
audit.readThe audit trail.YesYesNoNoNoNo

The platform administrator is not on this table. That role is separate from every workspace role and grants infrastructure control only: see Security.