Skip to main content

CreateGroup

Creates a new child group within the authenticated group's hierarchy.

The new group inherits access from its parent and becomes part of the organizational structure. Group ownership must match the executing context.

Method Options​

Authorisation specification of the CreateGroup method.

TypeMETHOD_TYPE_WRITE
Access LevelMETHOD_ACCESS_LEVEL_AUTHORISED
Roles
  • ROLE_IAM_ADMIN
  • ROLE_IAM_GROUP_ADMIN

Parameters​

Request and response parameter message overview:

Input: CreateGroupRequest Message​

FieldTypeRequiredDescription
Group

meshtrade.iam.group.v1.Group

True

The group configuration for creation. The name field will be ignored and assigned by the system.

Returns: Group Message​

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"

groupv1 "github.com/meshtrade/api/go/iam/group/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 := groupv1.NewGroupService()
if err != nil {
log.Fatalf("Failed to create service: %v", err)
}
defer service.Close()

// Get current executing group to use as owner for the new child group
// Note: Owner format is "groups/{ULIDv2}" (e.g. "groups/01HZ2XWFQ4QV2J5K8MN0PQRSTU")
// but you can only create groups owned by your authenticated context

// Create request with group configuration
request := &groupv1.CreateGroupRequest{
Group: &groupv1.Group{
Owner: service.Group(), // Current executing group becomes the parent
DisplayName: "Trading Team Alpha",
Description: "Primary trading team for equity markets and derivatives",
},
}

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

// Use the newly created group
log.Printf("Group created successfully:")
log.Printf(" Name: %s", group.Name)
log.Printf(" Display Name: %s", group.DisplayName)
log.Printf(" Owner: %s", group.Owner)
log.Printf(" Description: %s", group.Description)

// The group can now be used to own resources and manage users
log.Printf("Group is ready to own API users, accounts, and trading resources")
}

Advanced Configuration​

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

Other Methods​