All examples authenticate with an SSH private key — replace
<private_key_path> with the path to your key. See Authentication. US platform users should add domain="https://api.us.encord.com" to create_with_ssh_private_key.Organization members
Before a user can be added to a group, they must be a member of your organization. Use theseEncordUserClient methods to manage organization membership. Managing members requires organization admin permissions.
member_type is either "internal" (a member of your organization) or "external" (a collaborator, e.g. from another company).
Manage organization members
Create and manage groups
You can create and manage user groups directly with the SDK. The calling user is automatically added as a manager of any group they create.You can also create user groups in the Encord platform.
Create and manage a group
Manage group membership
Add and remove the users that belong to a group. All emails must already belong to members of your organization (see Organization members).Manage group membership
List user groups
Listing user groups returns a list of all user group names.List all user groups in your Workspace
You can list all users groups that currently exist within your Workspace. In the following script, ensure that you replace <private_key_path> with the path to your private key.List user groups for Projects / Datasets / Ontologies
You can list all existing user groups for a specific Project. In the following script, ensure that you:- Replace <private_key_path> with the path to your private key.
- If you are using the Project script, replace <project_hash> with the hash of the Project you want to list user groups for.
- If you are using the Dataset script, replace <dataset_hash> with the hash of the Dataset you want to list user groups for.
- If you are using the Ontology script, replace <ontology_hash> with the hash of the Ontology you want to list user groups for.
Assign users directly to Projects / Datasets
As well as adding whole groups, you can add individual users to a Project or Dataset and set the role they hold there. Adding a user who already has access leaves their existing role unchanged.Projects
ProjectUserRole supports read-only viewers via VIEWER:
Manage project users
Datasets
DatasetUserRole is either ADMIN or USER.
Manage dataset users
Add user groups
User groups can be added to Projects, Datasets, and Ontologies.Add user group to Projects
Use the following scripts to add user groups to a Project.Only group members are added, not group managers.
- Replace <private_key_path> with the path to your private key.
- Replace <project_hash> with the hash of the Project you want to add a user group to.
- Replace <group_name1> and <group_name2> with the name of the user group(s) you want to add to the Project. You can add one or multiple groups to a Project at once.
Add user group to Datasets
User groups can be added to Datasets. In the following scripts, ensure that you:- Replace <private_key_path> with the path to your private key.
- Replace <dataset_hash> with the hash of the Dataset you want to add a user group to.
- Replace <group_name1> and <group_name2> with the name of the user group(s) you want to add to the Dataset. You can add one or multiple groups to a Dataset at once.
Add user group to Ontologies
Use the following scripts to add user groups to Ontologies. In the following scripts, ensure that you:- Replace <private_key_path> with the path to your private key.
- Replace <ontology_hash> with the hash of the Ontology you want to add a user group to.
- Replace <group_name1> and <group_name2> with the name of the user group(s) you want to add to the Ontology. You can add one, or multiple groups to an Ontology at once.
Remove user groups from Projects / Datasets / Ontologies
User groups can be removed from Projects, Datasets, and Ontologies individually, or in bulk.Admins can only be removed from Projects, Datasets, or Ontologies by Workspace admins.
- Replace
<private_key_path>with the path to your private key. - If using the Project script, replace
<project_hash>with the hash of the Project you want to remove user groups from. - If using the Dataset script, replace
<dataset_hash>with the hash of the Dataset you want to remove user groups from. - If using the Ontology script, replace
<ontology_hash>with the hash of the Ontology you want to remove user groups from. - Replace
<group_name1>and<group_name2>with the name of the user group(s) you want to remove from the Project. You can remove one, or multiple groups from a Project at once.

