Identitas token dan izin efektif
Identitas teknis klien API (pengguna API: <nama>), izin RBAC hasil scope token, cabang aktif, dan entitlement paket. Berguna untuk memeriksa scope sebelum memanggil endpoint lain.
- Scope
- Token apa pun
Parameter
| Nama | Lokasi | Tipe | Keterangan |
|---|---|---|---|
| X-Branch-ID | header | string (uuid) | Cabang aktif (opsional). Nilai di luar cabang klien diabaikan. |
Contoh kode
curl -X GET "https://api.medivana.cloud/api/v1/me" \
-H "Authorization: Bearer $MEDIVANA_TOKEN"const res = await fetch("https://api.medivana.cloud/api/v1/me", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.MEDIVANA_TOKEN}`,
},
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
const data = await res.json();import os
import requests
resp = requests.get(
"https://api.medivana.cloud/api/v1/me",
headers={"Authorization": f"Bearer {os.environ['MEDIVANA_TOKEN']}"},
timeout=30,
)
resp.raise_for_status()
data = resp.json()Respons
200Konteks tokenapplication/json
{
"user_id": "3f0c2a10-5b7e-4c1d-9a2e-000000000a11",
"email": "mdn_ci_7f3k2q9x",
"name": "API: Integrasi HIS",
"org": {
"id": "3f0c2a10-5b7e-4c1d-9a2e-000000000001",
"name": "Klinik Sehat Contoh",
"slug": "klinik-sehat-contoh",
"clinic_kind": "pratama",
"status": "active",
"demo_expires_at": null,
"default_locale": "id"
},
"branch_id": null,
"branches": [],
"roles": [
"api_client"
],
"permissions": [
"encounter.read",
"patient.read",
"webhook.manage"
],
"data_scope": "org",
"two_factor": true,
"entitlements": {
"plan": "klinik_pro",
"plan_name": "Klinik Pro",
"status": "active",
"modules": {
"api": true,
"frontoffice": true,
"rme": true,
"booking": true
}
},
"is_demo": false,
"break_glass": false,
"locale": "id",
"effective_locale": "id"
}Skema 200
| Nama | Tipe | Keterangan |
|---|---|---|
| user_id | string (uuid) | Identitas teknis klien API |
| string | client_id klien | |
| name | string | |
| org | object | |
| branch_id | string (uuid) | null | Cabang aktif permintaan ini |
| branches | array<object> | |
| branches[].id | string (uuid) | |
| branches[].code | string | |
| branches[].name | string | |
| branches[].address | string | null | |
| branches[].city | string | null | |
| branches[].phone | string | null | |
| branches[].latitude | number | null | |
| branches[].longitude | number | null | |
| branches[].geofence_m | integer | |
| branches[].satusehat_location_ihs | string | null | |
| branches[].bpjs_ppk_code | string | null | |
| branches[].is_active | boolean | |
| branches[].version | integer | |
| roles | array<string> | |
| permissions | array<string> | Izin RBAC hasil scope token |
| data_scope | string | |
| two_factor | boolean | |
| entitlements | object | |
| entitlements.org_id | string (uuid) | |
| entitlements.plan | string | |
| entitlements.plan_name | string | |
| entitlements.status | active | grace | read_only | cancelled | none | |
| entitlements.billing_cycle | string | |
| entitlements.branches | integer | |
| entitlements.modules | object | |
| entitlements.limits | object | |
| entitlements.addons | array<string> | |
| entitlements.bi_level | string | |
| entitlements.accounting_level | string | |
| entitlements.current_period_end | string (date-time) | |
| entitlements.grace_until | string (date-time) | |
| entitlements.is_demo | boolean | |
| is_demo | boolean | |
| break_glass | boolean | |
| locale | string | |
| effective_locale | string |
Galat
- 401
unauthorizedToken tidak ada, tidak valid, kedaluwarsa, atau dicabut - 429
rate-limitedBatas laju klien (rate_limit_per_min) terlampaui; coba lagi pada menit berikutnya