Account Context And Members
Purpose: select account scope and inspect account membership before credential or provider operations.
UI Flow
- UI calls
GET /api/accountsto list accessible accounts. - User selects active account.
- UI persists account context via
POST /api/account-views/switch. - UI loads
GET /api/accounts/:account_id. - UI loads
GET /api/accounts/:account_id/members. - Owner can create child account with
POST /api/accounts. - Owner can update account display values with
PATCH /api/accounts/:account_id. - Owner can add/remove members with
/api/accounts/:account_id/members*. - UI stores
account_idin route state and prefixes all subsequent account-scoped calls.
Client Library Flow
const accounts = await api.accounts.list();
const active = selectAccount(accounts.data);
const account = await api.accounts.get(active.id);
const members = await api.members.list(active.id);
HTTP/curl Flow
API_BASE_URL="https://api.inbox-manager.com"
curl -sS "${API_BASE_URL}/api/accounts" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS -X POST "${API_BASE_URL}/api/account-views/switch" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data "{\"account_id\":\"${ACCOUNT_ID}\"}"
curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/members" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS -X POST "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/members/search" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data '{"query":"owner","limit":20,"offset":0}'
curl -sS -X POST "${API_BASE_URL}/api/accounts" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data '{"name":"Operations"}'
curl -sS -X PATCH "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data '{"name":"Operations Team"}'
curl -sS -X POST "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/members" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data '{"user_id":"uid_target","role":"member"}'
curl -sS -X PATCH "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/members/${MEMBER_ID}" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data '{"role":"owner"}'
curl -sS -X DELETE "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/members/${MEMBER_ID}" \
-H "authorization: Bearer ${BEARER_TOKEN}"
Notes
- Account path mismatch returns
403. - Membership endpoints are account-scoped and role-gated.
- Account/member write endpoints require
ownerrole. - Member creation supports
memberandviewer; ownership promotion uses patch. - Owner self-demotion and self-membership removal are blocked.
- Last-owner demotion or deletion returns
409.