List My Accounts
Lists every account you belong to — accounts you own plus any you've joined via an invitation. This is the endpoint that backs an account switcher: it tells you, per account, your role and which one is currently active so you can highlight the selection and offer the others.
This call is about you, not the active account, so it works regardless of which account your token is scoped to. To change the active account, pass an id from this list to /user/switch-account.
Response (200 OK)
accounts object[]
Every account you're an active member of. See the per-entry fields below.
active_account_id int64
The account your current token is scoped to.
null if none is selected. Matches the entry whose is_active is true.Account entry fields
id int64
Account ID. Pass this to /user/switch-account.
name string
Account display name.
is_active bool
true for the account your token is currently scoped to.is_default bool
true for the account created automatically when you registered.is_owner bool
true when you own this account.role_label string
Your role in the account —
"Owner" or the name of your assigned role.Errors
401 Unauthorized
Missing or invalid auth.
Request
curl "https://api.ngris.com/v1/user/accounts" \
-H "X-API-KEY: <your_api_key>"
Python
from ngris import Ngris
client = Ngris(api_key="<your_api_key>")
result = client.users.list_accounts()
for acct in result["accounts"]:
print(acct["name"], acct["role_label"], acct["is_active"])
Response — 200 OK
{
"accounts": [
{
"id": 42,
"name": "Acme Engineering",
"is_active": true,
"is_default": true,
"is_owner": true,
"role_label": "Owner"
},
{
"id": 87,
"name": "Client Project",
"is_active": false,
"is_default": false,
"is_owner": false,
"role_label": "Developer"
}
],
"active_account_id": 42
}