Skip to main content

Spine Directory Service - FHIR API

Access details of organisations, people and systems registered in the Spine Directory Service (SDS) using our FHIR-conformant API.

Overview

Use this API to access details of systems registered in the Spine Directory Service (SDS).

You can:

  • get accredited system details

You cannot currently use this API to:

  • search for organisations
  • search for people

Accredited system records

Every system that connects to the Spine has one or more “Accredited System” (AS) records in SDS, identified by an Accredited System Identifier (ASID). This ASID is unique to a system deployed in a specific organisation, so the same application deployed into three NHS organisations would typically be represented as three unique ASIDs.

MHS records and endpoints

Every GP Connect system also has one or more “MHS” records (or message handling server record), identified by Party Key and Interaction ID. MHS records of GP Connect provider systems contain the endpoint of the target practice, as defined by the FHIR service root URL. Please see System topologies for more details on the allocation of ASIDs and Party Keys.

API status

This API is in alpha, meaning:

  • the API is available in our sandbox and integration test environments.
  • the API is not yet available for production use.
  • we might make breaking changes.

To see our roadmap, or to suggest, comment or vote on features for this API, see our interactive product backlog.

If you have any other queries, please contact us.

Technology

This API is RESTful.

It also conforms to the FHIR global standard for health care data exchange.Specifically, it is aligned with FHIR UK Core, which is built on FHIR Release 4. You don’t need to know much about FHIR to use this API - FHIR APIs are just RESTful APIs that follow specific rules. In particular:

  • resource names are capitalised and singular, for example /Endpoint not /endpoints

Errors handling in this API follows NHS guidelines and produces an OperationOutcome FHIR resource response with appropriate HTTP code

Network access

This API is available on the internet and, indirectly, on the Health and Social Care Network (HSCN).

For more details see Network access for APIs.

Security and Authorisation

This API uses the Application-restricted pattern.

In this pattern, you authenticate your application by including an API key with each API request. The API key is unique to your application.

For more details, including detailed technical integration instructions, see Security and Authorisation - Application-restricted RESTful APIs - API key authentication page within the NHS Digital Portal.

Environments and testing

Environment Base URL
Sandbox https://sandbox.api.service.nhs.uk/spine-directory/
Integration test https://int.api.service.nhs.uk/spine-directory/

Sandbox testing

Our sandbox environment:

  • is for early developer testing
  • only covers a limited set of scenarios
  • is open-access, so does not allow you to test authorisation

For more details on sandbox testing, or to try out the sandbox using our "Try this API" feature, see the documentation for each endpoint.

Integration testing

Our integration test environment:

  • is for formal integration testing.
  • includes application authentication

Data

The data used will be dependant on the service you are trying to access. See Spine Services and Interaction IDs

For more details see integration testing with our RESTful APIs.

Related APIs

The following APIs are related to this one:

Legal Use

This API can only be used where there is a legal basis to do so. Make sure you have a valid use case before you go too far with your development.

You must do this before you can go live (see ‘Onboarding’ below).

Onboarding

You need to get your software approved by us before it can go live with this API. We call this onboarding. The onboarding process can sometimes be quite long, so it’s worth planning well ahead. This API is not yet available for onboarding.

Endpoint: Default

Get accredited system details

get

/Device

Overview

Use this endpoint to get accredited systems information in SDS.

This endpoint should return all matching accredited system objects which provides the following information:

  • Accredited System Identifier
  • Managing Organisation Code
  • Client Code
  • Party Key
  • Service-Interactions

To get the information, you must supply:

  • organisation code
  • service identifier and may supply:
  • managing organization identifier
  • party key


Request

Query parameters

Name Description
organization
String
The organisation code for the NHS Spine instance that your Message Handling System is communicating with. Must be preceded with FHIR identifier (eg."organization=https://fhir.nhs.uk/Id/ods-organization-code|YES-0000806")
Required
identifier
array[String]
The service that is being contacted and the action that is required. Additionally optional MHS party key. Must be preceded with FHIR identifier (eg."identifier=https://fhir.nhs.uk/Id/nhsEndpointServiceId|urn:nhs:names:services:psis:REPC_IN150016UK05" or "identifier=https://fhir.nhs.uk/Id/nhsMhsPartyKey|YES-0000806"). See the Data section in this API Specification document for more information.
Required
managing-organization
String
Manufacturer's organisation code - ODS code of the manufacturer's organisation (i.e. GP System supplier)

Headers

Name Description
X-Correlation-Id
UUID (uuid)
UUID for request tracking

Response

HTTP status: 200

One or more accredited systems were found that match the search criteria.

Body

