Finding Family Member PatNums via API

For requests or help with our API
Post Reply
beacondental
Posts: 145
Joined: Wed Mar 15, 2023 8:43 am

Finding Family Member PatNums via API

Post by beacondental »

Hi Team,
Is there a way to retrieve the PatNums of all family members of a patient through the API? For instance, if a patient is a Guarantor, how can I get the PatNums of all related family members?

Thanks
justine
Posts: 354
Joined: Tue Dec 28, 2021 7:59 am

Re: Finding Family Member PatNums via API

Post by justine »

beacondental wrote: Thu Oct 16, 2025 4:09 am Hi Team,
Is there a way to retrieve the PatNums of all family members of a patient through the API? For instance, if a patient is a Guarantor, how can I get the PatNums of all related family members?

Thanks
Hello beacondental,

You can use GET patients/Simple and filter by Guarantor.

Thanks!
joergzastrau
Posts: 49
Joined: Sun Feb 27, 2022 2:53 am

Re: Finding Family Member PatNums via API

Post by joergzastrau »

I use a Code by ChrisD of OpenDental.

/* List of all patients in 'Patient' status with a specific Guarantor PatNum (99 in example) and email address*/
SET @GuarantorPatNum=99; /* use 0 for patients from any family */
SET @EmailAddress='service@opendental.com'; /* Leave as empty quotes for any email address, including none. */


/*--------------------DO NOT MODIFY BELOW THIS LINE--------------------*/
/* Query code written/modified 07/22/2024:ChrisD */
SELECT
patient.PatNum
FROM patient
WHERE patient.PatStatus = 0 /* 'Patient' PatStatus*/
/* Remove either of the following lines to search for only one or the other */
AND IF(@GuarantorPatNum, patient.Guarantor = @GuarantorPatNum, TRUE)
AND IF(LENGTH(@EmailAddress), patient.Email = @EmailAddress, TRUE)
;


/* List of all patients in 'Patient' status with the same guarantor as a specific PatNum (99 in example)*/
SET @FamilyMemberPatNum=99;


/*--------------------DO NOT MODIFY BELOW THIS LINE--------------------*/
/* Query code written/modified 07/22/2024:ChrisD */
SELECT
patient.PatNum
FROM patient
WHERE patient.Guarantor IN (
SELECT pat.Guarantor
FROM patient pat
WHERE pat.PatNum = @FamilyMemberPatNum
)
AND patient.PatStatus = 0 /* 'Patient' PatStatus*/
;
Edit 20251018: Open Dental was so friendly to provide this query to me for free because I am posting my workflows in this forum, give proper attribution and because I don't know anything about SQL. If you are commercial you should IMHO pay for the this service or provide some code. Please give something back to this forum.

Joerg
Post Reply