Users Enpoint (Draft WIP) - lolmaxz/vrc-ts GitHub Wiki
The Users API allows you to interact with VRChat users—search for users, retrieve user information, update user profiles, manage user notes, and more.
-
searchAllUsers
- Search for users by display name. -
getUserById
- Get detailed information about a user by their ID. -
updateUserInfo
- Update the current user's profile information. -
getUserGroups
- Get a list of groups that a user is a member of. -
getUserGroupRequests
- Get a list of groups the user has requested to join. -
getUserRepresentedGroup
- Get the group that the user is currently representing. -
getAllUserNotes
- Retrieve all user notes. -
updateUserNote
- Create or update a note for a user. -
getAUserNote
- Retrieve a specific user note by its ID. -
getUserGroupInstances
- Get the current group instances of the logged-in user.
Search for users by display name.
searchAllUsers(options: { search: string; n?: number; offset?: number; fuzzy?: boolean }): Promise<LimitedUser[]>
-
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 tofalse
.
-
-
Promise<LimitedUser[]>
: A promise that resolves to an array of limited user objects.
// Example: Search for users with display name "John"
const users = await vrchatApi.userApi.searchAllUsers({ search: 'John', n: 20 });
console.log(users);
Get detailed information about a user by their ID.
getUserById(userId: string): Promise<User>
-
userId
(string, required):
The unique identifier of the user.
-
Promise<User>
: A promise that resolves to a user object containing detailed information.
// 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);
Update the current user's profile information such as email, birthday, status, bio, etc.
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>
-
data
(object):-
email
(string, optional):
Your email address. -
birthday
(string, optional):
Your birthday inYYYY-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.
-
-
Promise<CurrentUser>
: A promise that resolves to the updated current user object.
// 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);
Get a list of groups that a user is a member of.
getUserGroups({userId?: string}): Promise<Group[]>
-
userId
(string, optional):
The unique identifier of the user. If omitted, defaults to the currently logged-in user.
-
Promise<Group[]>
: A promise that resolves to an array of group objects.
// 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!
Get a list of groups the user has requested to join.
getUserGroupRequests(userId: string): Promise<Group[]>
-
userId
(string, required):
The unique identifier of the user.
-
Promise<Group[]>
: A promise that resolves to an array of group objects.
// Example: Get group requests for the logged-in user
const userId = vrchatApi.currentUser.id;
const groupRequests = await vrchatApi.userApi.getUserGroupRequests(userId);
console.log(groupRequests);
Get the group that the user is currently representing.
getUserRepresentedGroup(userId: string): Promise<RepresentedGroup>
-
userId
(string, required):
The unique identifier of the user.
-
Promise<RepresentedGroup>
: A promise that resolves to the represented group object.
// 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);
Retrieve all user notes.
getAllUserNotes(options?: { n?: number; offset?: number }): Promise<UserNote[]>
-
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.
-
-
Promise<UserNote[]>
: A promise that resolves to an array of user note objects.
// Example: Get all user notes
const notes = await vrchatApi.userApi.getAllUserNotes();
console.log(notes);
Create or update a note for a user.
updateUserNote(data: { targetUserId: string; note: string }): Promise<UserNote>
-
data
(object):-
targetUserId
(string, required):
The user ID of the target user. -
note
(string, required):
The note content.
-
-
Promise<UserNote>
: A promise that resolves to the updated user note object.
// 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);
Retrieve a specific user note by its ID.
getAUserNote(userNoteId: string): Promise<UserNote>
-
userNoteId
(string, required):
The unique identifier of the user note.
-
Promise<UserNote>
: A promise that resolves to the user note object.
// 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);
Get the current group instances of the logged-in user.
getUserGroupInstances(): Promise<UserGroupInstances>
- None. This method works only for the currently logged-in user.
-
Promise<UserGroupInstances>
: A promise that resolves to a user group instances object.
// 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.