Sign Up
Register new user accounts with email verification and country-based compliance
ACCOUNT CREATION
Sign Up
Create new user accounts with secure email verification and country-based regulatory compliance.
Registration Start
This is the first step in the user registration process. After signup, users must verify their email and set up 2FA.
Overview
The signup mutation initiates the account registration process by creating a new user with email, password, and country information. The system automatically sends a verification code to the provided email address to confirm ownership.
GraphQL Schema
mutation {
signup(
email: String!
password: String!
country: String!
): String!
}Parameters
String
User's email address for account identification and verification. Must be a valid email format.
password
RequiredString
Secure password for account protection. Should meet application's password strength requirements.
country
RequiredString
ISO 3166-1 alpha-3 country code (e.g., "USA", "GBR", "CAN") for regulatory compliance.
Return Values
SuccessNew account created successfully. Verification code sent to email (valid for 10 minutes). User must verify email before continuing.
Already exists, sent verify codeEmail already registered but not verified. New verification code sent to email. User should check inbox and complete verification.
Already verifiedEmail already registered and verified. User should proceed to sign in instead. No action required.
Example Usage
Request
mutation CreateAccount {
signup(
email: "demouser@nyyu.io"
password: "38f@3n102du/qA!"
country: "USA"
)
}Successful Response
{
"data": {
"signup": "Success"
}
}Verification Email Sent
A 6-digit verification code has been sent to demouser@nyyu.io. The code expires in 10 minutes.
Existing Unverified Account
{
"data": {
"signup": "Already exists, sent verify code"
}
}Account Exists
This email is already registered but not verified. A new verification code has been sent.
Already Verified Account
{
"data": {
"signup": "Already verified"
}
}Account Active
This email is already registered and verified. Please use the sign-in page to access your account.
Registration Flow
Account Creation Process
đ
Step 1: Submit Registration
User provides email, password, and country code through your registration form
mutation signup(email, password, country)âī¸
Step 2: Verification Email
System automatically sends 6-digit code to the provided email address
đ
Step 3: Next Action
Direct user to the email verification page to enter the code
â verifyAccount(email, code)Implementation Example
Frontend Integration
// Example: User registration form handler
async function handleSignup(formData) {
try {
const result = await graphqlClient.mutate({
mutation: gql`
mutation Signup($email: String!, $password: String!, $country: String!) {
signup(email: $email, password: $password, country: $country)
}
`,
variables: {
email: formData.email,
password: formData.password,
country: formData.country // e.g., "USA"
}
});
const response = result.data.signup;
if (response === "Success" || response === "Already exists, sent verify code") {
// Store email for verification step
sessionStorage.setItem('pendingEmail', formData.email);
// Redirect to verification page
router.push('/verify-email');
showNotification("Check your email for the verification code!");
} else if (response === "Already verified") {
// Account exists and is verified
showError("This email is already registered. Please sign in.");
router.push('/signin');
}
} catch (error) {
console.error("Signup failed:", error);
showError("Registration failed. Please try again.");
}
}
// Password strength validator
function validatePassword(password) {
const minLength = 8;
const hasUpperCase = /[A-Z]/.test(password);
const hasLowerCase = /[a-z]/.test(password);
const hasNumbers = /\d/.test(password);
const hasSpecialChar = /[!@#$%^&*(),.?":{}|<>]/.test(password);
return password.length >= minLength &&
hasUpperCase &&
hasLowerCase &&
hasNumbers &&
hasSpecialChar;
}Use Cases
New User Registration
Primary use case for first-time users creating accounts on the platform
Resend Verification
Users can retry signup to receive a new verification code if the original expired
Compliance Tracking
Country code enables region-specific features and regulatory compliance
Security Foundation
Email verification ensures account ownership before granting platform access
Best Practices
â Password Validation
Enforce strong password requirements client-side: minimum 8 characters with uppercase, lowercase, numbers, and special characters
đ§ Email Format
Validate email format before submission and normalize to lowercase to prevent duplicate accounts
đ Country Codes
Use ISO 3166-1 alpha-3 standard (3-letter codes) and provide a dropdown with valid options
â° Time Awareness
Inform users that verification codes expire in 10 minutes and provide clear next steps
đ Handle All Responses
Implement specific UI flows for each return value: Success, Already exists, and Already verified
đ¯ User Experience
Store email in session storage after signup to pre-fill verification form and improve UX
Country Code Examples
Common ISO 3166-1 Alpha-3 Codes
USAGBRCANAUSDEUFRAJPNSGP