Skip to main content
POST
Create Referral
Referrals are created in the provider’s EMR using an asynchronous processing model. Creating a referral this way is not instantaneous. Instead of leaving your POST request hanging until completion, we immediately return a success response if the request is properly formed. We then notify you via a webhook when the referral has been created in the EMR. This gives you flexibility around your user experience. For example, when you first make the /referrals call you can display a Processing status to your user, and when you receive the webhook notification you can update that to Completed.
Creating referrals is currently supported for eClinicalWorks.

Request Parameters

Required Fields

  • patient_mrn (string, required): The patient’s medical record number. The patient must already be synced to Cobalt.
  • referring_from_provider_ehr_id (string, required): EMR ID of the provider the referral is coming from.
  • referring_to_provider_ehr_id (string, required): EMR ID of the provider the referral is going to.
  • direction (string, required): Direction of the referral — incoming or outgoing.
  • priority (string, required): Referral priority — routine, urgent, or stat.
  • reason (string, required): Reason for the referral.

Optional Fields

  • diagnosis_codes (array of strings, optional): ICD-10 diagnosis codes associated with the referral.
  • documents (array, optional): Documents to attach to the referral in the EMR. Each entry is an object with filename and content_base64. See Attaching Documents below.

Direction and Provider Validation

The two provider IDs are validated against different directories depending on the referral’s direction: Pass 0 for a provider ID when there is no provider on that side. Providers must already be synced — use GET /v1/providers and GET /v1/referring-providers to resolve IDs.

Attaching Documents

Documents are optional and supplied inline as base64. Each document is an object:
  • filename must include a file extension (e.g. report.pdf).
  • content_base64 must be non-empty, valid base64.
Documents are attached to the referral in the EMR after the referral itself is created. Because the referral already exists at that point, attachment failures are non-fatal: the referral is still created and the webhook reports how many attachments succeeded and failed.
Requests carrying inline documents can be large. The POST /v1/referrals endpoint accepts request bodies up to 25 MB.

Example Request

Request with Documents

Example Response

The response includes:
  • referral_id: Cobalt referral ID (UUID without dashes). This is echoed back in the webhook payload so you can correlate the two.
  • job_id: Job execution identifier for tracking the async operation.

Error Responses

Missing Required Field

Invalid Priority

Invalid Direction

Invalid Document

Patient Not Found

Unknown Provider

User Not Found

This indicates an issue with your access token.

Webhook Notifications

When the referral has finished processing, we send a webhook to your registered endpoint.

Success

Note: documents_attached and documents_failed are only included when the request contained documents.

Failure

Authorizations

client_id
string
header
required
client_secret
string
header
required
access_token
string
header
required

Body

application/json
patient_mrn
string
required

The patient's medical record number. The patient must already be synced to Cobalt.

referring_from_provider_ehr_id
string
required

EMR ID of the provider the referral is coming from. For incoming referrals this is validated against the referring providers directory; for outgoing referrals it is validated against the providers directory. Pass 0 if there is no provider on this side.

referring_to_provider_ehr_id
string
required

EMR ID of the provider the referral is going to. For incoming referrals this is validated against the providers directory; for outgoing referrals it is validated against the referring providers directory. Pass 0 if there is no provider on this side.

direction
enum<string>
required

Direction of the referral. incoming means the referral is coming into your organization; outgoing means it is being sent out.

Available options:
incoming,
outgoing
priority
enum<string>
required

Referral priority.

Available options:
routine,
urgent,
stat
reason
string
required

Reason for the referral.

diagnosis_codes
string[]

Optional ICD-10 diagnosis codes associated with the referral.

documents
object[]

Optional documents to attach to the referral in the EMR. Each entry is supplied inline as base64. Document attachment happens after the referral is created and attachment failures are non-fatal.

Response

Referral queued successfully

success
boolean
message
string
Example:

"Referral queued for creation. A webhook event will be sent upon completion."

referral_id
string

Cobalt referral ID (UUID without dashes). Echoed back in the webhook payload.

job_id
integer

Job execution identifier for tracking the async operation.