Patient-driven pre-visit
Endpoint: POST /v1/sessions/previsit/patient
Use this when you want the patient to fill in their history before they arrive.
You send the session_url to them via SMS, WhatsApp, or your app’s notification.
Minimal request
Section titled “Minimal request”curl -X POST https://api.snowmed.io/v1/sessions/previsit/patient \ -H "Authorization: Bearer sn_live_your_key" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: appt-12345-previsit" \ -d '{ "patient": { "name": "Priya S", "phone": "+919876543210" }, "clinic": { "doctor": "Dr. Padmavathi", "display_name": "Sunrise Clinic" } }'const res = await fetch("https://api.snowmed.io/v1/sessions/previsit/patient", { method: "POST", headers: { "Authorization": `Bearer ${process.env.SNOW_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": `appt-${appointmentId}-previsit`, }, body: JSON.stringify({ patient: { name: "Priya S", phone: "+919876543210" }, clinic: { doctor: "Dr. Padmavathi", display_name: "Sunrise Clinic" }, }),})const session = await res.json()// session.session_url → send this to the patientimport requests, os
resp = requests.post( "https://api.snowmed.io/v1/sessions/previsit/patient", headers={ "Authorization": f"Bearer {os.environ['SNOW_API_KEY']}", "Idempotency-Key": f"appt-{appointment_id}-previsit", }, json={ "patient": {"name": "Priya S", "phone": "+919876543210"}, "clinic": {"doctor": "Dr. Padmavathi", "display_name": "Sunrise Clinic"}, },)resp.raise_for_status()session = resp.json()# session["session_url"] → send to patientimport okhttp3.*;import org.json.*;
OkHttpClient client = new OkHttpClient();
String body = new JSONObject() .put("patient", new JSONObject() .put("name", "Priya S") .put("phone", "+919876543210")) .put("clinic", new JSONObject() .put("doctor", "Dr. Padmavathi") .put("display_name", "Sunrise Clinic")) .toString();
Request request = new Request.Builder() .url("https://api.snowmed.io/v1/sessions/previsit/patient") .post(RequestBody.create(body, MediaType.get("application/json"))) .addHeader("Authorization", "Bearer " + System.getenv("SNOW_API_KEY")) .addHeader("Idempotency-Key", "appt-" + appointmentId + "-previsit") .build();
try (Response response = client.newCall(request).execute()) { JSONObject session = new JSONObject(response.body().string()); String sessionUrl = session.getString("session_url"); // send sessionUrl to patient}Response
Section titled “Response”{ "id": "ses_01hwxyz...", "session_url": "https://previsit.summary.to/Dr.Padmavathi/abc123xyz", "type": "pre-consult", "ui_type": "patient", "expires_at": "2026-05-12T12:00:00Z", "created_at": "2026-05-12T10:00:00Z"}Send session_url to the patient. When they submit, you receive a session.completed webhook.
ANC variant
Section titled “ANC variant”For antenatal care, add template_code:
{ "template_code": "previsit_anc_v1", "patient": { "name": "Priya S", "phone": "+919876543210" }, "clinic": { "doctor": "Dr. Padmavathi", "display_name": "Sunrise Clinic" }}Key fields
Section titled “Key fields”| Field | Required | Notes |
|---|---|---|
patient.name | Recommended | Shown on the form intro screen |
patient.phone | Recommended | Pre-fills phone field |
clinic.doctor | Recommended | Shown on form + used in the share URL |
template_code | No | Omit for general OPD |
appointment_id | No | Your ID, stored for correlation, returned in webhooks |
expires_in_minutes | No | Default 120; max 10080 (7 days) |
language | No | Default en; also hi, ta, te |
metadata | No | Arbitrary key-value pairs echoed in webhooks |
Idempotency
Section titled “Idempotency”Always pass Idempotency-Key. If your server crashes after sending the request but before reading the response, retrying with the same key returns the original session — no duplicate created.
Recommended key pattern: {your-appointment-id}-previsit