Users Enpoint (Draft WIP) - lolmaxz/vrc-ts GitHub Wiki

Users API Documentation

The Users API allows you to interact with VRChat users—search for users, retrieve user information, update user profiles, manage user notes, and more.


Index

  1. searchAllUsers - Search for users by display name.

  2. getUserById - Get detailed information about a user by their ID.

  3. updateUserInfo - Update the current user's profile information.

  4. getUserGroups - Get a list of groups that a user is a member of.

  5. getUserGroupRequests - Get a list of groups the user has requested to join.

  6. getUserRepresentedGroup - Get the group that the user is currently representing.

  7. getAllUserNotes - Retrieve all user notes.

  8. updateUserNote - Create or update a note for a user.

  9. getAUserNote - Retrieve a specific user note by its ID.

  10. getUserGroupInstances - Get the current group instances of the logged-in user.


Endpoints

1. searchAllUsers

Purpose

Search for users by display name.

Method Signature

searchAllUsers(options: { search: string; n?: number; offset?: number; fuzzy?: boolean }): Promise<LimitedUser[]>

Parameters

  • options (object):
    • search (string, required):
      The display name to search for. Cannot be empty or contain % character.
    • n (number, optional):
      Number of results to return (1-100). Default is 10.
    • offset (number, optional):
      Number of results to skip. Must be 0 or greater.
    • fuzzy (boolean, optional):
      Enable fuzzy search. Defaults to false.

Returns

  • Promise<LimitedUser[]>: A promise that resolves to an array of limited user objects.

Example Usage

// Example: Search for users with display name "John"
const users = await vrchatApi.userApi.searchAllUsers({ search: 'John', n: 20 });
console.log(users);

2. getUserById

Purpose

Get detailed information about a user by their ID.

Method Signature

getUserById(userId: string): Promise<User>

Parameters

  • userId (string, required):
    The unique identifier of the user.

Returns

  • Promise<User>: A promise that resolves to a user object containing detailed information.

Example Usage

// Example: Get information about a user by ID
const userId = 'usr_12345678-1234-1234-1234-1234567890ab';
const userInfo = await vrchatApi.userApi.getUserById(userId);
console.log(userInfo);

3. updateUserInfo

Purpose

Update the current user's profile information such as email, birthday, status, bio, etc.

Method Signature

updateUserInfo(data: {
  email?: string;
  birthday?: string;
  acceptedTOSVersion?: number;
  tags?: string[];
  status?: 'active' | 'join me' | 'ask me' | 'busy' | 'offline';
  statusDescription?: string;
  bio?: string;
  bioLinks?: string[];
  userIcon?: string;
  pronouns?: string;
}): Promise<CurrentUser>

Parameters

  • data (object):
    • email (string, optional):
      Your email address.
    • birthday (string, optional):
      Your birthday in YYYY-MM-DD format.
    • acceptedTOSVersion (number, optional):
      The version of the Terms of Service you've accepted.
    • tags (string[], optional):
      An array of tags.
    • status (string, optional):
      Your current status. Allowed values: 'active', 'join me', 'ask me', 'busy', 'offline'.
    • statusDescription (string, optional):
      A short status description (max 32 characters).
    • bio (string, optional):
      Your bio (max 512 characters).
    • bioLinks (string[], optional):
      Array of up to 3 bio links.
    • userIcon (string, optional):
      The file ID of your user icon.
    • pronouns (string, optional):
      Your preferred pronouns.

Returns

  • Promise<CurrentUser>: A promise that resolves to the updated current user object.

Example Usage

// Example: Update your status and bio
const updatedUser = await vrchatApi.userApi.updateUserInfo({
  status: 'join me',
  statusDescription: 'Ready to play!',
  bio: 'I love exploring new worlds in VRChat.',
});
console.log(updatedUser);

4. getUserGroups

Purpose

Get a list of groups that a user is a member of.

Method Signature

getUserGroups({userId?: string}): Promise<Group[]>

Parameters

  • userId (string, optional):
    The unique identifier of the user. If omitted, defaults to the currently logged-in user.

Returns

  • Promise<Group[]>: A promise that resolves to an array of group objects.

