Authentication
The EMIS-X FHIR API uses modern, standards-based authentication (authN) and authorisation (authZ) powered by the EMIS-X AuthN & AuthZ platform.
All interactions with the FHIR API require a valid OAuth 2.0 / OpenID Connect
(OIDC) access token passed in the Authorization HTTP header.
Request Header
Section titled “Request Header”Every request to a secured FHIR API endpoint must supply a Bearer access token:
Authorization: Bearer <access_token>If the Authorization header is missing, expired, or malformed, the API gateway
rejects the request with HTTP 401 Unauthorized.
Token Types
Section titled “Token Types”The platform issues transparent JSON Web Tokens (JWT) signed by EMIS Health:
- Application-Restricted Tokens: Issued via the client credentials flow
(
grant_type=client_credentials). Used for backend, machine-to-machine integrations where no direct user is present. - User-Restricted Tokens: Issued via user-delegated flows (such as Authorization Code Flow with PKCE). Used when actions are performed on behalf of an authenticated healthcare professional.
Both token types contain cryptographic signatures and claims that the FHIR Platform validates statelessly.
Organisation Context & Site-Specific Tokens
Section titled “Organisation Context & Site-Specific Tokens”FHIR care-record operations are patient- and organisation-scoped. To perform requests against an organisation’s FHIR data, the access token must be issued in the context of that organisation.
Requesting a Site-Specific Token
Section titled “Requesting a Site-Specific Token”Clients request an organisation-scoped token by appending organisation query parameters to the token endpoint:
POST https://identity.stg.emis-x.uk/{tenant}/B2C_1A_ClientCredentialsV3/oauth2/v2.0/token?organisationIdentifierType=cdb&organisationIdentifier=60002Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id={client_id}&scope={scope}&client_secret={client_secret}Query Parameters
Section titled “Query Parameters”organisationIdentifierType: Identifier type for the organisation (for example,cdborods).organisationIdentifier: The identifier value (for example, a CDB number such as60002or an ODS code).
Token Claims
Section titled “Token Claims”When successfully authenticated, the token payload includes:
orgERN: The organisation’s EMIS Resource Name (e.g.ern:emis:org:org:XXXXXXXXXXXXX).ods: The organisation’s ODS code when known.cdb: The EMIS practice or customer database identifier.authorizations: The scopes and permissions granted to the application.
Error Handling
Section titled “Error Handling”- 401 Unauthorized: Returned by the API gateway when the token is missing, expired, revoked, or cryptographically invalid. Formatted as a JSON error object:
{ "error": "invalid_token", "error_description": "The access token provided has expired."}- 403 Forbidden: Returned when the caller is authenticated but lacks
required scopes or permissions for the requested resource. Formatted as a FHIR
OperationOutcome.
For further details on EMIS-X authentication flows and libraries such as MSAL, see the portal’s top-level Authentication guide.