Create a task
curl --request POST \
--url https://api.usecobalt.com/v1/tasks \
--header 'Content-Type: application/json' \
--header 'access_token: <api-key>' \
--header 'client_id: <api-key>' \
--header 'client_secret: <api-key>' \
--data '
{
"patient_mrn": "12345",
"description": "Call patient about lab results",
"subject": "Lab results",
"assignee_user_id": "STAFF-123",
"phone_call_type_id": "1",
"notify_list": [
"group-123"
],
"notify_staff_list": [
"<string>"
],
"location_id": "location-1",
"task_type": "Communication",
"details": "Results",
"assigned_to": "STAFF-123",
"facility_id": "FAC-123",
"due_date": "2026-03-20",
"start_date": "2026-03-15",
"priority": "Normal",
"callback_urls": [
"https://example.com/webhooks/cobalt"
],
"expires_at": "2027-06-15T14:30:00Z"
}
'import requests
url = "https://api.usecobalt.com/v1/tasks"
payload = {
"patient_mrn": "12345",
"description": "Call patient about lab results",
"subject": "Lab results",
"assignee_user_id": "STAFF-123",
"phone_call_type_id": "1",
"notify_list": ["group-123"],
"notify_staff_list": ["<string>"],
"location_id": "location-1",
"task_type": "Communication",
"details": "Results",
"assigned_to": "STAFF-123",
"facility_id": "FAC-123",
"due_date": "2026-03-20",
"start_date": "2026-03-15",
"priority": "Normal",
"callback_urls": ["https://example.com/webhooks/cobalt"],
"expires_at": "2027-06-15T14:30:00Z"
}
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',
description: 'Call patient about lab results',
subject: 'Lab results',
assignee_user_id: 'STAFF-123',
phone_call_type_id: '1',
notify_list: ['group-123'],
notify_staff_list: ['<string>'],
location_id: 'location-1',
task_type: 'Communication',
details: 'Results',
assigned_to: 'STAFF-123',
facility_id: 'FAC-123',
due_date: '2026-03-20',
start_date: '2026-03-15',
priority: 'Normal',
callback_urls: ['https://example.com/webhooks/cobalt'],
expires_at: '2027-06-15T14:30:00Z'
})
};
fetch('https://api.usecobalt.com/v1/tasks', 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/tasks",
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',
'description' => 'Call patient about lab results',
'subject' => 'Lab results',
'assignee_user_id' => 'STAFF-123',
'phone_call_type_id' => '1',
'notify_list' => [
'group-123'
],
'notify_staff_list' => [
'<string>'
],
'location_id' => 'location-1',
'task_type' => 'Communication',
'details' => 'Results',
'assigned_to' => 'STAFF-123',
'facility_id' => 'FAC-123',
'due_date' => '2026-03-20',
'start_date' => '2026-03-15',
'priority' => 'Normal',
'callback_urls' => [
'https://example.com/webhooks/cobalt'
],
'expires_at' => '2027-06-15T14:30:00Z'
]),
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/tasks"
payload := strings.NewReader("{\n \"patient_mrn\": \"12345\",\n \"description\": \"Call patient about lab results\",\n \"subject\": \"Lab results\",\n \"assignee_user_id\": \"STAFF-123\",\n \"phone_call_type_id\": \"1\",\n \"notify_list\": [\n \"group-123\"\n ],\n \"notify_staff_list\": [\n \"<string>\"\n ],\n \"location_id\": \"location-1\",\n \"task_type\": \"Communication\",\n \"details\": \"Results\",\n \"assigned_to\": \"STAFF-123\",\n \"facility_id\": \"FAC-123\",\n \"due_date\": \"2026-03-20\",\n \"start_date\": \"2026-03-15\",\n \"priority\": \"Normal\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ],\n \"expires_at\": \"2027-06-15T14:30:00Z\"\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/tasks")
.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 \"description\": \"Call patient about lab results\",\n \"subject\": \"Lab results\",\n \"assignee_user_id\": \"STAFF-123\",\n \"phone_call_type_id\": \"1\",\n \"notify_list\": [\n \"group-123\"\n ],\n \"notify_staff_list\": [\n \"<string>\"\n ],\n \"location_id\": \"location-1\",\n \"task_type\": \"Communication\",\n \"details\": \"Results\",\n \"assigned_to\": \"STAFF-123\",\n \"facility_id\": \"FAC-123\",\n \"due_date\": \"2026-03-20\",\n \"start_date\": \"2026-03-15\",\n \"priority\": \"Normal\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ],\n \"expires_at\": \"2027-06-15T14:30:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usecobalt.com/v1/tasks")
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 \"description\": \"Call patient about lab results\",\n \"subject\": \"Lab results\",\n \"assignee_user_id\": \"STAFF-123\",\n \"phone_call_type_id\": \"1\",\n \"notify_list\": [\n \"group-123\"\n ],\n \"notify_staff_list\": [\n \"<string>\"\n ],\n \"location_id\": \"location-1\",\n \"task_type\": \"Communication\",\n \"details\": \"Results\",\n \"assigned_to\": \"STAFF-123\",\n \"facility_id\": \"FAC-123\",\n \"due_date\": \"2026-03-20\",\n \"start_date\": \"2026-03-15\",\n \"priority\": \"Normal\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ],\n \"expires_at\": \"2027-06-15T14:30:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Task queued for processing.",
"task_id": "task-123",
"job_id": 1
}{
"success": false,
"message": "Bad request — missing or invalid parameters"
}{
"success": false,
"message": "Unauthorized — missing or invalid credentials"
}{
"success": false,
"message": "Internal server error"
}Tasks
Create Task
Creates a task in the provider’s EMR system.
POST
/
tasks
Create a task
curl --request POST \
--url https://api.usecobalt.com/v1/tasks \
--header 'Content-Type: application/json' \
--header 'access_token: <api-key>' \
--header 'client_id: <api-key>' \
--header 'client_secret: <api-key>' \
--data '
{
"patient_mrn": "12345",
"description": "Call patient about lab results",
"subject": "Lab results",
"assignee_user_id": "STAFF-123",
"phone_call_type_id": "1",
"notify_list": [
"group-123"
],
"notify_staff_list": [
"<string>"
],
"location_id": "location-1",
"task_type": "Communication",
"details": "Results",
"assigned_to": "STAFF-123",
"facility_id": "FAC-123",
"due_date": "2026-03-20",
"start_date": "2026-03-15",
"priority": "Normal",
"callback_urls": [
"https://example.com/webhooks/cobalt"
],
"expires_at": "2027-06-15T14:30:00Z"
}
'import requests
url = "https://api.usecobalt.com/v1/tasks"
payload = {
"patient_mrn": "12345",
"description": "Call patient about lab results",
"subject": "Lab results",
"assignee_user_id": "STAFF-123",
"phone_call_type_id": "1",
"notify_list": ["group-123"],
"notify_staff_list": ["<string>"],
"location_id": "location-1",
"task_type": "Communication",
"details": "Results",
"assigned_to": "STAFF-123",
"facility_id": "FAC-123",
"due_date": "2026-03-20",
"start_date": "2026-03-15",
"priority": "Normal",
"callback_urls": ["https://example.com/webhooks/cobalt"],
"expires_at": "2027-06-15T14:30:00Z"
}
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',
description: 'Call patient about lab results',
subject: 'Lab results',
assignee_user_id: 'STAFF-123',
phone_call_type_id: '1',
notify_list: ['group-123'],
notify_staff_list: ['<string>'],
location_id: 'location-1',
task_type: 'Communication',
details: 'Results',
assigned_to: 'STAFF-123',
facility_id: 'FAC-123',
due_date: '2026-03-20',
start_date: '2026-03-15',
priority: 'Normal',
callback_urls: ['https://example.com/webhooks/cobalt'],
expires_at: '2027-06-15T14:30:00Z'
})
};
fetch('https://api.usecobalt.com/v1/tasks', 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/tasks",
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',
'description' => 'Call patient about lab results',
'subject' => 'Lab results',
'assignee_user_id' => 'STAFF-123',
'phone_call_type_id' => '1',
'notify_list' => [
'group-123'
],
'notify_staff_list' => [
'<string>'
],
'location_id' => 'location-1',
'task_type' => 'Communication',
'details' => 'Results',
'assigned_to' => 'STAFF-123',
'facility_id' => 'FAC-123',
'due_date' => '2026-03-20',
'start_date' => '2026-03-15',
'priority' => 'Normal',
'callback_urls' => [
'https://example.com/webhooks/cobalt'
],
'expires_at' => '2027-06-15T14:30:00Z'
]),
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/tasks"
payload := strings.NewReader("{\n \"patient_mrn\": \"12345\",\n \"description\": \"Call patient about lab results\",\n \"subject\": \"Lab results\",\n \"assignee_user_id\": \"STAFF-123\",\n \"phone_call_type_id\": \"1\",\n \"notify_list\": [\n \"group-123\"\n ],\n \"notify_staff_list\": [\n \"<string>\"\n ],\n \"location_id\": \"location-1\",\n \"task_type\": \"Communication\",\n \"details\": \"Results\",\n \"assigned_to\": \"STAFF-123\",\n \"facility_id\": \"FAC-123\",\n \"due_date\": \"2026-03-20\",\n \"start_date\": \"2026-03-15\",\n \"priority\": \"Normal\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ],\n \"expires_at\": \"2027-06-15T14:30:00Z\"\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/tasks")
.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 \"description\": \"Call patient about lab results\",\n \"subject\": \"Lab results\",\n \"assignee_user_id\": \"STAFF-123\",\n \"phone_call_type_id\": \"1\",\n \"notify_list\": [\n \"group-123\"\n ],\n \"notify_staff_list\": [\n \"<string>\"\n ],\n \"location_id\": \"location-1\",\n \"task_type\": \"Communication\",\n \"details\": \"Results\",\n \"assigned_to\": \"STAFF-123\",\n \"facility_id\": \"FAC-123\",\n \"due_date\": \"2026-03-20\",\n \"start_date\": \"2026-03-15\",\n \"priority\": \"Normal\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ],\n \"expires_at\": \"2027-06-15T14:30:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usecobalt.com/v1/tasks")
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 \"description\": \"Call patient about lab results\",\n \"subject\": \"Lab results\",\n \"assignee_user_id\": \"STAFF-123\",\n \"phone_call_type_id\": \"1\",\n \"notify_list\": [\n \"group-123\"\n ],\n \"notify_staff_list\": [\n \"<string>\"\n ],\n \"location_id\": \"location-1\",\n \"task_type\": \"Communication\",\n \"details\": \"Results\",\n \"assigned_to\": \"STAFF-123\",\n \"facility_id\": \"FAC-123\",\n \"due_date\": \"2026-03-20\",\n \"start_date\": \"2026-03-15\",\n \"priority\": \"Normal\",\n \"callback_urls\": [\n \"https://example.com/webhooks/cobalt\"\n ],\n \"expires_at\": \"2027-06-15T14:30:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Task queued for processing.",
"task_id": "task-123",
"job_id": 1
}{
"success": false,
"message": "Bad request — missing or invalid parameters"
}{
"success": false,
"message": "Unauthorized — missing or invalid credentials"
}{
"success": false,
"message": "Internal server error"
}Depending on the EMR system connected to the account, additional fields beyond
the base required fields may be required. If a conditionally required field is
missing, the API will return a
400 error specifying the missing field.Request Parameters
Required Fields
These fields are always required regardless of the connected EMR:- description (string, required): Task description/body content
- patient_mrn (string, required): Medical Record Number (MRN) of the patient
Conditionally Required Fields
Depending on the connected EMR, some combination of the following fields will also be required:- subject (string, conditionally required): Task title/subject line
- assignee_user_id (string, conditionally required): EMR user ID to assign the task to
- phone_call_type_id (string, conditionally required): Identifier for the phone call type
- notify_list (string[], optional): Recipients to notify about the task, using
ehr_idvalues from Get Settings. Wherenotify_staff_listis supported,notify_listtakes groups (fromstaff_groups) andnotify_staff_listtakes people (fromstaff_list). - notify_staff_list (string[], optional): People to notify about the task, using
ehr_idvalues fromstaff_liston Get Settings.
Example Requests
- Example A
- Example B
- Example C
- Example D
curl -X POST https://api.usecobalt.com/v1/tasks \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
"description": "Schedule patient follow-up appointment to review recent lab results and discuss treatment plan.",
"patient_mrn": "MRN-12345",
"subject": "Follow-up appointment needed",
"assignee_user_id": "74196090-5faa-11e9-9562-e12f6a3ce827"
}'
curl -X POST https://api.usecobalt.com/v1/tasks \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
"description": "Patient called requesting prescription refill for lisinopril 10mg.",
"patient_mrn": "MRN-67890",
"phone_call_type_id": "13",
"notify_list": ["3"],
"notify_staff_list": ["116"]
}'
curl -X POST https://api.usecobalt.com/v1/tasks \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{
"description": "Patient reports side effects from new medication; please review.",
"patient_mrn": "MRN-24680",
"task_type": "Prescribe",
"details": "Medication",
"assigned_to": "4840",
"facility_id": "5954",
"due_date": "2026-11-25"
}'
curl -X POST https://api.usecobalt.com/v1/tasks \
-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-13579",
"subject": "Add pharmacy",
"assigned_to": "152925",
"description": "Confirm preferred pharmacy on file.",
"due_date": "2026-11-25",
"start_date": "2026-11-18",
"priority": "Normal"
}'
Example Response
{
"success": true,
"message": "Task processing. A webhook event will be sent upon completion.",
"task_id": "abc123def456789012345678",
"job_id": 12345
}
- task_id: Unique identifier for the created task record
- job_id: Job execution identifier for tracking the async operation
Error Responses
Missing Required Field
If a required or conditionally required field is missing, the API returns a400 with the specific field name:
{
"success": false,
"message": "Missing required field: description"
}
User Not Found
{
"success": false,
"message": "User not found."
}
Webhook Notifications
When the task 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": "evt_1J9X2q2eZvKYlo2CluR9g9gV",
"access_token_reference_id": "user_1J9X2q2eZvKYlo2Cxyz",
"object": "event",
"created": "2025-10-09T10:30:00Z",
"type": "task.created",
"job_id": "12345",
"data": {
"task_id": "abc123def456789012345678",
"emr_task_id": "task_emr_internal_id",
"subject": "Follow-up appointment needed",
"description": "Schedule patient follow-up appointment to review recent lab results and discuss treatment plan.",
"assignee_user_id": "74196090-5faa-11e9-9562-e12f6a3ce827",
"patient_mrn": "MRN-12345"
}
}
Failure
{
"id": "evt_1J9X2q2eZvKYlo2CluR9g9gW",
"access_token_reference_id": "user_1J9X2q2eZvKYlo2Cxyz",
"object": "event",
"created": "2025-10-09T10:35:00Z",
"type": "task.failed",
"job_id": "12345",
"data": {
"task_id": "abc123def456789012345678",
"failure_reason": "Failed to create task"
}
}
Authorizations
Body
application/json
Staff id to assign the task to. For ModMed EMA, a staff id (an ehr_id from GET /v1/staff) or staff-group id (from staff_groups on GET /v1/settings). For eClinicalWorks, the staff EHR id the action is assigned to (an ehr_id from GET /v1/staff). For NextechPM, one person (an ehr_id from GET /v1/staff).
Example:
"STAFF-123"
Optional ISO 8601 timestamp with an explicit timezone offset, in the future when submitted. Cobalt starts no new operation attempt after this deadline and reports reasons[].code EXPIRED. An attempt already in progress, including write reconciliation, may finish after it.
Example:
"2027-06-15T14:30:00Z"