Example Usage

// Example: Get groups for the logged-in user
const myGroups = await vrchatApi.userApi.getUserGroups();
console.log(myGroups);

// Example: Get groups for another user
const userId = 'usr_12345678-1234-1234-1234-1234567890ab';
const userGroups = await vrchatApi.userApi.getUserGroups({userId: userId});
console.log(userGroups);

note: if the userID isnt valid, the currently logged in user id will be used instead!


5. getUserGroupRequests

Purpose

Get a list of groups the user has requested to join.

Method Signature

getUserGroupRequests(userId: string): Promise<Group[]>

Parameters

  • userId (string, required):
    The unique identifier of the user.

Returns

  • Promise<Group[]>: A promise that resolves to an array of group objects.

Example Usage

// Example: Get group requests for the logged-in user
const userId = vrchatApi.currentUser.id;
const groupRequests = await vrchatApi.userApi.getUserGroupRequests(userId);
console.log(groupRequests);

6. getUserRepresentedGroup

Purpose

Get the group that the user is currently representing.

Method Signature

getUserRepresentedGroup(userId: string): Promise<RepresentedGroup>

Parameters

  • userId (string, required):
    The unique identifier of the user.

Returns

  • Promise<RepresentedGroup>: A promise that resolves to the represented group object.

Example Usage

// Example: Get the represented group of the logged-in user
const userId = vrchatApi.currentUser.id;
const representedGroup = await vrchatApi.userApi.getUserRepresentedGroup(userId);
console.log(representedGroup);

7. getAllUserNotes

Purpose

Retrieve all user notes.

Method Signature

getAllUserNotes(options?: { n?: number; offset?: number }): Promise<UserNote[]>

Parameters

  • options (object, optional):
    • n (number, optional):
      Number of results to return (1-100). Default is 10.
    • offset (number, optional):
      Number of results to skip. Must be 0 or greater.

Returns

  • Promise<UserNote[]>: A promise that resolves to an array of user note objects.

Example Usage

// Example: Get all user notes
const notes = await vrchatApi.userApi.getAllUserNotes();
console.log(notes);

8. updateUserNote

Purpose

Create or update a note for a user.

Method Signature

updateUserNote(data: { targetUserId: string; note: string }): Promise<UserNote>

Parameters

  • data (object):
    • targetUserId (string, required):
      The user ID of the target user.
    • note (string, required):
      The note content.

Returns

  • Promise<UserNote>: A promise that resolves to the updated user note object.

Example Usage

// Example: Add a note to a user
const targetUserId = 'usr_12345678-1234-1234-1234-1234567890ab';
const note = 'Met in a cool world!';
const updatedNote = await vrchatApi.userApi.updateUserNote({ targetUserId, note });
console.log(updatedNote);

9. getAUserNote

Purpose

Retrieve a specific user note by its ID.

Method Signature

getAUserNote(userNoteId: string): Promise<UserNote>

Parameters

  • userNoteId (string, required):
    The unique identifier of the user note.

Returns

  • Promise<UserNote>: A promise that resolves to the user note object.

Example Usage

// Example: Get a user note by its ID
const userNoteId = 'unt_12345678-1234-1234-1234-1234567890ab';
const userNote = await vrchatApi.userApi.getAUserNote(userNoteId);
console.log(userNote);

10. getUserGroupInstances

Purpose

Get the current group instances of the logged-in user.

Method Signature

getUserGroupInstances(): Promise<UserGroupInstances>

Parameters

  • None. This method works only for the currently logged-in user.

Returns

  • Promise<UserGroupInstances>: A promise that resolves to a user group instances object.

Example Usage

// Example: Get the current group instances of the logged-in user
const groupInstances = await vrchatApi.userApi.getUserGroupInstances();
console.log(groupInstances);

Note: Some methods require the user to be authenticated. Ensure you have successfully logged in before using these methods.

Please replace placeholder IDs like 'usr_12345678-1234-1234-1234-1234567890ab' and 'unt_12345678-1234-1234-1234-1234567890ab' with actual IDs as needed.


⚠️ **GitHub.com Fallback** ⚠️