Skip to content

User Management Examples

Explore operations for creating, updating, and managing user accounts.

1. Register a New User

Create a new student account. This is the primary entrypoint for the registration funnel.

Send an Idempotency-Key header with a value that is unique per registration attempt (for example a UUID generated when the form is submitted). If the request is retried — a network timeout, a double click — the same key returns the original result instead of creating a duplicate account. Reuse the same key only when retrying the exact same payload.

Idempotency-Key: 3f6b0a3e-9d5f-4d5c-a6b7-1c2d3e4f5a6b
graphql
mutation RegisterUser($input: CreateUserInput!) {
  auth {
    createUser(input: $input) {
      success
      token
      expiresAt
      user {
        id
        email
        firstName
      }
      profileProgress {
        completionPercentage
      }
      eligibleScholarshipsCount
    }
  }
}

Variables:

json
{
  "input": {
    "email": "new.student@example.com",
    "password": "secure-password",
    "firstName": "John",
    "lastName": "Doe",
    "dateOfBirth": "2000-01-01T00:00:00Z"
  }
}

Optional registration inputs. CreateUserInput also accepts:

  • coregs (JSON) — co-registration offers the user opted into during signup, keyed by offer name: { "Toluna": { "id": 1, "checked": 1 } }. Unchecked entries are ignored; some offers (for example Berecruited) require an extra object with additional fields and are rejected with a validation error when incomplete.
  • redemptionCode (String) — a prepaid order code. When valid and unused it activates the associated subscription on the new account. An invalid or already-used code never fails the registration.
  • referrer (String) — the account id of the user who referred this signup, used by the referral rewards program.

2. Update User Profile

Update the currently authenticated user's profile and account settings.

graphql
mutation UpdateProfile($input: UpdateUserInput!) {
  viewer {
    updateUser(input: $input) {
      success
      user {
        phone
        gender
      }
      updatedFields
    }
  }
}

Variables:

json
{
  "input": {
    "phone": "+1234567890",
    "gender": "male"
  }
}

3. Upload a Document

Upload a document (like a resume or transcript) to the user's profile. Note: File uploads in GraphQL use the Upload scalar and typically require a multipart/form-data request.

graphql
mutation UploadUserDocument($type: String!, $file: Upload!) {
  auth {
    uploadDocument(type: $type, file: $file) {
      id
      name
      url
      mimeType
    }
  }
}

4. Password Management

Request Password Reset

Triggers a password reset email.

graphql
mutation RequestPasswordReset($input: PasswordResetInput!) {
  auth {
    requestPasswordReset(input: $input)
  }
}

Change Password

Change the password for the currently authenticated user.

graphql
mutation ChangePassword($input: PasswordChangeInput!) {
  auth {
    changePassword(input: $input)
  }
}

5. Social Accounts

Link a social media account to the current user's profile.

graphql
mutation ConnectSocial($input: ConnectSocialAccountInput!) {
  auth {
    connectSocialAccount(input: $input) {
      user {
        socialAccounts {
          provider
        }
      }
    }
  }
}

OwlFlow Developer Portal