Skip to main content
GET
https://{tenantDomain}/api/v2
/
users
/
{id}
/
roles
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using Auth0.ManagementApi.Users;

public partial class Examples
{
    public async Task Example() {
        var client = new ManagementClient(
            token: "<token>"
        );

        await client.Users.Roles.ListAsync(
            id: "id",
            request: new ListUserRolesRequestParameters {
                PerPage = 1,
                Page = 1,
                IncludeTotals = true
            }
        );
    }

}
package example

import (
    context "context"

    management "github.com/auth0/go-auth0/management/management"
    client "github.com/auth0/go-auth0/management/management/client"
    option "github.com/auth0/go-auth0/management/management/option"
    users "github.com/auth0/go-auth0/management/management/users"
)

func do() {
    client := client.NewClient(
        option.WithToken(
            "<token>",
        ),
    )
    request := &users.ListUserRolesRequestParameters{
        PerPage: management.Int(
            1,
        ),
        Page: management.Int(
            1,
        ),
        IncludeTotals: management.Bool(
            true,
        ),
    }
    client.Users.Roles.List(
        context.TODO(),
        "id",
        request,
    )
}
package com.example.usage;

import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.resources.users.roles.requests.ListUserRolesRequestParameters;

public class Example {
    public static void main(String[] args) {
        ManagementApi client = ManagementApi
            .builder()
            .token("<token>")
            .build();

        client.users().roles().list(
            "id",
            ListUserRolesRequestParameters
                .builder()
                .perPage(1)
                .page(1)
                .includeTotals(true)
                .build()
        );
    }
}
<?php

namespace Example;

use Auth0\SDK\API\Management\Management;
use Auth0\SDK\API\Management\Users\Roles\Requests\ListUserRolesRequestParameters;

$client = new Management(
    token: '<token>',
);
$client->users->roles->list(
    'id',
    new ListUserRolesRequestParameters([
        'perPage' => 1,
        'page' => 1,
        'includeTotals' => true,
    ]),
);
from auth0.management import ManagementClient

client = ManagementClient(
    token="<token>",
)

client.users.roles.list(
    id="id",
    per_page=1,
    page=1,
    include_totals=True,
)
require "auth0"

client = Auth0::Management.new(token: "<token>")

client.users.roles.list(
  id: "id",
  per_page: 1,
  page: 1,
  include_totals: true
)
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.users.roles.list("id", {
        perPage: 1,
        page: 1,
        includeTotals: true,
    });
}
main();
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.users.roles.list("id", {
        perPage: 1,
        page: 1,
        includeTotals: true,
    });
}
main();
curl --request GET \
  --url https://{tenantDomain}/api/v2/users/{id}/roles \
  --header 'Authorization: Bearer <token>'
[
  {
    "id": "<string>",
    "name": "<string>",
    "description": "<string>"
  }
]

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

ID of the user to list roles for.

Query Parameters

per_page
integer

Number of results per page.

Required range: 1 <= x <= 100
page
integer

Page index of the results to return. First page is 0.

Required range: x >= 0
include_totals
boolean

Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).

Response

Roles successfully retrieved.

id
string

ID for this role.

name
string

Name of this role.

description
string

Description of this role.