Overview
Creating an encounter in Wizlo requires assembling specific identifiers for the clinic, patient, treatments (products), and documents. Unlike simple flat payloads, the Wizlo API relies on relational UUIDs to ensure data integrity. This guide outlines the flow to “translate” external request data (such as a patient intake form submission) into a valid WizloPOST /encounters request.
Prerequisite: Authentication
All API calls in this flow require a valid Machine-to-Machine (M2M) Access Token.- Endpoint:
POST /oauth/token - Action: Exchange your
client_idandclient_secretfor anaccess_token. - Usage: Include
Authorization: Bearer <access_token>in the headers of all subsequent requests.
See the Generate M2M Token reference for details.
Step 1: Get Clinic ID
Goal: Resolve the “Clinic Object” or “Clinic Name” to a WizloclinicId.
You need the unique UUID of the clinic where the encounter is being scheduled.
- API Reference: List Clinics
- Method:
GET /clinics?search={clinic_name} - Logic: Search for the clinic by name or legal name.
- Extraction: From the response
dataarray, select the matching clinic and extract itsid.
Step 2: Identify or Create Patient
Goal: Resolve the “Patient Object” to a WizlopatientId.
Wizlo requires a patientId (UUID) to link the encounter. You must determine if the patient already exists or create a new profile.
A. Check / Create Patient
- API Reference: Create Patient
- Method:
POST /clients - Payload: Map the patient’s demographic data (Name, Email, DOB, Phone).
- Logic:
- Attempt to create the patient.
- Success (201): Extract
user_idfrom the response. - Conflict (409): The patient exists. Use
GET /clients?email={email}(or similar search) to retrieve the existinguser_id.
Step 3: Select Products (Treatments)
Goal: Map “Product IDs” to WizlotreatmentIds.
The encounter payload requires an array of treatmentIds (which correspond to Product UUIDs in the catalog).
- API Reference: List Products
- Method:
GET /tenants/products?search={sku_or_name} - Logic:
- Search for the product using the external
product_id(SKU) or name. - Verify the product is active (
isActive: true). - Extract the
id(UUID) from the response.
- Search for the product using the external
- Output: An array of UUIDs, e.g.,
["45ab34be-8d6e..."].
Step 4: Upload Documents (Optional)
Goal: specific URLs (Intake, Lab, ID) WizlodocumentIds.
If your source data includes URLs to PDF files (e.g., intake_upload_url, ID_upload_url), you must upload them to Wizlo to attach them to the encounter.
- API Reference: Upload Document from URL
- Method:
POST /clients-documents/{patientId}/upload-url/{documentType} - Inputs:
patientId: From Step 2.documentType: Map based on file content (e.g.,intake-forms,lab-results,id-card).url: The source URL of the file.
- Logic: Loop through your available URLs, upload each, and collect the returned
documentId.
| Source Field | Wizlo Document Type |
|---|---|
intake_upload_url | intake-forms |
lab_upload_url | lab-results |
ID_upload_url | id-card |
gfe_upload_url | gfe-forms |
Step 5: Create Encounter
Goal: Submit the final payload. Assemble all IDs collected in the previous steps into the final request.- API Reference: Create Encounter
- Method:
POST /encounters - Headers:
Authorization: Bearer <token>,Content-Type: application/json
Field Mapping
| External Field | Wizlo Field | Notes |
|---|---|---|
| Clinic Object | clinicId | Required (Step 1) |
| Patient Object | patientId | Required (Step 2) |
| Product IDs | treatmentIds | Required. Array of UUIDs (Step 3) |
| Upload URLs | documentIds | Optional. Array of UUIDs (Step 4) |
| GFE Type | reviewType | Required. E.g., “synchronous” |
| N/A | serviceQueue | Hardcode: "provider_network" |
| Appointment | scheduledDay | Optional. Format: YYYY-MM-DD |
| Appointment | scheduledTime | Optional. Format: HH:MM:SS |
| Diagnosis/Vitals | additionalNotes | Optional. Append text here |
Example Request
Fields like order_id and Local Pharmacy are not required. The order is generated automatically by Wizlo upon encounter completion, and the pharmacy is determined by the selected Product settings.