Genervaria
Back to site

Reference

Genervaria API

Every endpoint that powers the Genervaria 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://dev.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://dev.doctovaria.com.tr/api/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, their legacy per-tooth treatment record, visits, and payments.

GET /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 /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 /clients/{id} Bearer token

Fetches a patient's full profile.

Response data

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

Updates patient details.

Request

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

Response data

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

Deletes a patient record.

GET /clients/{id}/treatment-record Bearer token

Fetches the client's legacy tooth-by-tooth treatment record (auto-created empty on first call).

Response data

  • id, uuid, client_id, treatment_plan, currency_code, notes
  • teeth array — [{id, tooth_number, treatment_catalog_id, treatment_code, treatment_name, unit_price, notes}]
PUT /clients/{id}/treatment-record Bearer token

Replaces the client's treatment-record tooth line items.

Request

Field Type Notes
treatment_plan, currency_code, notes string optional
teeth array optional — each: {tooth_number, treatment_catalog_id, unit_price, notes}

Response data

  • (treatment record object)
GET /clients/{id}/visits Bearer token

Lists a client's visit history.

Response data

  • [Visit object] array
POST /clients/{id}/visits Bearer token 201 Created

Records an ad-hoc visit (walk-in, not tied to check-in).

Request

Field Type Notes
doctor_id integer required
appointment_id integer optional
visit_date date required
start_time string (H:i) optional
duration_minutes integer optional
summary, notes string optional
charge_items array optional — each: {description, amount}

Response data

  • (Visit object)
PUT /visits/{id} Bearer token

Edits a visit and its charge items.

Request

Field Type Notes
(same as create, all optional)
attendance_status enum optional — attended, no_show, walk_in

Response data

  • (Visit object)
DELETE /visits/{id} Bearer token

Deletes a visit and its charges.

GET /clients/{id}/payments Bearer token

Lists a client's payments.

Response data

  • [Payment object] array
POST /clients/{id}/payments Bearer token 201 Created

Records a payment (also posts a fund transaction and auto-creates an invoice).

Request

Field Type Notes
visit_id integer optional
payment_date date required
amount number required — min 0.01
payment_method enum required — cash, card, bank_transfer
notes string optional

Response data

  • (Payment object)
PUT /payments/{id} Bearer token

Edits a payment (also updates the linked fund transaction/invoice).

Request

Field Type Notes
(same as create, all optional)

Response data

  • (Payment object)
DELETE /payments/{id} Bearer token

Deletes a payment, its fund transaction, and its invoice.

GET /clients/{id}/appointments Bearer token

Lists a client's appointment history.

Response data

  • [Appointment object] array

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 }

Invoices

Invoices are generated automatically as a side effect of the Payments endpoints — there is no create/update/delete endpoint for them directly.

GET /invoices/{id} Bearer token

Fetches a single auto-generated invoice.

Response data

  • id, uuid, invoice_number, formatted_number string — formatted_number e.g. INV-000123
  • amount, issued_date
  • client: {id, name, phone} object
  • payment: {id, payment_method, notes} object

AI Treatment Plan

Restricted to doctors and system managers. Turns a case description (typed or transcribed from audio) into a structured, multi-session treatment plan via OpenAI, which is only persisted once the doctor confirms it.

POST /clients/{id}/ai-treatment-plan Bearer token · doctor/manager

Generates a draft multi-session plan from a case description (not yet persisted).

Request

Field Type Notes
description string required — max 2000 — required unless audio is sent
audio file optional — multipart, mp3/wav/m4a/webm/ogg, max 20MB
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, odontogram_v2_status}
POST /clients/{id}/ai-treatment-plan/transcribe Bearer token · doctor/manager

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 /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, odontogram_v2_status (JSON string), charge_items[]}

Response data

  • [Appointment object] array
POST /clients/{id}/ai-treatment-plan/charge Bearer token · doctor/manager 201 Created

Appends one-off manual charges/discounts on top of an already-confirmed plan.

Request

Field Type Notes
charge_items array required — min 1, each: {description, amount} — amount can be negative for a discount

Response data

  • total_services_amount, total_paid_amount, remaining_amount number

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 the check-in / no-show actions that turn a scheduled appointment into a Visit.

GET /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 /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 /appointments/{id} Bearer token

Fetches a single appointment.

Response data

  • (Appointment object)
PUT /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 /appointments/{id} Bearer token

Deletes an appointment and any charges tied to it.

POST /appointments/{id}/check-in Bearer token

Converts a scheduled appointment into a completed Visit.

Request

Field Type Notes
summary, notes string optional
create_payment_after_visit boolean optional
charge_items array optional

Response data

  • (Visit object)
  • — Only scheduled appointments without an existing visit can be checked in.
POST /appointments/{id}/no-show Bearer token

Marks an appointment as a no-show and clears any charges tied to it.

Request

Field Type Notes
notes string optional

Response data

  • (Visit object)

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" | "checkin" | "manage" (computed)
  • is_past, is_future, is_within_one_hour (booleans)

Dashboard

GET /dashboard/stats Bearer token

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

Request

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

Response data

  • appointments.total, appointments.by_status object
  • income.total, income.by_method, income.by_day object

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