Meta · whoami

ตรวจสอบ token + scopes

Meta · whoami

Introspection แบบเบา ใช้ดูว่า token ที่ส่งมา map ไป business + scope อะไรบ้าง — เหมาะกับการ debug ระหว่าง dev / on-call หน้าตา response ขึ้นกับ ระดับ ของ key (business หรือ account) แยกด้วยฟิลด์ level

GET /meta/whoami

Token introspection

curl https://phone.mcloud.co.th/api/v1/meta/whoami \
  -H "Authorization: Bearer crk_..."

Business key

Business key map ไปยัง business เดียว พร้อม scope ที่ key นั้นถืออยู่

{
  "level": "business",
  "business": {
    "id": "0192...",
    "name": "Acme Co",
    "slug": "acme"
  },
  "scopes": [
    "view_recording_all",
    "manage_recording_review"
  ]
}

Account key

Account key ไม่ผูกกับ business — มีสิทธิ์เต็ม (manage_all) ในทุก business ที่เจ้าของเป็นสมาชิก เรียก whoami โดยไม่ต้องส่ง header X-Business-Id เพื่อดูรายการ business id ที่ใช้กับ endpoint อื่นได้ ฟิลด์ businesses คือรายการเป้าหมายเหล่านั้น

{
  "level": "account",
  "userId": "0192...",
  "scopes": ["manage_all"],
  "businesses": [
    { "id": "0192...", "name": "Acme Co", "slug": "acme" },
    { "id": "0193...", "name": "Globex", "slug": "globex" }
  ]
}

สำหรับ account key ทุก endpoint อื่นต้องส่ง header X-Business-Id: <business id> เพื่อเลือกว่า request จะทำงานกับ business ไหน ดูเพิ่มที่ Getting started → API Key ระดับบัญชี

เอกสาร API