Books an in-person appointment for an existing patient in your organization with one provider and one service. The end time is set from the service's duration. The start time must be in the future, inside the provider's availability, and free; use GET /availability to find open slots. Retrying an identical request returns the appointment already created instead of a duplicate. The appointment is created as CONFIRMED and no confirmation or reminders are sent to the patient. 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`;
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'
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()
Request body
Required
Request fields
Name
Type
Required
Description
patientId
string
Yes
ID of an existing patient in your organization
staffId
string
Yes
ID of the provider (staff member) who will see the patient
serviceId
string
Yes
ID of the service; its duration sets the end time
startTime
string (date-time)
Yes
Start time in ISO 8601 with a UTC offset, e.g. a start_time from GET /availability
locationId
string
No
ID of the location where the appointment takes place