Content type: application/fhir+json
Example
{
  "resourceType" : "Bundle",
  "id" : "2A87F0F9-065E-42A5-98D0-51E060BB7B12",
  "type" : "searchset",
  "total" : 1,
  "link" : [ {
    "relation" : "self",
    "url" : "https://api.service.nhs.uk/spine-directory-service/Device?organization=https://fhir.nhs.uk/Id/ods-organization-code|R8008&identifier=https://fhir.nhs.uk/Id/nhsEndpointServiceId|urn:nhs:names:services:psis:REPC_IN150016UK05&identifier=https://fhir.nhs.uk/Id/nhsMhsPartyKey|R8008-0000806"
  } ],
  "entry" : [ {
    "fullUrl" : "https://api.service.nhs.uk/spine-directory-service/Device/F0F0E921-92CA-4A88-A550-2DBB36F703AF",
    "resource" : {
      "resourceType" : "Device",
      "id" : "F0F0E921-92CA-4A88-A550-2DBB36F703AF",
      "extension" : [ {
        "url" : "https://fhir.nhs.uk/R4/StructureDefinition/Extension-SDS-ReliabilityConfiguration",
        "valueReference" : {
          "identifier" : {
            "system" : "https://fhir.nhs.uk/Id/ods-organization-code",
            "value" : "T10101"
          }
        }
      } ],
      "identifier" : [ {
        "system" : "https://fhir.nhs.uk/Id/nhsSpineASID",
        "value" : "227319907548"
      }, {
        "system" : "https://fhir.nhs.uk/Id/nhsMhsPartyKey",
        "value" : "R8008-0000806"
      }, {
        "system" : "https://fhir.nhs.uk/Id/nhsEndpointServiceId",
        "value" : "urn:nhs:names:services:psis:REPC_IN150016UK05"
      } ],
      "owner" : {
        "identifier" : {
          "system" : "https://fhir.nhs.uk/Id/ods-organization-code",
          "value" : "R8008"
        }
      }
    }
  } ]
}
Schema
Name Description
object
resourceType
string
Default: Bundle
id
string uuid
Unique identifier for this search request.
type
string
Default: searchset
total
integer
link
array
object
relation
string
Default: self
url
string
The full url that produced the data
entry
array
object
fullUrl
string
Full url of the resource
resource
object
A FHIR Device resource information for the accredited system
resourceType
string
Default: Device
id
string uuid
SDS’s unique identifier for this accredited system record.
Example: f0f0e921-92ca-4a88-a550-2dbb36f703af
extension
array
Additional content defined by implementations
object
url
string
valueReference
object
identifier
object
system
string
value
string
identifier
array
Identifies this device across multiple systems
object
system
string
value
string
owner
object
Manufacturer's organisation details
identifier
object
system
string
value
string
display
string

HTTP status: 400

Missing or invalid query parameter(s).

HTTP status: 404

Invalid endpoint path

HTTP status: 405

Unsupported HTTP method. For this endpoint only GET is available

HTTP status: 406

Unsupported media type

HTTP status: 500

Unhandled internal server error

HTTP status: 502

Upstream LDAP returned an unsupported responses

HTTP status: 504

Upstream LDAP server request has timed out

Get routing and reliability details

get

/Endpoint

Overview

Use this endpoint to get accredited systems routing and reliability information in SDS.

This endpoint should return all matching routing and reliability objects which provides the following information:

  • Endpoint Service ID
  • Message Handling System Party Key
  • Accredited System ID
  • Endpoint URL
  • Fully Qualified Domain Name of the Message Handling System

To get the information, you must supply:

  • organisation code
  • service identifier


Request

Query parameters

Name Description
organization
String
The organisation code for the NHS Spine instance that your Message Handling System is communicating with. Must be preceded with FHIR identifier (eg."organization=https://fhir.nhs.uk/Id/ods-organization-code|YES-0000806")
Required
identifier
String
The service that is being contacted and the action that is required or the MHS party key or both in separate parameters. Must be preceded with FHIR identifier (eg."identifier=https://fhir.nhs.uk/Id/nhsEndpointServiceId|urn:nhs:names:services:psis:REPC_IN150016UK05" or "identifier=https://fhir.nhs.uk/Id/nhsMhsPartyKey|YES-0000806"). See the Data section in this API Specification document for more information.
Required

Headers

Name Description
X-Correlation-Id
UUID (uuid)
UUID for request tracking

Response

HTTP status: 200

One or more accredited systems were found that match the search criteria.

Body

