General Practice
Back to site

Reference

General Practice API

Every endpoint that powers the General Practice app is available to call directly — whether you're building your own integration or connecting outside equipment (an imaging system, a lab scanner) straight into a patient's chart.

Getting started

Base URL

https://doctovaria.com.tr/api

Every request (aside from the auth endpoints themselves) must include an Authorization: Bearer <token> header. There are two ways to get a token:

  1. User login. Complete the two-step OTP flow (POST /auth/login then POST /auth/login/verify-otp) to get a token tied to a staff account's own session.
  2. API token (recommended for integrations). Log into the app once, open Settings → API Token, and create a named token. This is the right choice for a script or an outside machine that isn't a person logging in — it doesn't expire on its own and can be revoked independently at any time.

All responses share one envelope: {"{"}"message": string, "data": ...{"}"}. Validation errors return HTTP 422 with an additional errors object keyed by field name.

Example

curl https://doctovaria.com.tr/api/general_practice/clients \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Accept: application/json"

Authentication

Every endpoint below except this group requires a Bearer token. Get one either by completing the two-step OTP login flow, or — for outside systems/integrations — by generating a long-lived token from Settings > API Token after logging into the app once.

POST /auth/login Public

Verifies mobile + password and issues an OTP login challenge (does not return a token yet).

Request

Field Type Notes
mobile string required
password string required
branch_code string optional

Response data

  • message string
  • otp_reference string
  • masked_mobile string
  • expires_at datetime
POST /auth/login/verify-otp Public

Confirms the OTP from login, creates a Sanctum token, and logs the user in.

Request

Field Type Notes
mobile string required
password string required
branch_code string optional
otp string required
otp_reference string optional

Response data

  • token string — Bearer token — send as Authorization: Bearer {token} on every subsequent request.
  • user User object
POST /auth/forgot-password Public

Issues an OTP to begin a password-reset flow.

Request

Field Type Notes
mobile string required

Response data

  • message string
  • otp_reference string
  • masked_mobile string
  • expires_at datetime
POST /auth/forgot-password/verify-otp Public

Marks the forgot-password OTP challenge as verified (must precede reset-password).

Request

Field Type Notes
mobile string required
otp string required
otp_reference string optional

Response data

  • message string
  • verified boolean
POST /auth/reset-password Public

Sets a new password once the forgot-password OTP has been verified.

Request

Field Type Notes
mobile string required
otp_reference string required
new_password string required — min 8, must include an uppercase letter, a lowercase letter, a number, and a symbol -- confirmed by a matching new_password_confirmation field

Response data

  • message string
POST /auth/logout Bearer token

Revokes the current access token.

GET /auth/me Bearer token

Returns the authenticated user's profile, roles, and permissions.

Response data

  • (User object) — see Users group below

Users

Staff accounts belonging to your company (doctors, receptionists, managers). Creating/deleting other users, or updating someone other than yourself, requires the acting user to be a system manager or project admin.

GET /doctors Bearer token

Lists active doctors.

Response data

  • [User object] array
GET /users Bearer token

Lists the company's users.

Response data

  • [User object] array
POST /users Bearer token · manager/admin only 201 Created

Creates a new staff/doctor user (enforced against the subscription seat limit).

Request

Field Type Notes
name string required
email string required — unique
phone string optional
password string required — min 8, must include an uppercase letter, a lowercase letter, a number, and a symbol
branch_name string optional
status enum optional — active, inactive, suspended — defaults active
is_doctor boolean optional
notes string optional
role_ids integer[] optional
permission_ids integer[] optional

Response data

  • (User object)
GET /users/{id} Bearer token

Fetches a user's profile.

Response data

  • (User object)
PUT /users/{id} Bearer token · self, or manager/admin for others

Updates a user's profile/roles/permissions.

Request

Field Type Notes
(all fields from POST /users) all optional/"sometimes"

Response data

  • (User object)
DELETE /users/{id} Bearer token · manager/admin only

Deletes a user.

User object fields

  • id, uuid
  • company_id, company_name
  • name, email, phone (mobile is an alias of phone)
  • branch_name
  • status (UserStatus)
  • is_project_admin, is_doctor
  • notes
  • last_login_at
  • roles: [{id, name, slug}]
  • permissions: [{id, name, slug}]

