NYYU Logo
APIProfile

Set Avatar

Create unique user avatar identity during account registration with prefix and name combinations

NEW USER SETUP

Set Avatar

Create a unique avatar identity during account creation with customizable prefix and name combinations.

Registration Step

This mutation is called during the account setup flow after completing 2FA authentication.

Overview

The setAvatar mutation allows new users to establish their avatar identity by choosing a prefix (avatar type) and name combination. This creates a unique identifier that represents the user throughout the platform.


GraphQL Schema

mutation {
  setAvatar(
    prefix: String!
    name: String!
  ): String
}

Parameters

prefix

Required

String

The avatar short name or prefix that categorizes the avatar type (e.g., "Tesla", "Edison", "Curie").

name

Required

String

User-defined or auto-generated identifier number that makes the avatar unique when combined with the prefix.


Return Values

Success

Avatar was successfully set and associated with the user's account. The user can now proceed to platform features.

⚠️Already Exists

An avatar with the given prefix and name combination already exists. The user must choose a different name or prefix.


Example Usage

Request

mutation SetUserAvatar {
  setAvatar(
    prefix: "Tesla"
    name: "12"
  )
}

Successful Response

{
  "data": {
    "setAvatar": "Success"
  }
}

Avatar Created

Avatar Tesla#12 has been successfully created and linked to the user account.

Duplicate Response

{
  "data": {
    "setAvatar": "Already Exists"
  }
}

Duplicate Avatar

The combination Tesla#12 is already taken. Please choose a different name or prefix.


Avatar Identity System

How Avatar Identities Work

🏷️

Prefix System

The prefix represents the avatar category or theme (e.g., scientist names, historical figures, mythological characters).

TeslaEdisonCurieNewton

🔢

Name Component

The name is typically a number or string that uniquely identifies each avatar within a prefix category.

142999alpha

🎭

Complete Identity

The combination creates a unique avatar identity displayed throughout the platform:

Tesla#12 • Edison#7 • Curie#314


Implementation Example

Registration Flow Integration

// Example: Avatar selection during registration
async function completeRegistration(userId, selectedPrefix, selectedName) {
  try {
    const result = await graphqlClient.mutate({
      mutation: gql`
        mutation SetAvatar($prefix: String!, $name: String!) {
          setAvatar(prefix: $prefix, name: $name)
        }
      `,
      variables: {
        prefix: selectedPrefix,
        name: selectedName
      }
    });

    if (result.data.setAvatar === "Success") {
      // Avatar set successfully, proceed to dashboard
      redirectToDashboard();
    } else if (result.data.setAvatar === "Already Exists") {
      // Show error and ask user to choose different combination
      showError("This avatar name is already taken. Please choose another.");
    }
  } catch (error) {
    console.error("Failed to set avatar:", error);
  }
}

Use Cases

🆕

New Account Setup

First-time users select their avatar identity immediately after completing 2FA setup during registration

🎮

Gamification

Create unique player identities for leaderboards, achievements, and social features within the platform

👤

Profile Display

Display distinctive avatar identifiers across chat, comments, trading interfaces, and community features

🔒

Privacy Protection

Allow users to interact with platform features using avatar identity instead of real names


Best Practices

✅ Uniqueness Validation

Always handle the "Already Exists" response and prompt users to select an alternative combination

🎯 Prefix Selection UI

Provide a curated list of available prefixes with visual previews to guide user selection

🔢 Name Generation

Offer auto-generated name suggestions based on available numbers for the selected prefix

⏰ One-Time Setup

Avatar identity is set once during registration and typically cannot be changed to maintain consistency