Skip to main content

ListUsers

Returns all users accessible within the authenticated group's hierarchy.

Results include users directly owned and those accessible through the group's hierarchical permissions, optionally sorted by email address.

Method Options​

Authorisation specification of the ListUsers method.

TypeMETHOD_TYPE_READ
Access LevelMETHOD_ACCESS_LEVEL_AUTHORISED
Roles
  • ROLE_IAM_ADMIN
  • ROLE_IAM_VIEWER
  • ROLE_IAM_USER_ADMIN
  • ROLE_IAM_USER_VIEWER

Parameters​

Request and response parameter message overview:

Input: ListUsersRequest Message​

FieldTypeRequiredDescription
Sorting
FieldTypeRequiredDescription
FieldstringFalseField to sort by (e.g., "email").
Ordermeshtrade.type.v1.SortingOrderFalseSort order for results.
False

Optional sorting configuration.

Returns: ListUsersResponse Message​

FieldTypeDescription
Users

meshtrade.iam.user.v1.User[]

Code Examples​

Select supported SDK in the language of your choice for a full example of how to invoke the this method:

package main

import (
"context"
"log"

userv1 "github.com/meshtrade/api/go/iam/user/v1"
typev1 "github.com/meshtrade/api/go/type/v1"
)

func main() {
ctx := context.Background()

// Default configuration is used and credentials come from MESH_API_CREDENTIALS
// environment variable or default discovery methods. Zero config required
// unless you want custom configuration.
service, err := userv1.NewUserService()
if err != nil {
log.Fatalf("Failed to create service: %v", err)
}
defer service.Close()

// Create request with optional sorting
request := &userv1.ListUsersRequest{
Sorting: &userv1.ListUsersRequest_Sorting{
Field: "email", // Sort by email address
Order: typev1.SortingOrder_SORTING_ORDER_ASC,
},
}

// Call the ListUsers method
response, err := service.ListUsers(ctx, request)
if err != nil {
log.Fatalf("ListUsers failed: %v", err)
}

// Process the user directory
log.Printf("Found %d users in the accessible hierarchy:", len(response.Users))
for i, user := range response.Users {
log.Printf("User %d:", i+1)
log.Printf(" Name: %s", user.Name)
log.Printf(" Email: %s", user.Email)
log.Printf(" Owner: %s", user.Owner)
log.Printf(" Roles: %d assigned", len(user.Roles))
log.Println()
}

}

Advanced Configuration​

For advanced client configuration options (custom endpoints, TLS settings, timeouts), see the SDK Configuration Guide.

Other Methods​