Activity Log

System manager/admin only. Every AuditLog row for your company across every audited model (patients, appointments, visits, payments, accounting, password changes, ...), newest first, 100 per page.

GET /activity-log Bearer token · system manager/admin only

Lists the company-wide activity log, filterable and paginated.

Request

Field Type Notes
user_id integer optional — one specific user
role enum optional — doctor|staff
client_id integer optional — actions related to one patient
date_from date optional
date_to date optional
category enum optional — patient|appointment|visit|payment|prescription|lab|xray|consent|accounting|user|clinical
action enum optional — created|updated|deleted|password_changed|exported|erasure_requested — 'viewed' rows are never included -- too high-volume to be useful here

Response data

  • [ActivityLog object] array — paginated: data/links/meta, 100 per page

ActivityLog object fields

  • id, created_at
  • action
  • category
  • user: {id, name, is_doctor, role} | null
  • client: {id, name} | null
  • subject_label (string|null -- e.g. vendor/party/employee name for non-patient entries)
  • changed_fields: string[] | null
  • ip_address

Companies & Pricing

Your clinic's profile, subscription history, and the price list used for services and odontogram procedures.

GET /companies/{id} Bearer token

Fetches company profile with subscription/user-count summary.

Response data

  • id, uuid, name, code, email, phone, address, status, notes
  • users_count, active_users_count integer
  • latest_active_subscription Subscription object | null
GET /companies/{id}/subscriptions Bearer token

Lists the company's subscription history.

Response data

  • id, company_id, plan_name
  • status enum (active, inactive)
  • starts_at, ends_at date
  • max_doctors, max_assistants, active_users, max_ai_tokens, ai_tokens_used, price number
  • is_currently_active boolean
GET /companies/{id}/treatment-products Bearer token

Lists every priced item: company-managed services and odontogram-widget procedures.

Response data

  • id, company_id, scope (company|odontogram), code
  • name, name_ar, name_en, name_tr string
  • price, unit_price number
  • status string (active|inactive)
POST /companies/{id}/treatment-products Bearer token 201 Created

Creates a new company-scoped treatment/service price entry.

Request

Field Type Notes
code string required
name_ar string required
name_en string required
name_tr string optional
price number required — min 0 (falls back to unit_price)
status string required — active|inactive

Response data

  • (product object, see index)
PUT /companies/{id}/treatment-products/{productId} Bearer token

Updates a product's price/name/status.

Request

Field Type Notes
(same fields as create)

Response data

  • (product object)
DELETE /companies/{id}/treatment-products/{productId} Bearer token

Deletes a treatment product (blocked if still referenced by a treatment record).

GET /companies/{id}/odontogram-treatment-prices Bearer token

A flat {code: price} map of every active odontogram-widget procedure price.

Response data

  • { "<code>": <price>, ... } object

Clients (Patients)

