Skip to main content
POST/transactional-api/create-inbound-referral

Create Inbound Referral

Atomically creates an inbound referral and a clinical case for the given patient. The referral is always created with ACCEPTED status. If a commissionedServiceId is provided, the case will be included in MHSDS extracts; include reasonForReferral to populate the MHSDS referral reason field.

Authorization: Bearer token (JWT). See Authentication.

Request​

curl -L -X POST 'https://{tenantId}.api.england.medicus.health/transactional-api/create-inbound-referral' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <token>' \
-d '{
"patientId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"receivedDate": "2025-01-15",
"clinicalCaseTypeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"commissionedServiceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"reasonForReferral": "string",
"referringOrganisation": {
"name": "string",
"identifierType": "nhs-england-ods-code",
"identifierValue": "string"
},
"isSelfReferral": true,
"additionalDetails": "string"
}'

Body parameters

FieldTypeRequiredDescription
patientIdstring<uuid>YesMedicus patient identifier. Obtain from the create-patient-record endpoint.
receivedDatestring<date>YesDate the referral was received, in YYYY-MM-DD format.
clinicalCaseTypeIdstring<uuid>YesThe clinical case type to assign. Obtain from the get-inbound-referral-metadata endpoint.
commissionedServiceIdstring<uuid>NoOptional. The commissioned service to link. Required for MHSDS extract rows to populate. Obtain from the get-inbound-referral-metadata endpoint.
reasonForReferralstringNoOptional. The MHSDS referral reason. Only recorded when commissionedServiceId is also provided.
referringOrganisationobjectNoOptional. Details of the organisation that made the referral. Ignored when isSelfReferral is true.
isSelfReferralbooleanNoOptional, defaults to false. Set to true when the patient referred themselves, rather than being referred by an external organisation. referringOrganisation is ignored when this is true.
additionalDetailsstringNoOptional. Free-text additional details for the referral and case.

Responses​

201 Referral and clinical case created successfully.

Response fields

FieldTypeDescription
referralIdstring<uuid>The ID of the created inbound referral.
clinicalCaseIdstring<uuid>The ID of the created clinical case.
{
"referralId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"clinicalCaseId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
400 Validation error.
13 possible code values
CodeDescriptionWhen
missing-patient-idThe patientId is required.patientId is missing or blank
invalid-patient-idThe patientId is not a UUID.patientId present but not a UUID
missing-received-dateThe receivedDate is required.receivedDate is missing or blank
invalid-received-datereceivedDate must be a valid date in YYYY-MM-DD format.receivedDate not a valid YYYY-MM-DD date
missing-clinical-case-type-idThe clinicalCaseTypeId is required.clinicalCaseTypeId is missing or blank
invalid-clinical-case-type-idThe clinicalCaseTypeId is not a UUID.clinicalCaseTypeId present but not a UUID
invalid-commissioned-service-idThe commissionedServiceId is not a UUID.commissionedServiceId present but not a UUID
invalid-reason-for-referralThe reasonForReferral value is not valid.reasonForReferral present but not a recognised value
invalid-referring-organisationreferringOrganisation must be an object.referringOrganisation present but not an object
invalid-referring-organisation-namereferringOrganisation.name must be a string.referringOrganisation.name present but not a string
invalid-organisation-identifier-typeThe referringOrganisation.identifierType value is not valid.referringOrganisation.identifierType present but not a recognised value
invalid-referring-organisation-identifier-valuereferringOrganisation.identifierValue must be a string.referringOrganisation.identifierValue present but not a string
invalid-additional-detailsadditionalDetails must be a string.additionalDetails present but not a string

Response fields

FieldTypeDescription
errors[].codestring
errors[].descriptionstring
{
"errors": [
{
"code": "missing-patient-id",
"description": "The patientId is required."
}
]
}
404 A referenced entity was not found.
3 possible code values
CodeDescriptionWhen
patient-not-foundPatient not found for this patientId.patientId does not match any patient
clinical-case-type-not-foundClinical case type not found for this clinicalCaseTypeId.clinicalCaseTypeId does not match any clinical case type
commissioned-service-not-foundCommissioned service not found for this commissionedServiceId.commissionedServiceId does not match any commissioned service

Response fields

FieldTypeDescription
errors[].codestring
errors[].descriptionstring
{
"errors": [
{
"code": "patient-not-found",
"description": "Patient not found for this patientId."
}
]
}
422 The clinical case type requires a commissioned service.

Response fields

FieldTypeDescription
errors[].codestring
errors[].descriptionstring
{
"errors": [
{
"code": "commissioned-service-required",
"description": "This clinical case type requires a commissionedServiceId."
}
]
}