Get My Roles
GET
/me/rolesSee what roles the current user has.
Roles determine what a user can do-an "Event Manager" might be able to create
events but not manage billing, while an "Admin" can do everything.
This returns all the roles assigned to the current user, which you can use to
show or hide features in your UI.
When to use this
- Showing the user's role on their profile page
- Deciding which navigation items to display
- Checking if a user has admin access
Response
Roles retrieved successfully
Notes
💡For checking specific permissions, use `getMyPermissions` instead-it gives you the actual permission strings you can check against.
Code Samples
Get My Roles using the TypeScript SDK:
import { BackstageClient } from '@ticketlayer/backstage';
const client = new BackstageClient({
organisationSlug: 'your-org',
});
client.setAccessToken('YOUR_ACCESS_TOKEN');
// Get myrole details
const myrole = await client.users.get('{{MYROLES_ID}}');
console.log(`MyRoles: ${myrole.name || myrole.id}`);