NYYU Logo
APIUser

Create New User by Admin

Admin operation to create a new user account with auto-generated password

Create New User by Admin

ADMIN

Administrative mutation to create a new user account. Password is auto-generated and sent to the user via email.

Mutation

GraphQL Schema

createNewUser(
  email: String!
  country: String!
  role: String!
  avatarName: String!
  shortName: String!
): String

Parameters

emailString!
Required

User's email address. Must be unique and valid format

countryString!
Required

User's country code (ISO 3166-1 alpha-2)

roleString!
Required

User role: "ROLE_USER" or "ROLE_ADMIN"

avatarNameString!
Required

Avatar prefix for the user (e.g., "Tesla")

shortNameString!
Required

User's display short name (e.g., "User.01")

Example Usage

mutation {
  createNewUser(
    email: "newuser@example.com"
    country: "USA"
    role: "ROLE_USER"
    avatarName: "Tesla"
    shortName: "User.123"
  )
}
{
  "data": {
    "createNewUser": "Success - User created and password sent via email"
  }
}
const mutation = `
  mutation CreateUser(
    $email: String!
    $country: String!
    $role: String!
    $avatarName: String!
    $shortName: String!
  ) {
    createNewUser(
      email: $email
      country: $country
      role: $role
      avatarName: $avatarName
      shortName: $shortName
    )
  }
`;

const result = await client.request(mutation, {
  email: 'newuser@example.com',
  country: 'USA',
  role: 'ROLE_USER',
  avatarName: 'Tesla',
  shortName: 'User.123',
});

Security Considerations

Admin Access Only

This operation requires ROLE_ADMIN privileges.

Password Security

Auto-generated passwords are securely hashed and sent via encrypted email. Users should change their password on first login.

Email Verification

New users receive a verification email. They must verify their email before accessing full features.