curl --request POST \
--url https://api.usecobalt.com/v1/telephone-encounters \
--header 'Content-Type: application/json' \
--header 'access_token: <api-key>' \
--header 'client_id: <api-key>' \
--header 'client_secret: <api-key>' \
--data '
{
"patient_mrn": "12345",
"provider_id": "provider-123",
"location_id": "location-1",
"assigned_to_id": "staff-123",
"reason": "Medication refill",
"refill_medication_name": "Lisinopril 10mg",
"pharmacy_ehr_id": "PHARM-123",
"caller": "Jane Doe (patient)",
"message": "Patient requests a refill of their blood pressure medication.",
"is_high_priority": "false",
"callback_urls": [
"https://example.com/webhooks/cobalt"
]
}
'import requests
url = "https://api.usecobalt.com/v1/telephone-encounters"
payload = {
"patient_mrn": "12345",
"provider_id": "provider-123",
"location_id": "location-1",
"assigned_to_id": "staff-123",
"reason": "Medication refill",
"refill_medication_name": "Lisinopril 10mg",
"pharmacy_ehr_id": "PHARM-123",
"caller": "Jane Doe (patient)",
"message": "Patient requests a refill of their blood pressure medication.",
"is_high_priority": "false",
"callback_urls": ["https://example.com/webhooks/cobalt"]
}
headers = {
"client_id": "<api-key>",
"client_secret": "<api-key>",
"access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
client_id: '<api-key>',
client_secret: '<api-key>',
access_token: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
patient_mrn: '12345',
provider_id: 'provider-123',
location_id: 'location-1',
assigned_to_id: 'staff-123',
reason: 'Medication refill',
refill_medication_name: 'Lisinopril 10mg',
pharmacy_ehr_id: 'PHARM-123',
caller: 'Jane Doe (patient)',
message: 'Patient requests a refill of their blood pressure medication.',
is_high_priority: 'false',
callback_urls: ['https://example.com/webhooks/cobalt']
})
};
fetch('https://api.usecobalt.com/v1/telephone-encounters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.usecobalt.com/v1/telephone-encounters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'patient_mrn' => '12345',
'provider_id' => 'provider-123',
'location_id' => 'location-1',
'assigned_to_id' => 'staff-123',
'reason' => 'Medication refill',
'refill_medication_name' => 'Lisinopril 10mg',
'pharmacy_ehr_id' => 'PHARM-123',
'caller' => 'Jane Doe (patient)',
'message' => 'Patient requests a refill of their blood pressure medication.',
'is_high_priority' => 'false',
'callback_urls' => [
'https://example.com/webhooks/cobalt'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"access_token: <api-key>",
"client_id: <api-key>",
"client_secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.usecobalt.com/v1/telephone-encounters"
payload := strings.NewReader("{\n \"patient_mrn\": \"12345\",\n \"provider_id\": \"provider-123\",\n \"location_id\": \"location-1\",\n \"assigned_to_id\": \"staff-123\",\n \"reason\": \"Medication refill\",\n \"refill_medication_name\": \"Lisinopril 10mg\",\n \"pharmacy_ehr_id\": \"PHARM-123\",\n \"caller\": \"Jane Doe (patient)\",\n \"message\": \"Patient requests a refill of their blood pressure medication.\",\n \"is_high_priority\": \"false\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client_id", "<api-key>")
req.Header.Add("client_secret", "<api-key>")
req.Header.Add("access_token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.usecobalt.com/v1/telephone-encounters")
.header("client_id", "<api-key>")
.header("client_secret", "<api-key>")
.header("access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"patient_mrn\": \"12345\",\n \"provider_id\": \"provider-123\",\n \"location_id\": \"location-1\",\n \"assigned_to_id\": \"staff-123\",\n \"reason\": \"Medication refill\",\n \"refill_medication_name\": \"Lisinopril 10mg\",\n \"pharmacy_ehr_id\": \"PHARM-123\",\n \"caller\": \"Jane Doe (patient)\",\n \"message\": \"Patient requests a refill of their blood pressure medication.\",\n \"is_high_priority\": \"false\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usecobalt.com/v1/telephone-encounters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client_id"] = '<api-key>'
request["client_secret"] = '<api-key>'
request["access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"patient_mrn\": \"12345\",\n \"provider_id\": \"provider-123\",\n \"location_id\": \"location-1\",\n \"assigned_to_id\": \"staff-123\",\n \"reason\": \"Medication refill\",\n \"refill_medication_name\": \"Lisinopril 10mg\",\n \"pharmacy_ehr_id\": \"PHARM-123\",\n \"caller\": \"Jane Doe (patient)\",\n \"message\": \"Patient requests a refill of their blood pressure medication.\",\n \"is_high_priority\": \"false\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"telephone_encounter_id": "<string>",
"job_id": "<string>"
}{
"success": false,
"message": "<string>"
}{
"success": false,
"message": "<string>"
}{
"success": false,
"message": "<string>"
}Create Telephone Encounter
Creates a telephone encounter record in the provider’s EMR system.
curl --request POST \
--url https://api.usecobalt.com/v1/telephone-encounters \
--header 'Content-Type: application/json' \
--header 'access_token: <api-key>' \
--header 'client_id: <api-key>' \
--header 'client_secret: <api-key>' \
--data '
{
"patient_mrn": "12345",
"provider_id": "provider-123",
"location_id": "location-1",
"assigned_to_id": "staff-123",
"reason": "Medication refill",
"refill_medication_name": "Lisinopril 10mg",
"pharmacy_ehr_id": "PHARM-123",
"caller": "Jane Doe (patient)",
"message": "Patient requests a refill of their blood pressure medication.",
"is_high_priority": "false",
"callback_urls": [
"https://example.com/webhooks/cobalt"
]
}
'import requests
url = "https://api.usecobalt.com/v1/telephone-encounters"
payload = {
"patient_mrn": "12345",
"provider_id": "provider-123",
"location_id": "location-1",
"assigned_to_id": "staff-123",
"reason": "Medication refill",
"refill_medication_name": "Lisinopril 10mg",
"pharmacy_ehr_id": "PHARM-123",
"caller": "Jane Doe (patient)",
"message": "Patient requests a refill of their blood pressure medication.",
"is_high_priority": "false",
"callback_urls": ["https://example.com/webhooks/cobalt"]
}
headers = {
"client_id": "<api-key>",
"client_secret": "<api-key>",
"access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
client_id: '<api-key>',
client_secret: '<api-key>',
access_token: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
patient_mrn: '12345',
provider_id: 'provider-123',
location_id: 'location-1',
assigned_to_id: 'staff-123',
reason: 'Medication refill',
refill_medication_name: 'Lisinopril 10mg',
pharmacy_ehr_id: 'PHARM-123',
caller: 'Jane Doe (patient)',
message: 'Patient requests a refill of their blood pressure medication.',
is_high_priority: 'false',
callback_urls: ['https://example.com/webhooks/cobalt']
})
};
fetch('https://api.usecobalt.com/v1/telephone-encounters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.usecobalt.com/v1/telephone-encounters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'patient_mrn' => '12345',
'provider_id' => 'provider-123',
'location_id' => 'location-1',
'assigned_to_id' => 'staff-123',
'reason' => 'Medication refill',
'refill_medication_name' => 'Lisinopril 10mg',
'pharmacy_ehr_id' => 'PHARM-123',
'caller' => 'Jane Doe (patient)',
'message' => 'Patient requests a refill of their blood pressure medication.',
'is_high_priority' => 'false',
'callback_urls' => [
'https://example.com/webhooks/cobalt'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"access_token: <api-key>",
"client_id: <api-key>",
"client_secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.usecobalt.com/v1/telephone-encounters"
payload := strings.NewReader("{\n \"patient_mrn\": \"12345\",\n \"provider_id\": \"provider-123\",\n \"location_id\": \"location-1\",\n \"assigned_to_id\": \"staff-123\",\n \"reason\": \"Medication refill\",\n \"refill_medication_name\": \"Lisinopril 10mg\",\n \"pharmacy_ehr_id\": \"PHARM-123\",\n \"caller\": \"Jane Doe (patient)\",\n \"message\": \"Patient requests a refill of their blood pressure medication.\",\n \"is_high_priority\": \"false\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client_id", "<api-key>")
req.Header.Add("client_secret", "<api-key>")
req.Header.Add("access_token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.usecobalt.com/v1/telephone-encounters")
.header("client_id", "<api-key>")
.header("client_secret", "<api-key>")
.header("access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"patient_mrn\": \"12345\",\n \"provider_id\": \"provider-123\",\n \"location_id\": \"location-1\",\n \"assigned_to_id\": \"staff-123\",\n \"reason\": \"Medication refill\",\n \"refill_medication_name\": \"Lisinopril 10mg\",\n \"pharmacy_ehr_id\": \"PHARM-123\",\n \"caller\": \"Jane Doe (patient)\",\n \"message\": \"Patient requests a refill of their blood pressure medication.\",\n \"is_high_priority\": \"false\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usecobalt.com/v1/telephone-encounters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client_id"] = '<api-key>'
request["client_secret"] = '<api-key>'
request["access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"patient_mrn\": \"12345\",\n \"provider_id\": \"provider-123\",\n \"location_id\": \"location-1\",\n \"assigned_to_id\": \"staff-123\",\n \"reason\": \"Medication refill\",\n \"refill_medication_name\": \"Lisinopril 10mg\",\n \"pharmacy_ehr_id\": \"PHARM-123\",\n \"caller\": \"Jane Doe (patient)\",\n \"message\": \"Patient requests a refill of their blood pressure medication.\",\n \"is_high_priority\": \"false\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"telephone_encounter_id": "<string>",
"job_id": "<string>"
}{
"success": false,
"message": "<string>"
}{
"success": false,
"message": "<string>"
}{
"success": false,
"message": "<string>"
}/telephone-encounters call you can display a Processing status to your user and when you get the webhook notification you can update that to Completed.
Request Parameters
Required Fields
- patient_mrn (string, required): Patient’s Medical Record Number
- provider_id (string, required): Provider’s EMR ID
- location_id (string, required): Location’s EMR ID
- assigned_to_id (string, required): EMR user ID of the staff member the encounter is assigned to. This can be any staff member in your organization (provider, nurse, front desk), not just providers. Valid IDs are the
ehr_idvalues in thestaff_listfield returned byGET /v1/settings.
Optional Fields
- reason (string, optional, max 50 characters): Reason for telephone encounter
- refill_medication_name (string, optional, 2-50 characters): Name of medication to refill. If provided, the system will search for a matching medication in the patient’s available refillable medications and add it to the encounter. The medication name is matched case-insensitively and supports partial matches.
- pharmacy_ehr_id (string, optional): Pharmacy’s EMR ID. If provided, the pharmacy must exist in your organization’s pharmacy list (validate via GET /v1/pharmacies). When used with a medication refill, the pharmacy will be associated with the encounter. If the pharmacy is not already in the patient’s pharmacy list, it will be added automatically.
- caller (string, optional, max 100 characters): Name of the person who called
- message (string, optional): Message content from the caller
- is_high_priority (string, optional): Whether this encounter should be marked as high priority. Must be “true” or “false”.
- template_name (string, optional): The template name to use when filling out the document upload form.
Medication Refill Behavior
Whenrefill_medication_name is provided:
- Medication Search: The system searches the patient’s available medications for a match
- Filtering: Only refillable medications that are available for the patient are considered
- Matching: Medication names are matched case-insensitively with partial name support
- Success: If found, the encounter is created and the medication refill is added to it
- Failure: If the medication is not found, the encounter is NOT created and an error is returned with a list of available medications
Example Request
Basic Request
curl -X POST https://api.usecobalt.com/v1/telephone-encounters \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
"patient_mrn": "MRN-123456",
"provider_id": "12241",
"location_id": "25",
"assigned_to_id": "12220",
"reason": "Follow up on test results"
}'
Request with Medication Refill
curl -X POST https://api.usecobalt.com/v1/telephone-encounters \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
"patient_mrn": "MRN-123456",
"provider_id": "12241",
"location_id": "25",
"assigned_to_id": "12220",
"reason": "Prescription refill",
"refill_medication_name": "Lisinopril",
"pharmacy_ehr_id": "1643"
}'
Example Response
{
"success": true,
"message": "Telephone encounter processing. A webhook event will be sent upon completion.",
"telephone_encounter_id": "123e4567e89b12d3a456426614174000",
"job_id": 12345
}
- telephone_encounter_id: Unique identifier for the created telephone encounter record
- job_id: Job execution identifier for tracking the async operation
Error Responses
Missing Required Field
{
"success": false,
"message": "Missing required field: patient_mrn"
}
patient_mrn, provider_id, location_id, assigned_to_id
Reason Too Long
{
"success": false,
"message": "Reason exceeds maximum length of 50 characters"
}
Medication Name Invalid Length
{
"success": false,
"message": "refill_medication_name must be at least 2 characters"
}
{
"success": false,
"message": "refill_medication_name exceeds maximum length of 50 characters"
}
Provider Not Found
{
"success": false,
"message": "Provider with EMR ID '99999' not found."
}
provider_id doesn’t exist in the providers table. Sync providers using GET /v1/providers.
Staff Member Not Found
{
"success": false,
"message": "Staff member with ID '99999' not found."
}
assigned_to_id doesn’t exist in the staff list. Valid staff IDs are the ehr_id values in the staff_list field returned by GET /v1/settings.
Location Not Found
{
"success": false,
"message": "Location with EMR ID '99999' not found."
}
GET /v1/locations to resolve this error.
Pharmacy Not Found
{
"success": false,
"message": "Pharmacy with EMR ID '99999' not found."
}
pharmacy_ehr_id is present but no corresponding pharmacy can be found. Call GET /v1/pharmacies to see what available pharmacies there are.
User Not Found
{
"success": false,
"message": "User not found."
}
Unsupported EMR
{
"success": false,
"message": "Telephone encounters are only supported for [EMR Name] EMR."
}
Webhook Notifications
When the telephone encounter processing is complete, we will send a webhook to your registered endpoint. Here are examples of what those webhook payloads will look like:Success
{
"id": "<id-of-webhook-response>",
"access_token_reference_id": "<access-token-reference-id>",
"object": "event",
"created": "2025-10-27T10:30:00Z",
"type": "telephone_encounter.created",
"job_id": "12345",
"data": {
"telephone_encounter_id": "123e4567e89b12d3a456426614174000",
"emr_encounter_id": "ECW-98765",
"patient_mrn": "MRN-123456",
"provider_id": "12241",
"location_id": "25",
"assigned_to_id": "12220",
"reason": "Follow up on test results",
"refill_medication_name": "Lisinopril 10 MG"
}
}
refill_medication_name will be included in the webhook data if a medication refill was requested and successfully added.
Partial Success
When the encounter is created successfully but the medication refill fails to be added, a partial success webhook is sent:{
"id": "<id-of-webhook-response>",
"access_token_reference_id": "<access-token-reference-id>",
"object": "event",
"created": "2025-10-27T10:35:00Z",
"type": "telephone_encounter.created_partial",
"job_id": "12345",
"data": {
"telephone_encounter_id": "123e4567e89b12d3a456426614174000",
"emr_encounter_id": "ECW-98765",
"patient_mrn": "MRN-123456",
"provider_id": "12241",
"location_id": "25",
"assigned_to_id": "12220",
"reason": "Prescription refill",
"refill_medication_name": "Lisinopril",
"refill_failure_reason": "Failed to add medication refill: Timeout error"
}
}
telephone_encounter.created_partial event indicates that the encounter was successfully created in the EMR, but the requested medication refill could not be added. The encounter exists and is usable, but the refill will need to be added manually.
Failure
General Failure
{
"id": "<id-of-webhook-response>",
"access_token_reference_id": "<access-token-reference-id>",
"object": "event",
"created": "2025-10-27T10:35:00Z",
"type": "telephone_encounter.failed",
"job_id": "12345",
"data": {
"telephone_encounter_id": "123e4567e89b12d3a456426614174000",
"patient_mrn": "MRN-123456",
"refill_medication_name": null,
"failure_reason": "Failed to create telephone encounter in EMR"
}
}
Medication Not Found Failure
When a medication refill is requested but the medication cannot be found in the patient’s available medications, the encounter is NOT created and a failure webhook is sent with the list of available medications:{
"id": "<id-of-webhook-response>",
"access_token_reference_id": "<access-token-reference-id>",
"object": "event",
"created": "2025-10-27T10:35:00Z",
"type": "telephone_encounter.failed",
"job_id": "12345",
"data": {
"telephone_encounter_id": "123e4567e89b12d3a456426614174000",
"patient_mrn": "MRN-123456",
"refill_medication_name": "Aspirin",
"failure_reason": "Medication \"Aspirin\" not found in available refillable medications. Available medications: [\"Lisinopril 10 MG\",\"Metformin 500 MG\",\"Atorvastatin 20 MG\"]"
}
}
Authorizations
Body
Medical Record Number of the patient the encounter is for.
"12345"
EMR provider ID. Validated against the account’s providers.
"provider-123"
EMR location ID. Validated against the account’s locations.
"location-1"
EMR staff ID to assign the encounter to. Validated against the account’s staff.
"staff-123"
Reason for the encounter (max 50 characters).
"Medication refill"
Medication name for a refill request (2–50 characters).
"Lisinopril 10mg"
EMR pharmacy ID for a refill request.
"PHARM-123"
Who placed the call (max 100 characters).
"Jane Doe (patient)"
Free-text message for the encounter.
"Patient requests a refill of their blood pressure medication."
Whether the encounter is high priority. One of: "true", "false". Defaults to "false".
"false"
URLs to receive the completion webhook for this encounter, in addition to the account webhook.
["https://example.com/webhooks/cobalt"]