Skip to main content

List User's Accounts

GET/user-accounts/user/{userId}
Get all accounts a specific user has access to. Returns each account along with the user's role(s) for that account. This is useful for building user profile pages or account switchers. Remember: users can belong to multiple accounts with different permissions in each.

When to use this

  • Building an account switcher in your app
  • Showing a user's access across the organisation
  • Reviewing permissions before removing a user

Parameters

userIdpathrequired
string

User ID

Response

Role assignments retrieved

Notes

ℹ️A user's available actions depend on their role in the currently selected account.
💡Use this to populate account dropdowns in your UI.
Code Samples

List User Account Roles By User using the TypeScript SDK:

import { BackstageClient } from '@ticketlayer/backstage';

const client = new BackstageClient({
organisationSlug: 'your-org',
});
client.setAccessToken('YOUR_ACCESS_TOKEN');

// List useraccountrolesbyuser
const { useraccountrolesbyuser, pagination } = await client.useraccountrolesbyuser.list({
limit: 20,
page: 1,
});

for (const item of useraccountrolesbyuser) {
console.log(`${item.id}: ${item.name || item.id}`);
}

console.log(`Page ${pagination.page} of ${pagination.totalPages}`);

Try It

Path Parameters
User ID

Related