Enroll (or create) a patient in a protocol
curl --request POST \
--url https://{your-prod-endpoint}/v1/enrollments/enroll-patient \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"protocol_key": "<string>",
"protocol_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"language": "<string>",
"preferred_timezone": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"freq_config": {},
"custom_variable_values": {}
}
'import requests
url = "https://{your-prod-endpoint}/v1/enrollments/enroll-patient"
payload = {
"phone": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"protocol_key": "<string>",
"protocol_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"language": "<string>",
"preferred_timezone": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"freq_config": {},
"custom_variable_values": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '<string>',
first_name: '<string>',
last_name: '<string>',
protocol_key: '<string>',
protocol_version_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
version: 123,
language: '<string>',
preferred_timezone: '<string>',
started_at: '2023-11-07T05:31:56Z',
freq_config: {},
custom_variable_values: {}
})
};
fetch('https://{your-prod-endpoint}/v1/enrollments/enroll-patient', 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://{your-prod-endpoint}/v1/enrollments/enroll-patient",
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([
'phone' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'protocol_key' => '<string>',
'protocol_version_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'version' => 123,
'language' => '<string>',
'preferred_timezone' => '<string>',
'started_at' => '2023-11-07T05:31:56Z',
'freq_config' => [
],
'custom_variable_values' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://{your-prod-endpoint}/v1/enrollments/enroll-patient"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"protocol_key\": \"<string>\",\n \"protocol_version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"version\": 123,\n \"language\": \"<string>\",\n \"preferred_timezone\": \"<string>\",\n \"started_at\": \"2023-11-07T05:31:56Z\",\n \"freq_config\": {},\n \"custom_variable_values\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{your-prod-endpoint}/v1/enrollments/enroll-patient")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"protocol_key\": \"<string>\",\n \"protocol_version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"version\": 123,\n \"language\": \"<string>\",\n \"preferred_timezone\": \"<string>\",\n \"started_at\": \"2023-11-07T05:31:56Z\",\n \"freq_config\": {},\n \"custom_variable_values\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{your-prod-endpoint}/v1/enrollments/enroll-patient")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"protocol_key\": \"<string>\",\n \"protocol_version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"version\": 123,\n \"language\": \"<string>\",\n \"preferred_timezone\": \"<string>\",\n \"started_at\": \"2023-11-07T05:31:56Z\",\n \"freq_config\": {},\n \"custom_variable_values\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"patient_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocol_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "active",
"language": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"freq_config": {},
"custom_variable_values": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"protocol_runs": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"enrollment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocol_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence_number": 123,
"scheduled_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"questionnaire_status": "pending",
"language": "<string>",
"reviewed_at": "2023-11-07T05:31:56Z",
"review_note": "<string>",
"score": 123,
"score_class": "<string>",
"origin": "dispatcher_scheduled",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Enrollments
Enroll (or create) a patient in a protocol
Creates or reuses the patient by phone, enrolls them in the protocol, and schedules the first outbound call. Requires role admin or coordinator.
POST
/
v1
/
enrollments
/
enroll-patient
Enroll (or create) a patient in a protocol
curl --request POST \
--url https://{your-prod-endpoint}/v1/enrollments/enroll-patient \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"protocol_key": "<string>",
"protocol_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"language": "<string>",
"preferred_timezone": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"freq_config": {},
"custom_variable_values": {}
}
'import requests
url = "https://{your-prod-endpoint}/v1/enrollments/enroll-patient"
payload = {
"phone": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"protocol_key": "<string>",
"protocol_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"language": "<string>",
"preferred_timezone": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"freq_config": {},
"custom_variable_values": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '<string>',
first_name: '<string>',
last_name: '<string>',
protocol_key: '<string>',
protocol_version_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
version: 123,
language: '<string>',
preferred_timezone: '<string>',
started_at: '2023-11-07T05:31:56Z',
freq_config: {},
custom_variable_values: {}
})
};
fetch('https://{your-prod-endpoint}/v1/enrollments/enroll-patient', 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://{your-prod-endpoint}/v1/enrollments/enroll-patient",
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([
'phone' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'protocol_key' => '<string>',
'protocol_version_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'version' => 123,
'language' => '<string>',
'preferred_timezone' => '<string>',
'started_at' => '2023-11-07T05:31:56Z',
'freq_config' => [
],
'custom_variable_values' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://{your-prod-endpoint}/v1/enrollments/enroll-patient"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"protocol_key\": \"<string>\",\n \"protocol_version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"version\": 123,\n \"language\": \"<string>\",\n \"preferred_timezone\": \"<string>\",\n \"started_at\": \"2023-11-07T05:31:56Z\",\n \"freq_config\": {},\n \"custom_variable_values\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{your-prod-endpoint}/v1/enrollments/enroll-patient")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"protocol_key\": \"<string>\",\n \"protocol_version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"version\": 123,\n \"language\": \"<string>\",\n \"preferred_timezone\": \"<string>\",\n \"started_at\": \"2023-11-07T05:31:56Z\",\n \"freq_config\": {},\n \"custom_variable_values\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{your-prod-endpoint}/v1/enrollments/enroll-patient")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"protocol_key\": \"<string>\",\n \"protocol_version_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"version\": 123,\n \"language\": \"<string>\",\n \"preferred_timezone\": \"<string>\",\n \"started_at\": \"2023-11-07T05:31:56Z\",\n \"freq_config\": {},\n \"custom_variable_values\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"patient_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocol_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "active",
"language": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"freq_config": {},
"custom_variable_values": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"protocol_runs": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"enrollment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"protocol_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence_number": 123,
"scheduled_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"questionnaire_status": "pending",
"language": "<string>",
"reviewed_at": "2023-11-07T05:31:56Z",
"review_note": "<string>",
"score": 123,
"score_class": "<string>",
"origin": "dispatcher_scheduled",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Phone in E.164 format.
Provide protocol_key or protocol_version_id (exactly one).
Optional, together with protocol_key.
BCP-47 tag (e.g. es, en).
IANA time zone.
Partial override of the scheduling.
Response
Enrollment created
Show child attributes
Show child attributes
⌘I