Patient records, shared by every specialty under its own URL prefix (e.g. /nutrition/clients, /gynecology/clients — dental's own is unprefixed). A doctor-acting user only ever sees/writes patients already claimed by them within their own specialty; see each specialty's own Clinical Profile / clinical-record group below for what's specific to it.

GET /general_practice/clients Bearer token

Lists/searches patients.

Request

Field Type Notes
name string (query) optional — partial match
phone string (query) optional — partial match
per_page integer (query) optional — 1–100. Omit for a flat array; include for {data, links, meta}.

Response data

  • id, uuid, client_code, name, phone, city
  • status enum (new, under_treatment, completed, inactive)
  • last_visit_at datetime | null
  • next_appointment Appointment object | null
POST /general_practice/clients Bearer token 201 Created

Registers a new patient.

Request

Field Type Notes
client_code string optional — auto-generated (CL-XXXXXXXX) if omitted, must be unique
name string required
email string optional
phone string required
gender enum required — male, female
age integer optional
date_of_birth date optional
city, address, medical_notes string optional
status enum optional — new, under_treatment, completed, inactive — defaults new

Response data

  • (Client object, see below)
GET /general_practice/clients/{id} Bearer token

Fetches a patient's full profile.

Response data

  • (Client object)
PUT /general_practice/clients/{id} Bearer token

Updates patient details.

Request

Field Type Notes
(same fields as create, all optional)

Response data

  • (Client object)
DELETE /general_practice/clients/{id} Bearer token

Deletes a patient record.

Client object fields

  • id, uuid, client_code, name, email, phone
  • gender (ClientGender), age, date_of_birth
  • city, address, medical_notes
  • status (ClientStatus)
  • last_visit_at
  • next_appointment: Appointment object | null
  • financial_summary: { total_services_amount, total_paid_amount, remaining_amount }

AI Assistant

Restricted to doctors (with ai_enabled) and system managers. A back-and-forth chat (not a one-shot description like dental) — the doctor converses freely, then asks the assistant to turn the conversation into a structured, multi-session plan, which is only persisted once confirmed. Every endpoint here shares the same shape across all 10 non-dental specialties — only the URL prefix changes.

GET /general_practice/clients/{id}/ai-conversation Bearer token · doctor/manager

Fetches the full chat history for this patient.

Response data

  • [AiConversationMessage object] array — {id, role (user|assistant), text, created_at}
POST /general_practice/clients/{id}/ai-conversation/messages Bearer token · doctor/manager · KVKK consent required

Sends one free-text chat message and gets the assistant's reply.

Request

Field Type Notes
text string required — max 4000

Response data

  • user_message, assistant_message AiConversationMessage object
POST /general_practice/clients/{id}/ai-treatment-plan/transcribe Bearer token · doctor/manager · KVKK consent required

Transcribes a voice recording to text (not counted against the AI token cap).

Request

Field Type Notes
audio file required

Response data

  • description string
POST /general_practice/clients/{id}/ai-treatment-plan/generate Bearer token · doctor/manager · KVKK consent required

Asks the assistant to turn the conversation so far into a draft multi-session plan (not yet persisted).

Request

Field Type Notes
text string optional — max 4000 — an optional last message to send before generating
doctor_id integer optional — required if the acting user is not a doctor

Response data

  • diagnosis_summary string
  • sessions array — up to 8, each: {date, start_time, duration_minutes, session_description, procedures}
  • diet_plan, exercise_plan string | null — nutrition only — free-text plan text
  • diet_plan_data, exercise_plan_data object | null — nutrition only — the same plan, table-shaped (see NutritionPlanStructure)
  • user_message, assistant_message AiConversationMessage object
POST /general_practice/clients/{id}/ai-treatment-plan/confirm Bearer token · doctor/manager 201 Created

Persists the (optionally edited) sessions as real, conflict-checked appointments.

Request

Field Type Notes
doctor_id integer optional
sessions array required — min 1, max 8, each: {date, start_time (H:i), duration_minutes (30|60|90), session_description, procedures[] ({procedure_code, notes}), charge_items[]}
diet_plan, exercise_plan string optional — nutrition only — max 20000
diet_plan_data, exercise_plan_data array optional — nutrition only — table-shaped plan, preferred over the free-text fields above when both are present

Response data

  • appointments, care_plan [Appointment object], CarePlan object | null

Doctor Schedule & Availability

Read a doctor's weekly working hours, or compute free/filled slots for a given day.

GET /doctors/{id}/schedule Bearer token

Fetches a doctor's weekly schedule (auto-created with 09:00–17:00/30-min defaults if none exists).

Response data

  • doctor_id, start_time (H:i), end_time (H:i), slot_minutes
  • working_days enum[] (monday, tuesday, wednesday, thursday, friday, saturday, sunday)
PUT /doctors/{id}/schedule Bearer token

Replaces a doctor's schedule.

Request

Field Type Notes
start_time, end_time string (H:i) required
slot_minutes integer required — 30|60|90
working_days enum[] required — monday, tuesday, wednesday, thursday, friday, saturday, sunday — min 1

Response data

  • (schedule object)
GET /doctors/{id}/availability Bearer token

Renders a full-day slot grid for a scheduling calendar.

Request

Field Type Notes
date date (query) required

Response data

  • doctor_id, date, slots — slots: [{time, status: free|filled, appointment}]
GET /doctors/{id}/available-start-times Bearer token

Lists valid start times for a new appointment.

Request

Field Type Notes
date date (query) required
duration_minutes integer (query) required — 30|60|90

Response data

  • start_times string[] (H:i)
GET /doctors/{id}/available-durations Bearer token

Given a start time, tells which durations would fit without conflict.

Request

Field Type Notes
date date (query) required
start_time string H:i (query) required

Response data

  • durations array — [{value: 30|60|90, available: boolean}]

Appointments

Booking, rescheduling, and cancelling — the same fields as dental, minus the check-in/no-show actions (no Visit step outside dental).

GET /general_practice/appointments Bearer token

Lists/filters appointments across the clinic.

Request

Field Type Notes
date_from, date_to date (query) optional
date date (query) optional — used only if date_from/date_to not both given
doctor_id, client_id integer (query) optional
status string (query) optional
per_page integer (query) optional — 1–100, default 20

Response data

  • [Appointment object] array
POST /general_practice/appointments Bearer token 201 Created

Books a new appointment, or blocks out doctor unavailability.

Request

Field Type Notes
client_id integer optional — required if type=booked
doctor_id integer required
type enum required — booked, unavailable
status enum optional — scheduled, completed, no_show, cancelled — defaults scheduled
date date required
start_time string (H:i) required
duration_minutes integer required — 30|60|90
notes, planned_summary string optional
charge_items array optional

Response data

  • (Appointment object)
GET /general_practice/appointments/{id} Bearer token

Fetches a single appointment.

Response data

  • (Appointment object)
PUT /general_practice/appointments/{id} Bearer token

Reschedules/edits an appointment.

Request

Field Type Notes
(same as create, all optional, plus planned_notes)

Response data

  • (Appointment object)
DELETE /general_practice/appointments/{id} Bearer token

Deletes an appointment and any charges tied to it.

Appointment object fields

  • id, uuid, client_id, client_name, doctor_id, doctor_name
  • type (AppointmentType), status (AppointmentStatus)
  • date, start_time (H:i), end_time (H:i), duration_minutes
  • notes, planned_summary, planned_notes
  • action_state: "locked" | "manage" (computed — never "checkin" here)
  • is_past, is_future, is_within_one_hour (booleans)

Dashboard

GET /general_practice/dashboard/stats Bearer token

Appointment and income stats over a date range, optionally filtered to one doctor/branch.

Request

Field Type Notes
date_from, date_to date (query) required
doctor_id integer (query) optional
branch_id integer (query) optional

Response data

  • appointments.total, appointments.by_status object
  • income.total, income.by_method, income.by_day object — always zero outside dental today — no specialty but dental can record a Payment yet

Clinical Profile

General Practice's standing, one-per-patient clinical profile — not repeating records, see Vitals and Referrals below for those.

GET /general_practice/clients/{id}/profile Bearer token

Fetches the client's profile (auto-created empty on first call).

Response data

  • (profile object, see PUT below)
PUT /general_practice/clients/{id}/profile Bearer token

Updates the profile.

Request

Field Type Notes
chronic_conditions string[] optional — diabetes_t1|diabetes_t2|hypertension|copd|asthma|heart_failure|coronary_artery_disease|hypothyroidism|hyperthyroidism|chronic_kidney_disease|liver_disease|other
current_medications, allergies string optional — max 5000
blood_type string optional — A, B, AB, 0
rh string optional — positive, negative
smoking string optional — never|former|current
alcohol string optional — none|occasional|regular
height_cm number optional — 30–260
adult_vaccination_status object optional — {tetanus, influenza, pneumococcal, hepatitis_b, covid19} — each a date, the last dose given

Response data

  • (profile object)

Vitals

Repeating per-visit vital-sign readings.

GET /general_practice/clients/{id}/vitals Bearer token

Lists a patient's vitals history.

Response data

  • [Vital object] array
POST /general_practice/clients/{id}/vitals Bearer token 201 Created

Records a new reading.

Request

Field Type Notes
measured_at date required
systolic integer optional — 40–300
diastolic integer optional — 20–200
pulse integer optional — 20–250
temperature_c number optional — 30–45
spo2 integer optional — 50–100
blood_glucose integer optional — 10–1000
weight_kg number optional — 0–500
notes string optional — max 5000

Response data

  • (Vital object)
PUT /general_practice/vitals/{id} Bearer token

Edits a reading.

Request

Field Type Notes
(same fields as create, all optional)

Response data

  • (Vital object)
DELETE /general_practice/vitals/{id} Bearer token

Deletes a reading.

Vital object fields

  • id, uuid, client_id, measured_at
  • systolic, diastolic, pulse, temperature_c, spo2, blood_glucose, weight_kg, notes

Referrals

Repeating referral-out records.

GET /general_practice/clients/{id}/referrals Bearer token

Lists a patient's referrals.

Response data

  • [Referral object] array
POST /general_practice/clients/{id}/referrals Bearer token 201 Created

Records a new referral.

Request

Field Type Notes
referred_at date required
target_specialty string required — max 255 — free text
target_institution string optional — max 255
reason string optional — max 5000
status string optional — pending|completed — defaults pending

Response data

  • (Referral object)
PUT /general_practice/referrals/{id} Bearer token

Edits a referral.

Request

Field Type Notes
(same fields as create, all optional)

Response data

  • (Referral object)
DELETE /general_practice/referrals/{id} Bearer token

Deletes a referral.

Referral object fields

  • id, uuid, client_id, referred_at, target_specialty, target_institution, reason, status

Accounting

Every endpoint in this group additionally requires the acting user to be a system manager, accountant, or project admin. Covers the company fund ledger, expenses, capital transactions, and payroll (including each doctor's revenue-share commission).

GET /fund/summary Bearer token · accounting access

Range summary of the fund ledger, broken down by source.

Request

Field Type Notes
from, to date (query) optional

Response data

  • balance, period_total_in, period_total_out, period_net number
  • by_source object — {payment, expense, capital, salary_advance, salary_payment}
GET /fund/transactions Bearer token · accounting access

Raw ledger of every fund-affecting event.

Request

Field Type Notes
source_type string (query) optional — payment|expense|capital|salary_advance|salary_payment
from, to, per_page (query) optional

Response data

  • id, uuid, source_type, source_id, amount (signed), description, occurred_on, created_by
GET /expenses Bearer token · accounting access

Lists company expenses.

Request

Field Type Notes
category, from, to, per_page (query) optional

Response data

  • [Expense object] array
POST /expenses Bearer token · accounting access 201 Created

Records a company expense (posts a negative fund transaction).

Request

Field Type Notes
category enum required — dental_supplies, lab_fees, rent, utilities, equipment, marketing, insurance, maintenance, taxes, other
vendor_name, invoice_number string optional
amount number required — min 0.01
expense_date date required
description string optional
attachment file optional — multipart, jpg/jpeg/png/pdf, max 10MB

Response data

  • (Expense object)
POST /expenses/{id} Bearer token · accounting access

Updates an expense (note: POST, not PUT — supports re-uploading the attachment).

Request

Field Type Notes
(same fields as create, all optional)

Response data

  • (Expense object)
DELETE /expenses/{id} Bearer token · accounting access

Deletes an expense and its fund transaction.

GET /capital-transactions Bearer token · accounting access

Lists owner capital injections/withdrawals.

Request

Field Type Notes
type, per_page (query) optional

Response data

  • [CapitalTransaction object] array
POST /capital-transactions Bearer token · accounting access 201 Created

Records a capital injection or withdrawal (posts a signed fund transaction).

Request

Field Type Notes
type enum required — injection, withdrawal
amount number required — min 0.01
party_name string optional
transaction_date date required
description string optional

Response data

  • (CapitalTransaction object)
PUT /capital-transactions/{id} Bearer token · accounting access

Edits a capital transaction.

Request

Field Type Notes
(same fields as create, all optional)

Response data

  • (CapitalTransaction object)
DELETE /capital-transactions/{id} Bearer token · accounting access

Deletes a capital transaction and its fund transaction. (No GET /capital-transactions/{id} — show is not exposed.)

GET /payroll/employees Bearer token · accounting access

Lists employees with their current salary/commission configuration.

Response data

  • id, uuid, name, role_name
  • is_doctor boolean
  • monthly_salary, commission_percentage number | null
PUT /payroll/employees/{userId}/salary Bearer token · accounting access

Sets an employee's base salary and (for doctors) commission rate.

Request

Field Type Notes
monthly_salary number required — min 0
commission_percentage number optional — 0–100, doctors only

Response data

  • (employee salary object)
GET /payroll/salary-advances Bearer token · accounting access

Lists salary advances given to employees.

Request

Field Type Notes
user_id, unsettled_only, per_page (query) optional

Response data

  • [SalaryAdvance object] array
POST /payroll/salary-advances Bearer token · accounting access 201 Created

Records an advance against future salary (posts a negative fund transaction).

Request

Field Type Notes
user_id integer required
amount number required — min 0.01
advance_date date required
note string optional

Response data

  • (SalaryAdvance object)
PUT /payroll/salary-advances/{id} Bearer token · accounting access

Edits an outstanding advance (blocked once settled by a salary payment).

Request

Field Type Notes
amount, advance_date, note optional

Response data

  • (SalaryAdvance object)
DELETE /payroll/salary-advances/{id} Bearer token · accounting access

Removes an outstanding advance (blocked once settled).

GET /payroll/salary-payments Bearer token · accounting access

Lists processed salary payments.

Request

Field Type Notes
user_id, period_year, period_month, per_page (query) optional

Response data

  • [SalaryPayment object] array
POST /payroll/salary-payments Bearer token · accounting access 201 Created

Processes a month's salary payment: nets base salary + doctor commission against unsettled advances, then posts the remainder to the fund.

Request

Field Type Notes
user_id integer required
period_year integer required — 2000–2100
period_month integer required — 1–12
paid_at date required

Response data

  • (SalaryPayment object) — employee must have monthly_salary set; the same employee/period cannot be paid twice
GET /payroll/salary-payments/{id} Bearer token · accounting access

Fetches a single payment's breakdown.

Response data

  • (SalaryPayment object)
PUT /payroll/salary-payments/{id} Bearer token · accounting access

Corrects the paid date — amounts are immutable (delete + recreate to correct those).

Request

Field Type Notes
paid_at date required

Response data

  • (SalaryPayment object)
DELETE /payroll/salary-payments/{id} Bearer token · accounting access

Reverses a payment: un-settles any advances it absorbed and removes its fund transaction.

SalaryPayment object fields

  • id, uuid, user_id, employee_name
  • period_year, period_month
  • base_salary, treatment_revenue, commission_percentage, commission_amount, advances_total, net_amount
  • paid_at, created_at

API Tokens (for integrations)

Manage the long-lived tokens created from Settings > API Token, used to authenticate outside systems (e.g. an X-ray imaging machine) instead of a login session.

GET /settings/api-tokens Bearer token

Lists the current user's own API tokens (never another user's).

Response data

  • id, name, created_at, last_used_at
  • — The plain-text token value is never returned again after creation.
POST /settings/api-tokens Bearer token

Creates a new token. Copy the plain-text value immediately — it is shown only this once.

Request

Field Type Notes
name string required — max 100 — a label to remember what it's for

Response data

  • token: {id, name, created_at, last_used_at} object
  • plain_text_token string — use this as the Bearer token — it has the same access as the account that created it
DELETE /settings/api-tokens/{id} Bearer token

Revokes a token immediately. Any system still using it loses access right away.

Enum reference

Exact valid string values for every enum-backed field referenced above.

Enum Valid values
AppointmentStatus scheduled, completed, no_show, cancelled
AppointmentType booked, unavailable
AttendanceStatus attended, no_show, walk_in
CapitalTransactionType injection, withdrawal
ClientGender male, female
ClientStatus new, under_treatment, completed, inactive
ExpenseCategory dental_supplies, lab_fees, rent, utilities, equipment, marketing, insurance, maintenance, taxes, other
LabCaseStatus sent, in_progress, ready, delivered
LabCaseWorkType crown, bridge, denture_full, denture_partial, veneer, retainer, night_guard, implant_abutment, aligner, other
PaymentMethod cash, card, bank_transfer
SubscriptionStatus active, inactive
UserStatus active, inactive, suspended
Weekday monday, tuesday, wednesday, thursday, friday, saturday, sunday
appointment duration (minutes) 30, 60, 90
BloodType A, B, AB, 0
RhFactor positive, negative
NutritionBodyType athlete, non_athlete
NutritionDietaryType omnivore, vegetarian, vegan, halal, kosher, other
NutritionGoal weight_loss, weight_gain, maintenance, muscle_gain, medical_diet, other
NutritionActivityLevel sedentary, light, moderate, active, very_active
NutritionSubstanceUseStatus none, occasional, regular