{"openapi":"3.1.0","info":{"title":"PtEverywhere API","version":"1.6.0","description":"PtEverywhere Sandbox: a demo practice, Riverside Physio, with its own database. Amounts are in US dollars and times in America/New_York. Every call is listed at /app/activity with the SQL it ran."},"servers":[{"url":"https://pteverywhere-sandbox.vercel.app/api/v1"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"A person's token from POST /auth/login, a personal API token from Settings (/app/settings), an OAuth access token, or the practice API key from Settings (shared: acts for the practice, not a person)."},"oauth2":{"type":"oauth2","description":"Authorization code flow, PKCE optional. The client authenticates with client_secret_post or client_secret_basic. The token answer carries role, name, email and an id_token. Access tokens last an hour; refresh with grant_type=refresh_token.","flows":{"authorizationCode":{"authorizationUrl":"https://pteverywhere-sandbox.vercel.app/oauth/authorize","tokenUrl":"https://pteverywhere-sandbox.vercel.app/oauth/token","refreshUrl":"https://pteverywhere-sandbox.vercel.app/oauth/token","scopes":{}}}}}},"security":[{"bearerAuth":[]},{"oauth2":[]}],"paths":{"/billing/unpaid-balances":{"get":{"operationId":"list_unpaid_balances","summary":"Patients with money outstanding, oldest first, with the balance, how many days it has run and when they were last contacted.","x-intent":"Who hasn't paid in more than 30 days?","x-view":"checklist","x-link":"https://pteverywhere-sandbox.vercel.app/app/billing","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer"},"description":"Only balances older than this many days."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"How many to return."}]}},"/billing/contacts":{"post":{"operationId":"mark_contacted","summary":"Record that someone called a patient about their balance.","x-intent":"Mark this patient as called","x-gate":"confirm","x-undo":"unmark_contacted","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["patientId"],"properties":{"patientId":{"type":"string","description":"Who was called."},"note":{"type":"string","description":"What they said, in one line."}}}}}}}},"/billing/follow-ups":{"post":{"operationId":"book_follow_up","summary":"Book a follow-up call about a balance, on the front desk calendar.","x-intent":"Book a follow-up call Thursday at 9.","x-gate":"confirm","x-view":"slot_pick","x-undo":"cancel_follow_up","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["patientId","start"],"properties":{"patientId":{"type":"string","description":"Who the call is with."},"start":{"type":"string","description":"When it starts, as an ISO timestamp."},"note":{"type":"string","description":"What the call is about."}}}}}}}},"/billing/contacts/{id}":{"delete":{"operationId":"unmark_contacted","summary":"Remove a call that was logged by mistake.","x-gate":"confirm","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The logged call to remove."}]}},"/billing/follow-ups/{id}":{"delete":{"operationId":"cancel_follow_up","summary":"Cancel a follow-up call that was booked.","x-gate":"confirm","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The follow-up to cancel."}]}},"/billing/statements":{"post":{"operationId":"send_statement","summary":"Email a statement of everything outstanding to the payer on file.","x-intent":"Email this patient their statement","x-gate":"confirm","x-undo":"review","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["patientId"],"properties":{"patientId":{"type":"string","description":"Whose statement it is."},"email":{"type":"string","description":"Where it goes. Defaults to the payer on file."}}}}}}}},"/billing/invoices":{"get":{"operationId":"list_invoices","summary":"Invoices, with the payer, the balance and how overdue it is.","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"draft, sent, paid or overdue."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"How many to return."}]}},"/billing/invoices/{id}":{"get":{"operationId":"get_invoice","summary":"One invoice: the lines, the balance and every payment against it.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The invoice, like inv_0407."}]}},"/billing/payments":{"get":{"operationId":"list_payments","summary":"Payments received, newest first, with what they settled.","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"How many to return."}]}},"/schedule/bootstrap":{"get":{"operationId":"bootstrap","x-intent":"What needs me today?","summary":"Today at this practice: how many visits, who is first, what is due before it. Call this first in every conversation, before loading anything else."}},"/schedule/appointments":{"get":{"operationId":"list_appointments","summary":"Appointments by day, with the therapist, the room and whether the patient showed.","x-intent":"Who is on my schedule today?","x-view":"schedule","x-link":"https://pteverywhere-sandbox.vercel.app/app","parameters":[{"name":"day","in":"query","required":false,"schema":{"type":"string"},"description":"One day, as YYYY-MM-DD."},{"name":"patientId","in":"query","required":false,"schema":{"type":"string"},"description":"Only rows for this patient."},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"booked, attended, cancelled or no_show."}]}},"/schedule/patients/{id}":{"get":{"operationId":"get_patient","summary":"One patient: their referral, their status, their next appointment and the last note.","x-intent":"Look a patient up","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The patient reference, like p_0412."}]}},"/schedule/patients":{"get":{"operationId":"list_patients","summary":"Patients on the caseload, with their referral, status and next appointment.","parameters":[{"name":"query","in":"query","required":false,"schema":{"type":"string"},"description":"Free text to narrow the results."},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"active, discharged or waiting."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"How many to return."}]}},"/schedule/appointments/book":{"post":{"operationId":"book_appointment","summary":"Book a visit for a patient with a therapist.","x-intent":"Book the next visit Thursday at 9.","x-gate":"confirm","x-view":"slot_pick","x-undo":"review","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["patientId","start"],"properties":{"patientId":{"type":"string","description":"Who the visit is for."},"start":{"type":"string","description":"When it starts, as an ISO timestamp."},"therapist":{"type":"string","description":"Who sees them. Defaults to the referring therapist."}}}}}}}},"/schedule/notes/{id}/sign":{"post":{"operationId":"sign_note","summary":"Sign a clinical note so it goes on the record.","x-gate":"human","x-link":"https://pteverywhere-sandbox.vercel.app/app/notes/{id}","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The note to sign."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"string","description":"The note to sign."},"addendum":{"type":"string","description":"Anything to add before signing."}}}}}}}},"/exercises/plans":{"get":{"operationId":"list_exercise_plans","summary":"Home exercise plans, with adherence since the last visit.","parameters":[{"name":"patientId","in":"query","required":false,"schema":{"type":"string"},"description":"Only rows for this patient."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"How many to return."}]},"post":{"operationId":"assign_exercises","summary":"Assign home exercises to a patient and send them to their app.","x-intent":"Give this patient home exercises","x-gate":"confirm","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["patientId","exercises"],"properties":{"patientId":{"type":"string","description":"Who the plan is for."},"exercises":{"type":"string","description":"The exercises, with sets and reps."},"notes":{"type":"string","description":"What to watch for between visits."}}}}}}}},"/exercises/plans/{id}":{"get":{"operationId":"get_exercise_plan","summary":"One exercise plan: the exercises, the dosage and what the patient reported.","x-intent":"Show this patient's exercise plan","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The plan, like ex_0412."}]}},"/exercises/logs":{"get":{"operationId":"list_exercise_logs","summary":"What patients logged at home: which days they trained and what hurt.","parameters":[{"name":"patientId","in":"query","required":false,"schema":{"type":"string"},"description":"Only rows for this patient."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"How many to return."}]}},"/auth/login":{"post":{"operationId":"log_in","summary":"Sign a person in with their email and password. Answers with their token, their role and their name.","x-auth":"login","x-gate":"human","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","description":"The email they sign in to PtEverywhere with."},"password":{"type":"string","description":"Their PtEverywhere password."}}}}}}}},"/auth/me":{"get":{"operationId":"get_me","summary":"Who the token belongs to: their user id, email, name and role.","x-auth":"me"}}}}