Skip to main content
POST
Create an encounter
An encounter is an episode visit written to the patient’s chart together with its form documentation (for example a scored questionnaire such as GAD-7). Encounters are created using an asynchronous processing model, so creating one 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 encounter has been written to the EMR. This gives you flexibility around your user experience. For example, when you first make the /encounters call you can display a Processing status to your user, and when you receive the webhook notification you can update that to Completed.

How an encounter is created

Processing an encounter runs an ordered chain against the EMR:
  1. Episode — the encounter is attached to the episode you give in episode_id. There is no fallback to another episode. Assign the patient to a team first, as a separate step, to open the episode.
  2. Encounter type — the encounter_type is resolved against the client’s live billing matrix. An encounter type that is not billable for the client fails the encounter (see Failure).
  3. Form documentation — the answers you supply are validated against the synced form definition (form_id) and written on the encounter. For a scored questionnaire, per-question scores are entered and totals and risk bands are derived by the EMR.
  4. Read-back — after signing, the encounter is re-read from the EMR to confirm it persisted before the success webhook is sent.

Request Parameters

Required Fields

  • patient_mrn (string, required): The patient’s medical record number. The patient must already be synced to Cobalt.
  • episode_id (string, required): The episode the encounter is created under. Use the exact id from the patient episode payload.
  • encounter_type (string, required): The encounter type to add, by name or numeric visit-type id (for example "GAD-7"). Must be billable for the client — that is, present in the client’s billing matrix.
  • form_id (string, required): EMR form id whose answers you are providing — the emr_form_id of a form from GET /v1/forms. Required when the encounter type documents a form.
  • answers (object, required): Form answers keyed by EMR question id (the emrQuestionId of each question in the form definition — see GET /v1/forms/{id}). For a scored questionnaire, provide the numeric score for each scored question; totals and risk bands are derived automatically. Answers are validated against the synced form definition before the encounter is written.

Optional Fields

  • encounter_date (string, optional): Encounter date in YYYY-MM-DD format. Defaults to today. Cannot be in the future.
  • callback_urls (array of strings, optional): URLs to receive the completion webhook for this encounter, in addition to your account webhook.

Example Request

Example Response

The response includes:
  • encounter_id: Cobalt encounter 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

Answers Not An Object

Invalid Encounter Date

User Not Found

This indicates an issue with your access token.

Unsupported EMR

Your EMR system may not currently support encounter creation.

Webhook Notifications

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

Success

The webhook data includes:
  • encounter_id: The Cobalt encounter ID you received in the response.
  • emr_encounter_id: The encounter id in the EMR.
  • emr_episode_id: The episode the encounter was written under.
  • patient_mrn: The patient’s medical record number.

Failure

Transient problems are retried automatically and do not emit a webhook until they are resolved or the attempts are exhausted. A encounter.failed event is sent once, when the failure is permanent. Common failure_reason values:
  • Encounter type '<type>' not available for client <mrn> (not in billing matrix) — the encounter type is not billable for the client.
  • Missing required answers: <question ids> — one or more required form questions were not answered.

Authorizations

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

Body

application/json
patient_mrn
string
required

Medical Record Number (Credible client id) of the patient.

Example:

"15539"

episode_id
string
required

Episode (FHIR EpisodeOfCare) the encounter is created under. Pull the exact id from the patient episode payload and pass it here — the encounter attaches to this episode with no fallback. Assign the patient to a team first (a separate step) to open the episode.

Example:

"32340"

encounter_type
string
required

Encounter type to add, by name or numeric visit-type id (e.g. "GAD-7").

Example:

"GAD-7"

form_id
string
required

EMR form id whose answers are provided (from GET /v1/forms). Required when the encounter type documents a form.

Example:

"392"

answers
object
required

Form answers keyed by EMR question id (from GET /v1/forms). Value by question format: single choice (radio, push button) and dropdown take the answer value or answer id; check box (multi-select) takes a list of answer values or ids; text box takes a string; date takes YYYY-MM-DD. An open-text narrative question takes the text as a string. To add notes to a choice (e.g. "Other"), send { "value": "Other", "notes": "..." }. For a scored questionnaire (e.g. GAD-7) provide the numeric score for each scored question; totals and risk bands are derived automatically. A conditional question (shown only after a trigger answer) is accepted only when its trigger answer is also supplied. An answer that does not match the form fails the request.

Example:
encounter_date
string

Encounter date (YYYY-MM-DD). Defaults to today. Cannot be in the future.

Example:

"2026-08-26"

callback_urls
string[]

URLs to receive the completion webhook for this encounter, in addition to the account webhook.

Response

Encounter queued for processing

success
boolean
required
message
string
required
encounter_id
string
required
job_id
integer
required