Content type: application/fhir+json
Example
{
  "resourceType" : "Bundle",
  "id" : "2A87F0F9-065E-42A5-98D0-51E060BB7B12",
  "type" : "searchset",
  "total" : 1,
  "link" : [ {
    "relation" : "self",
    "url" : "https://api.service.nhs.uk/spine-directory-service/Endpoint?organization=https://fhir.nhs.uk/Id/ods-organization-code|R8008&identifier=https://fhir.nhs.uk/Id/nhsEndpointServiceId|urn:nhs:names:services:psis:REPC_IN150016UK05&identifier=https://fhir.nhs.uk/Id/nhsMhsPartyKey|R8008-0000806"
  } ],
  "entry" : [ {
    "fullUrl" : "https://api.service.nhs.uk/spine-directory-service/Endpoint/F0F0E921-92CA-4A88-A550-2DBB36F703AF",
    "resource" : {
      "resourceType" : "Endpoint",
      "id" : "F0F0E921-92CA-4A88-A550-2DBB36F703AF",
      "extension" : [ {
        "url" : "https://fhir.nhs.uk/R4/StructureDefinition/Extension-SDS-ReliabilityConfiguration",
        "extension" : [ {
          "url" : "nhsMHSSyncReplyMode",
          "valueString" : "MSHSignalsOnly"
        }, {
          "url" : "nhsMHSRetryInterval",
          "valueString" : "PT1M"
        }, {
          "url" : "nhsMHSRetries",
          "valueInteger" : 2
        }, {
          "url" : "nhsMHSPersistDuration",
          "valueString" : "PT5M"
        }, {
          "url" : "nhsMHSDuplicateElimination",
          "valueString" : "always"
        }, {
          "url" : "nhsMHSAckRequested",
          "valueString" : "always"
        } ]
      } ],
      "identifier" : [ {
        "system" : "https://fhir.nhs.uk/Id/nhsEndpointServiceId",
        "value" : "urn:nhs:names:services:psis:REPC_IN150016UK05"
      }, {
        "system" : "https://fhir.nhs.uk/Id/nhsMhsFQDN",
        "value" : "msg.opentest.hscic.gov.uk"
      }, {
        "system" : "https://fhir.nhs.uk/Id/nhsMhsPartyKey",
        "value" : "R8008-0000806"
      }, {
        "system" : "https://fhir.nhs.uk/Id/nhsMhsCPAId",
        "value" : "S20001A000182"
      }, {
        "system" : "https://fhir.nhs.uk/Id/nhsSpineMHS",
        "value" : "227319907548"
      } ],
      "status" : "active",
      "connectionType" : {
        "system" : "http://terminology.hl7.org/CodeSystem/endpoint-connection-type",
        "code" : "hl7-fhir-msg",
        "display" : "HL7 FHIR Messaging"
      },
      "managingOrganization" : {
        "identifier" : {
          "system" : "https://fhir.nhs.uk/Id/ods-organization-code",
          "value" : "R8008"
        }
      },
      "payloadType" : [ {
        "coding" : [ {
          "system" : "http://terminology.hl7.org/CodeSystem/endpoint-payload-type",
          "code" : "any",
          "display" : "Any"
        } ]
      } ],
      "address" : "https://msg.opentest.hscic.gov.uk/reliablemessaging/reliablerequest"
    }
  } ]
}
Schema
Name Description
object
A FHIR Bundle with Endpoint resources
resourceType
string
Default: Bundle
id
string uuid
Unique identifier for this search request.
type
string
Default: searchset
total
integer
link
array
object
relation
string
Default: self
url
string
The full url that produced the data
entry
array
object
fullUrl
string
Full url of the resource
resource
object
A FHIR Enpoint resource that include routing and reliability information for the accredited system
resourceType
string
Default: Endpoint
id
string uuid
SDS’s unique identifier for this accredited system record.
extension
array
Additional content defined by implementations
object
url
string
extension
array
object
url
string
valueString
string
identifier
array
Identifies this endpoint across multiple systems
object
system
string
value
string
status
string
Allowed values: active
Default: active
connectionType
object
Protocol/Profile/Standard to be used with this endpoint connection
system
string
code
string
display
string
managingOrganization
object
Organization that manages this endpoint (might not be the organization that exposes the endpoint)
identifier
object
system
string
value
string
payloadType
array
The type of content that may be used at this endpoint (e.g. XDS Discharge summaries)
object
coding
array
object
system
string
code
string
display
string
address
string
The base URL for connecting to this endpoint

HTTP status: 400

Missing or invalid query parameter(s).

HTTP status: 404

Invalid endpoint path

HTTP status: 405

Unsupported HTTP method. For this endpoint only GET is available

HTTP status: 406

Unsupported media type

HTTP status: 500

Unhandled internal server error

HTTP status: 502

Upstream LDAP returned an unsupported responses

HTTP status: 504

Upstream LDAP server request has timed out