Create Service
Queues a service (an episode visit with form documentation) for creation in the provider’s EMR system.
/services call you can display a Processing status to your user, and when you receive the webhook notification you can update that to Completed.
How a service is created
Processing a service runs an ordered chain against the EMR:- Team to episode — the patient is assigned to the given
team. When the client has no open episode under that team, the assignment opens one. An existing episode is reused. - Service type — the
service_typeis resolved against the client’s live billing matrix. A service type that is not billable for the client fails the service (see Failure). - Form documentation — the
answersyou supply are validated against the synced form definition (form_id) and written on the service. For a scored questionnaire, per-question scores are entered and totals and risk bands are derived by the EMR. - Read-back — after signing, the service 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. For Credible this is the client id. The patient must already be synced to Cobalt.
- team (string, required): Team name (or numeric team id) that owns the episode. Assigning the client to the team opens the episode when one does not already exist. The name is matched case-insensitively, preferring an exact match over a partial one.
- service_type (string, required): The service 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_idof a form fromGET /v1/forms. Required when the service type documents a form. - answers (object, required): Form answers keyed by EMR question id (the
emrQuestionIdof each question in the form definition — seeGET /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 service is written.
Optional Fields
- service_date (string, optional): Service date in
YYYY-MM-DDformat. Defaults to today. Cannot be in the future. - callback_urls (array of strings, optional): URLs to receive the completion webhook for this service, in addition to your account webhook.
Example Request
Example Response
- service_id: Cobalt service 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 Service Date
User Not Found
Unsupported EMR
Webhook Notifications
When the service has finished processing, we send a webhook to your registered endpoint.Success
- service_id: The Cobalt service ID you received in the response.
- emr_service_id: The service’s id in the EMR.
- emr_episode_id: The episode the service was written under (reused if one was already open, otherwise the episode opened by the team assignment).
- patient_mrn: The patient’s medical record number.
Failure
service.failed event is sent once, when the failure is permanent. Common failure_reason values:
Credible team '<team>' not found for client <mrn>— the team name or id did not match a team the client can be assigned to.Service type '<type>' not available for client <mrn> (not in billing matrix)— the service type is not billable for the client.Missing required answers: <question ids>— one or more required form questions were not answered.
Authorizations
Body
The patient's medical record number (for Credible, the client id). The patient must already be synced to Cobalt.
"1234567"
Team name (or numeric team id) that owns the episode. Assigning the client to the team opens the episode when one does not already exist.
"Adult Outpatient"
Service type to add, by name or numeric visit-type id (e.g. "GAD-7"). Must be billable for the client (present in the client's billing matrix).
"GAD-7"
EMR form id whose answers are provided. Required when the service type documents a form.
"392"
Form answers keyed by EMR question id. For a scored questionnaire provide the numeric score for each scored question; totals and risk bands are derived automatically. Validated against the synced form definition.
Service date (YYYY-MM-DD). Defaults to today. Cannot be in the future.
"2026-08-26"
URLs to receive the completion webhook for this service, in addition to the account webhook.
Response
Service queued successfully