Cancels an appointment in your organization, whichever channel booked it. Pending reminders are cancelled and the assigned providers are notified. The patient is notified only when notifyPatient is true, using your clinic's cancellation notification settings (email, WhatsApp, SMS); by default nothing is sent to the patient. Cancelling an appointment that is already cancelled returns it unchanged, so retries are safe. Completed and no-show appointments cannot be cancelled. Requires an API key with the write scope.
Code samples
Node.js
const fetch = require('node-fetch');
async function callApi() {
const apiKey = 'YOUR_API_KEY';
const url = `https://account.lunahealth.app/api/appointments/{id}/cancel`;
const requestBody = {
// Add your request body data here
};
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(requestBody)
});
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const data = await response.json();
console.log(data);
return data;
} catch (error) {
console.error('Error calling API:', error);
throw error;
}
}
callApi();
Python
import requests
def call_api():
api_key = 'YOUR_API_KEY'
url = 'https://account.lunahealth.app/api/appointments/{id}/cancel'
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
params = {
}
# Add your request body data here
request_body = {}
try:
response = requests.post(
url,
headers=headers,
params=params,
json=request_body
)
response.raise_for_status()
data = response.json()
print(data)
return data
except requests.exceptions.RequestException as e:
print(f'Error calling API: {e}')
raise
call_api()
Parameters
Name
In
Type
Required
Description
id
path
string
Yes
ID of the appointment to cancel
Request body
Required
Request fields
Name
Type
Required
Description
notifyPatient
boolean
No
Send the patient a cancellation message through your clinic's cancellation settings. Defaults to false.
Example request
{
"notifyPatient": true
}
Responses
Status
Description
200
Successful response
400
Invalid input data
401
Authorization not provided
403
Insufficient access
500
Internal server error
200 — Successful response
Response fields
Name
Type
Required
Description
id
string
Yes
—
status
string
Yes
—
type
string
Yes
—
title
stringnull
Yes
—
description
stringnull
Yes
—
start_time
string
Yes
—
end_time
string
Yes
—
telemedicine
boolean
Yes
—
video_call_type
string
Yes
Video platform of an online appointment: LUNAHEALTH, ZOOM or GOOGLE_MEET. NONE for in-person appointments, and for online ones where the clinic sends its own link