Skip to content
Docs
Operation

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

Path parameters

userIdstringRequired
User ID

Returns

Role assignments retrieved

Errors

400
Bad Request - Invalid input
401
Unauthorized - Authentication required
403
Forbidden - Insufficient permissions
404
Not Found - Resource not found
500
Internal Server Error

Every error names its code and links to it. All error codes

Notes

Note
A user's available actions depend on their role in the currently selected account.
Tip
Use this to populate account dropdowns in your UI.

Related

import { BackstageClient } from '@ticketlayer/backstage';const client = new BackstageClient({  organisationSlug: 'your-org',});client.setAccessToken('YOUR_ACCESS_TOKEN');// List useraccountrolesbyuserconst { 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}`);
Response 200
{
  "assignments": [
    {
      "id": "uar_abc123",
      "organisationId": "org_xyz789",
      "userId": "usr_abc123",
      "accountId": "acc_xyz789",
      "roleId": "rol_system_event_manager",
      "createdAt": "2024-01-15T10:30:00Z",
      "user": {
        "id": "string",
        "email": "string",
        "firstName": "string",
        "lastName": "string"
      },
      "account": {
        "id": "string",
        "name": "string"
      },
      "role": {
        "id": "string",
        "name": "string",
        "isSystemRole": true
      }
    }
  ]
}

Try it in test mode

Path parameters
User ID