Represents a user identity in your application. A user can sign up in your application directly with a method like password, or they can be JIT-provisioned through an organization’s SSO connection.
Users may belong to organizations as members.
See the events reference documentation for the user events.
const user = { object: 'user', id: 'user_01E4ZCR3C56J083X43JQXF3JK5', email: 'marcelina.davis@example.com', firstName: 'Marcelina', lastName: 'Davis', emailVerified: true, profilePictureUrl: 'https://workoscdn.com/images/v1/123abc', lastSignInAt: '2021-06-25T19:07:33.155Z', externalId: 'f1ffa2b2-c20b-4d39-be5c-212726e11222', metadata: { timezone: 'America/New_York', }, createdAt: '2021-06-25T19:07:33.155Z', updatedAt: '2021-06-25T19:07:33.155Z', };
interface UserGet the details of an existing user.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const user = await workos.userManagement.getUser( 'user_01E4ZCR3C56J083X43JQXF3JK5', );
GET/user_management /users /:idParameters Returns Get the details of an existing user by an external identifier.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const user = await workos.userManagement.getUserByExternalId( 'f1ffa2b2-c20b-4d39-be5c-212726e11222', );
GET/user_management /users /external_id /:external_idParameters Returns Get a list of all of your existing users matching the criteria specified.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const users = await workos.userManagement.listUsers(); console.log(users.data);
GET/user_management /usersParameters Returns objectCreate a new user in the current environment.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const user = await workos.userManagement.createUser({ email: 'marcelina@example.com', password: 'i8uv6g34kd490s', firstName: 'Marcelina', lastName: 'Davis', });
POST/user_management /usersReturns Updates properties of a user. The omitted properties will be left unchanged.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const user = await workos.userManagement.updateUser({ userId: 'user_01EHQ7ZGZ2CZVQJGZ5ZJZ1ZJGZ', firstName: 'Marcelina', lastName: 'Davis', emailVerified: true, externalId: '2fe01467-f7ea-4dd2-8b79-c2b4f56d0191', metadata: { timezone: 'America/New_York', }, });
PUT/user_management /users /:idParameters Returns Permanently deletes a user in the current environment. It cannot be undone.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.userManagement.deleteUser('user_01F3GZ5ZGZBZVQGZVHJFVXZJGZ');
DELETE/user_management /users /:idParameters Verifies an email address using the one-time code received by the user.
curl --request POST \ --url "https://api.workos.com/user_management/users/user_01EHZNVPK3SFK441A1RGBFSHRT/email_verification/confirm" \ --header "Authorization: Bearer sk_example_123456789" \ --header "Content-Type: application/json" \ -d @- <<'BODY' { "code": "123456" } BODY
POST/user_management /users /:id /email_verification /confirmParameters Returns Sends an email that contains a one-time code used to verify a user’s email address.
curl --request POST \ --url "https://api.workos.com/user_management/users/user_01EHZNVPK3SFK441A1RGBFSHRT/email_verification/send" \ --header "Authorization: Bearer sk_example_123456789"
POST/user_management /users /:id /email_verification /sendParameters Returns Get a list of all Connect applications that the user has authorized.
curl "https://api.workos.com/user_management/users/user_01E4ZCR3C56J083X43JQXF3JK5/authorized_applications" \ --header "Authorization: Bearer sk_example_123456789"
GET/user_management /users /:user_id /authorized_applicationsParameters Returns objectDelete an existing Authorized Connect Application.
curl --request DELETE \ --url "https://api.workos.com/user_management/users/user_01E4ZCR3C56J083X43JQXF3JK5/authorized_applications/conn_app_01HXYZ123456789ABCDEFGHIJ" \ --header "Authorization: Bearer sk_example_123456789"
DELETE/user_management /users /:user_id /authorized_applications /:application_idParameters Returns