Skip to main content
POST
/
tasks
Create 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 '{
  "subject": "<string>",
  "description": "<string>",
  "assignee_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "patient_mrn": "<string>"
}'
{
  "success": true,
  "message": "<string>",
  "task_id": "<string>",
  "job_id": "<string>"
}

Request Parameters

All parameters are required:
  • subject (string, required): Task title/subject line
  • description (string, required): Task description/body content
  • assignee_user_id (string, required): EMR user ID to assign the task to
  • patient_mrn (string, required): Medical Record Number (MRN) of the patient

Example Request

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 '{
    "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"
}'

Example Response

{
    "success": true,
    "message": "Task processing. A webhook event will be sent upon completion.",
    "task_id": "abc123def456789012345678",
    "job_id": "12345"
}
The response includes:
  • task_id: Unique identifier for the created task record
  • job_id: Job execution identifier for tracking the async operation

Error Responses

Missing Required Field

{
    "success": false,
    "message": "Missing required field: subject"
}

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

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

Body

application/json
subject
string
required

Task title/subject line

description
string
required

Task description/body content

assignee_user_id
string<uuid>
required

EMR user ID to assign the task to (must be valid UUID format)

patient_mrn
string
required

Medical Record Number (MRN) of the patient

Response

Task queued successfully

success
boolean
message
string
task_id
string

Unique identifier for the created task record

job_id
string

Job execution identifier for tracking the async operation