API Reference
Full method reference for MediquoApiChatClient and its sub-clients.
MediquoApiChatClient
import { MediquoApiChatClient } from "@mediquo/core/api-client";
const client = new MediquoApiChatClient(config?);Constructor
| Option | Type | Default | Description |
|---|---|---|---|
env | "production" | "development" | "production" | Selects the base URL for the target environment. |
baseURL | string | — | Overrides env. Use for proxies or custom deployments. |
Methods
| Method | Signature | Description |
|---|---|---|
setAuthToken | (token: string) => void | Sets Authorization: Bearer <token> on all subsequent requests. |
setApiKey | (apiKey: string) => void | Sets the x-api-key header on all subsequent requests. |
setLanguage | (language: string) => void | Sets the Accept-Language header on all subsequent requests. |
Sub-clients
| Property | Type |
|---|---|
client.auth | ApiChatAuthClient |
client.appointments | ApiChatAppointmentsClient |
client.schedules | ApiChatSchedulesClient |
client.rooms | ApiChatRoomsClient |
client.profile | ApiChatProfileClient |
client.professionals | ApiChatProfessionalsClient |
client.organizations | ApiChatOrganizationsClient |
client.payments | ApiChatPaymentsClient |
client.flash | ApiChatFlashClient |
client.documents | ApiChatDocumentsClient |
auth
import type { LoginTokenRequest, LoginTokenResponse } from "@mediquo/core/api-client/auth";loginToken(request)
Exchanges an API key + patient token for a session access_token.
const { data } = await client.auth.loginToken({
api_key: "your-api-key",
token: "patient-token",
});
// data.access_token — use with setAuthToken()Request
| Field | Type | Description |
|---|---|---|
api_key | string | Your platform API key. |
token | string | Patient-scoped token issued by your backend. |
Response
| Field | Type | Description |
|---|---|---|
access_token | string | JWT to pass to setAuthToken(). |
patient | object | Patient profile and legal consent state. |
appointments
import type { ... } from "@mediquo/core/api-client/appointments";getAppointments(request)
Returns the authenticated patient's appointment list.
| Field | Type | Description |
|---|---|---|
| (no required fields) | — | All filters are optional. |
createAppointment(request)
Books a new appointment.
| Field | Type | Description |
|---|---|---|
slot_id | string | ID of the schedule slot to book. |
channel | AppointmentChannel | "videocall" | "chat" | "phonecall" |
consultation_reason | string | Optional reason for the appointment. |
getAppointment(request)
Fetches a single appointment by ID.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the appointment. |
rescheduleAppointment(request)
Moves an existing appointment to a new slot.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the appointment to reschedule. |
slot_id | string | UUID of the new slot. |
cancelAppointment(request)
Cancels an appointment.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the appointment to cancel. |
updateAppointment(request)
Updates mutable fields on an appointment.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the appointment. |
consultation_reason | string | Updated consultation reason. |
addDocument(request) / deleteDocument(request)
Attaches or removes a pre-consultation document from an appointment.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the appointment. |
document_id | string | UUID of the document. |
getDocumentsStorage()
Returns available storage quota for appointment documents.
reconnectAppointment(request)
Signals a reconnect intent for an in-progress appointment.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the appointment. |
schedules
import type { ... } from "@mediquo/core/api-client/schedules";getScheduleServices()
Returns the list of bookable services for the authenticated organization.
getProfessionalsBySpecialtyAndService(request)
Returns professionals available for a given specialty and service combination.
| Field | Type | Description |
|---|---|---|
specialty_id | number | ID of the medical specialty. |
service_id | string | UUID of the service. |
getScheduleServiceProfessionalSlots(request)
Returns available slots for a professional within a service.
| Field | Type | Description |
|---|---|---|
service_id | string | UUID of the service. |
professional_id | string | UUID of the professional. |
getScheduleSlot(request)
Fetches a single schedule slot by ID.
| Field | Type | Description |
|---|---|---|
slot_id | string | UUID of the slot. |
rooms
import type { ... } from "@mediquo/core/api-client/rooms";getRoomMessages(request)
Returns the message history for a chat room.
| Field | Type | Description |
|---|---|---|
room_id | string | ID of the chat room. |
getUnreadMessagesCount(request)
Returns the unread message count for a room.
| Field | Type | Description |
|---|---|---|
room_id | string | ID of the chat room. |
profile
import type { ... } from "@mediquo/core/api-client/profile";getPatientProfile()
Returns the authenticated patient's full profile.
getProfessionalPublicProfile(request)
Returns a professional's public-facing profile.
| Field | Type | Description |
|---|---|---|
professional_id | string | UUID of the professional. |
acceptLegalConsent(request)
Records the patient's acceptance of legal consent terms.
| Field | Type | Description |
|---|---|---|
consent_id | string | ID of the consent document accepted. |
professionals
import type { ... } from "@mediquo/core/api-client/professionals";getProfessional(request)
Fetches a professional's full record.
| Field | Type | Description |
|---|---|---|
professional_id | string | UUID of the professional. |
readAllMessages(request)
Marks all messages in a professional's room as read.
| Field | Type | Description |
|---|---|---|
professional_id | string | UUID of the professional. |
organizations
import type { ... } from "@mediquo/core/api-client/organizations";getOrganizationSpecialties()
Returns the specialties configured for the authenticated organization.
getOrganizationSetup()
Returns the full setup configuration for the organization (feature flags, branding, enabled modules).
payments
import type { ... } from "@mediquo/core/api-client/payments";createPaymentLink(request)
Generates a payment link for an appointment.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the appointment to pay for. |
Response
| Field | Type | Description |
|---|---|---|
url | string | Redirect URL for the payment flow. |
getPaymentSession(sessionId)
Retrieves the state of an existing payment session.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Payment session identifier. |
flash
Flash appointments are immediate, on-demand consultations with a shorter lifecycle than scheduled ones.
import type { ... } from "@mediquo/core/api-client/flash";getAppointment(request)
Returns a flash appointment by ID.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the flash appointment. |
joinCall(request)
Joins an active flash call session.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the flash appointment. |
Response
| Field | Type | Description |
|---|---|---|
call_token | string | Token for the video/audio call session. |
setReady(request)
Signals that the patient is ready to start the flash call.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the flash appointment. |
getSharedDocuments(request) / downloadDocument(request)
Lists or downloads documents shared during a flash session.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the flash appointment. |
document_id | string | (download only) UUID of the document. |
downloadDocument returns a Blob.
updatePatientProfile(request)
Updates the patient's profile within the flash flow.
getPatientDocuments(request)
Returns the patient's document list in the context of a flash appointment.
| Field | Type | Description |
|---|---|---|
appointment_id | string | UUID of the flash appointment. |
documents
import type { ... } from "@mediquo/core/api-client/documents";uploadFile(request)
Uploads a file as a multipart form submission.
| Field | Type | Description |
|---|---|---|
file | File | Blob | The file to upload. |
appointment_id | string | UUID of the appointment to attach the file to. |
Response
| Field | Type | Description |
|---|---|---|
document_id | string | UUID of the created document. |
file_path | string | Storage path of the uploaded file. |
file_name | string | Original filename. |