Quickstart
This guide walks through verifying your session and listing patients. Cleos has no separate API host: use your app origin plus /api.
Sign in through the Cleos web app to receive a JWT in the auth-token cookie, or pass the same token with Authorization: Bearer.
Prerequisites
- A Cleos user with an organization and current branch
JWT_SECRET-signed token from login (7-day cookie lifetime by default)- Local base URL
http://localhost:3000or your deployedNEXT_PUBLIC_APP_URL
GET/api/auth/me
Get current user
Returns the authenticated user, organization, branch scope, and permission deniedKeys for the custom role.
Request
GET
/api/auth/mecurl http://localhost:3000/api/auth/me \
-H "Authorization: Bearer YOUR_JWT"
Response
{
"user": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"email": "doctor@clinic.example",
"fullName": "Dr. Lee",
"role": "DOCTOR",
"organizationId": "org-uuid",
"currentBranchId": "branch-uuid",
"deniedKeys": []
}
}
List patients
GET/api/patients
List patients
Paginated patient registry for the current data scope. Supports search, filters, and sorting.
Query parameters
- Name
page- Type
- integer
- Description
Page number (default
1).
- Name
pageSize- Type
- integer
- Description
Page size (default
20, max100).
- Name
search- Type
- string
- Description
Search name, email, phone, patient number, or IC.
- Name
branchId- Type
- string
- Description
Filter by branch when centralization allows.
Request
GET
/api/patientscurl -G http://localhost:3000/api/patients \
-H "Authorization: Bearer YOUR_JWT" \
-d page=1 \
-d pageSize=20
Response
{
"data": [
{
"id": "patient-uuid",
"patientName": "Ahmad bin Ali",
"patientNumber": "P-00042",
"category": "GREEN_FLAG"
}
],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 1,
"totalPages": 1
}
}
Next steps
- Authentication — cookies, bearer tokens, and scopes
- Patients — create and update patients
- Pagination — list response shapes across resources