Ttebra_soap_apiAsync Tebra SOAP 2.1
SOAP 2.1
Resources

Patients

Fetch one patient, search across practices, stream an entire patient roster with cursor pagination, and manage patient records.

Resource
client.patients
SOAP operations
GetPatient, GetPatients, GetAllPatients, CreatePatient, UpdatePatient, UpdatePatientsExternalID, UpdatePrimaryPatientCase
Flat methods
get_patient, get_patients, iter_all_patients, get_all_patients
Writes
create, update, update_external_ids, update_primary_case

Methods

client.patients.get#

read
async get(patient_id=None, *, external_id=None, external_vendor_id=None) -> dict | None

Fetch full demographics and cases for a single patient using GetPatient. Returns None when no matching patient exists.

Parameters
ParameterTypeDescription
patient_idint | str | NonePatient ID. Required unless external_id is given.
external_idstr | NoneExternal system identifier.
external_vendor_idint | NoneExternal vendor ID used with external_id.
Returnsdict[str, Any] | None
Raises ValueError when neither patient_id nor external_id is supplied.
Example
patient = await client.patients.get(patient_id=119246)
if patient:
    print(patient["PatientFullName"])

client.patients.list#

read
async list(*, practice_id=None, practice_name=None, first_name=None, middle_name=None, last_name=None, full_name=None, dob=None, from_dob=None, to_dob=None, is_active=None, gender=None, ssn=None, from_created_date=None, to_created_date=None, from_last_modified_date=None, to_last_modified_date=None, from_last_encounter_date=None, to_last_encounter_date=None, fields=None, extra_filter=None) -> list[dict]

Search patients across one or all practices using GetPatients. When dob is provided it overrides both from_dob and to_dob (exact date match).

Parameters
ParameterTypeDescription
practice_idint | str | NoneFilter by practice ID (sent as a string).
practice_namestr | NoneFilter by practice name.
first_namestr | NoneFirst name filter.
middle_namestr | NoneMiddle name filter.
last_namestr | NoneLast name filter.
full_namestr | NoneFull name filter.
dobstr | date | datetime | NoneExact date of birth. Sets both DOB bounds.
from_dobstr | date | datetime | NoneLower DOB bound (ignored when dob is set).
to_dobstr | date | datetime | NoneUpper DOB bound (ignored when dob is set).
is_activebool | str | NoneActive flag. Booleans are sent as "True" / "False".
genderstr | NoneGender filter.
ssnstr | NoneSSN filter.
from_created_datestr | date | datetime | NoneLower creation-date bound.
to_created_datestr | date | datetime | NoneUpper creation-date bound.
from_last_modified_datestr | date | datetime | NoneLower last-modified bound.
to_last_modified_datestr | date | datetime | NoneUpper last-modified bound.
from_last_encounter_datestr | date | datetime | NoneLower last-encounter bound.
to_last_encounter_datestr | date | datetime | NoneUpper last-encounter bound.
fieldsIterable[str] | Mapping[str, bool] | NoneField selector; None requests all fields.
extra_filterMapping[str, Any] | NoneAdditional raw Filter keys.
Returnslist[dict[str, Any]]
Example
matches = await client.patients.list(
    practice_name="Becki Lentz Physical Therapy, Inc",
    last_name="Patient",
    fields=["ID", "FirstName", "LastName", "PatientFullName"],
)

client.patients.list_batch#

read
async list_batch(*, practice_id, batch_size=500, start_key=0, fields=None) -> tuple[list[dict], int | None]

Fetch a single cursor page of patients for a practice using GetAllPatients. Returns the rows and the next start key from Key.nextStartKey.

Parameters
ParameterTypeDescription
practice_idrequiredintPractice ID.
batch_sizeintPage size. Default 500.
start_keyintCursor position. Default 0.
fieldsIterable[str] | Mapping[str, bool] | NoneField selector.
Returnstuple[list[dict[str, Any]], int | None]

client.patients.iter_all#

read
iter_all(*, practice_id, batch_size=500, start_key=0, max_pages=None, fields=None) -> AsyncIterator[dict]

Async iterator that streams every patient in a practice using cursor pagination. Stops when the page is empty or short, when the cursor stops advancing, or after max_pages. Wrap it in async for.

Parameters
ParameterTypeDescription
practice_idrequiredintPractice ID.
batch_sizeintPage size. Default 500.
start_keyintInitial cursor. Default 0.
max_pagesint | NoneOptional page cap.
fieldsIterable[str] | Mapping[str, bool] | NoneField selector applied to each page.
ReturnsAsyncIterator[dict[str, Any]]
Example
async for patient in client.patients.iter_all(practice_id=7, batch_size=250):
    print(patient["ID"], patient.get("PatientFullName"))

client.patients.list_all#

read
async list_all(*, practice_id, batch_size=500, start_key=0, max_pages=None, fields=None) -> list[dict]

Collect every paginated patient into one list. Same parameters and stop conditions as iter_all.

Returnslist[dict[str, Any]]

client.patients.create#

write
async create(patient) -> dict

Create a new patient using CreatePatient. Blocked when read_only=True.

Parameters
ParameterTypeDescription
patientrequiredMapping[str, Any]Raw Patient payload expected by the WSDL.
Returnsdict[str, Any] (the SOAP response)

client.patients.update#

write
async update(patient) -> dict

Update an existing patient using UpdatePatient. Blocked when read_only=True.

Parameters
ParameterTypeDescription
patientrequiredMapping[str, Any]Raw Patient payload, including the patient ID.
Returnsdict[str, Any] (the SOAP response)
WCF quirkThe dispatcher automatically sends this operation as UpdatePatientReq instead of request, matching Tebra's WSDL.

client.patients.update_external_ids#

write
async update_external_ids(updates) -> list[dict]

Batch-update patient external IDs using UpdatePatientsExternalID. Returns the ItemsUpdated rows.

Parameters
ParameterTypeDescription
updatesrequiredlist[Mapping[str, Any]]One PatientExternalIDSetting mapping per patient.
Returnslist[dict[str, Any]]
Example
updated = await client.patients.update_external_ids([
    {"patientID": 119246, "externalID": "EXT-001", "externalVendorID": 1},
])

client.patients.update_primary_case#

write
async update_primary_case(patient_case_id) -> bool

Set the primary case for a patient using UpdatePrimaryPatientCase. Returns the response Success flag.

Parameters
ParameterTypeDescription
patient_case_idrequiredintPatient case ID to make primary.
Returnsbool

Cursor pagination

iter_all is the safest way to read a full practice roster. It respects Tebra's 2500 ms GetAllPatients throttle automatically.

total = 0
async for patient in client.iter_all_patients(practice_id=7, batch_size=250):
    total += 1
print("patients:", total)

# Or collect everything at once
all_patients = await client.get_all_patients(practice_id=7)

Related