Update a user
Update an existing user. Pass the user ID your application uses when it evaluates an action with the client SDK. Only the fields you send are changed; anything you leave out stays as it was. If you don't have the user ID, use by to find the user by email or phone instead, and pass id to give them one. Changing an email or phone number marks it as unverified.
Parameters
user string REQUIRED
The user ID your application uses to identify this user to Rupt. When by is email or phone, pass the user's email or phone number instead.
by string
What user is: id, email, or phone. Defaults to id. If more than one user has that email or phone number, the most recently updated one is changed.
id string
The user ID your application uses for this user. Use it to attach your ID to a user you found by email or phone, or to change it. Returns 409 with id_taken if another user already has it.
email string
The email address of the user.
phone string
The phone number of the user.
metadata object
Custom metadata to store on the user.
groups object / array of objects
The group or groups the user belongs to. Pass a single group object or an array of them.
group.id string REQUIRED
The id of the group in your system.
group.name string
The name of the group or organization.
group.metadata object
Custom metadata to store on the group.
Returns
Returns nothing on success (
204 No Content).
await rupt.updateUser({
user: "user@example.com",
by: "email",
id: "USER_ID",
phone: "+15551234567",
metadata: {
key: "value",
},
groups: [
{
id: "group_id",
name: "Group Name",
metadata: {
key: "value",
},
},
],
});