Cancel an appointment
curl --request POST \
--url https://docistra.com/api/v1/appointments/{id}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>",
"notify_patient": true
}
'import requests
url = "https://docistra.com/api/v1/appointments/{id}/cancel"
payload = {
"reason": "<string>",
"notify_patient": True
}
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({reason: '<string>', notify_patient: true})
};
fetch('https://docistra.com/api/v1/appointments/{id}/cancel', 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://docistra.com/api/v1/appointments/{id}/cancel",
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([
'reason' => '<string>',
'notify_patient' => true
]),
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://docistra.com/api/v1/appointments/{id}/cancel"
payload := strings.NewReader("{\n \"reason\": \"<string>\",\n \"notify_patient\": true\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://docistra.com/api/v1/appointments/{id}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\",\n \"notify_patient\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://docistra.com/api/v1/appointments/{id}/cancel")
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 \"reason\": \"<string>\",\n \"notify_patient\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"object": "appointment",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"status": "reserved",
"type": "reservation",
"patient_id": "<string>",
"patient_external_id": "<string>",
"doctor_id": "<string>",
"doctor_external_id": "<string>",
"branch_id": "<string>",
"branch_external_id": "<string>",
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"queue_number": 123,
"source": "<string>",
"notes": "<string>",
"cancel_reason": "<string>",
"rescheduled_from_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"already_cancelled": true,
"patient_notified": {
"via": "whatsapp_text",
"reason": "<string>"
}
}{
"error": "slot_taken"
}{
"error": "slot_taken"
}Appointments
Cancel an appointment
Cancelling twice is safe (already_cancelled: true). A paid visit can’t be cancelled (409 paid_locked). The patient gets a WhatsApp message (a free text when they wrote in the last 23 hours, else the appointment_cancelled template), or an SMS when WhatsApp can’t reach them, unless notify_patient is false.
POST
/
appointments
/
{id}
/
cancel
Cancel an appointment
curl --request POST \
--url https://docistra.com/api/v1/appointments/{id}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>",
"notify_patient": true
}
'import requests
url = "https://docistra.com/api/v1/appointments/{id}/cancel"
payload = {
"reason": "<string>",
"notify_patient": True
}
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({reason: '<string>', notify_patient: true})
};
fetch('https://docistra.com/api/v1/appointments/{id}/cancel', 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://docistra.com/api/v1/appointments/{id}/cancel",
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([
'reason' => '<string>',
'notify_patient' => true
]),
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://docistra.com/api/v1/appointments/{id}/cancel"
payload := strings.NewReader("{\n \"reason\": \"<string>\",\n \"notify_patient\": true\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://docistra.com/api/v1/appointments/{id}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\",\n \"notify_patient\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://docistra.com/api/v1/appointments/{id}/cancel")
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 \"reason\": \"<string>\",\n \"notify_patient\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"object": "appointment",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"status": "reserved",
"type": "reservation",
"patient_id": "<string>",
"patient_external_id": "<string>",
"doctor_id": "<string>",
"doctor_external_id": "<string>",
"branch_id": "<string>",
"branch_external_id": "<string>",
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"queue_number": 123,
"source": "<string>",
"notes": "<string>",
"cancel_reason": "<string>",
"rescheduled_from_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"already_cancelled": true,
"patient_notified": {
"via": "whatsapp_text",
"reason": "<string>"
}
}{
"error": "slot_taken"
}{
"error": "slot_taken"
}