Create a password reset token for a user and reset the user’s password.
Get the details of an existing password reset token that can be used to reset a user’s password.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const passwordReset = await workos.userManagement.getPasswordReset( 'password_reset_01HYGDNK5G7FZ4YJFXYXPB5JRW', );
{ "object": "password_reset", "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "password_reset_token": "Z1uX3RbwcIl5fIGJJJCXXisdI", "password_reset_url": "https://your-app.com/reset-password?token=Z1uX3RbwcIl5fIGJJJCXXisdI" }
| curl "https://api.workos.com/user_management/password_reset/password_reset_01E4ZCR3C56J083X43JQXF3JK5" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const passwordReset = await workos.userManagement.getPasswordReset( | |
| 'password_reset_01HYGDNK5G7FZ4YJFXYXPB5JRW', | |
| ); |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.key = "sk_example_123456789" | |
| end | |
| password_reset = WorkOS::UserManagement.get_password_reset( | |
| id: "password_reset_01HYGDNK5G7FZ4YJFXYXPB5JRW" | |
| ) |
| from workos import WorkOSClient | |
| workos_client = WorkOSClient( | |
| api_key="sk_example_123456789", client_id="client_123456789" | |
| ) | |
| password_reset = workos_client.user_management.get_password_reset( | |
| password_reset_id="password_reset_01HYGDNK5G7FZ4YJFXYXPB5JRW" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v2/pkg/usermanagement" | |
| ) | |
| func main() { | |
| usermanagement.SetAPIKey( | |
| "sk_example_123456789", | |
| ) | |
| response, err := usermanagement.GetPasswordReset( | |
| context.Background(), | |
| usermanagement.GetPasswordResetOpts{ | |
| PasswordReset: "password_reset_01HYGDNK5G7FZ4YJFXYXPB5JRW", | |
| }, | |
| ) | |
| } |
| <?php | |
| WorkOS\WorkOS::setApiKey("sk_example_123456789"); | |
| $userManagement = new WorkOS\UserManagement(); | |
| $passwordReset = $userManagement->getPasswordReset( | |
| "password_reset_01HYGDNK5G7FZ4YJFXYXPB5JRW" | |
| ); |
| import com.workos.WorkOS; | |
| import com.workos.usermanagement.models.PasswordReset; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| PasswordReset passwordReset = | |
| workos.userManagement.getPasswordReset("password_reset_01HYGDNK5G7FZ4YJFXYXPB5JRW"); |
| { | |
| "object": "password_reset", | |
| "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", | |
| "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", | |
| "email": "marcelina.davis@example.com", | |
| "expires_at": "2026-01-15T12:00:00.000Z", | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "password_reset_token": "Z1uX3RbwcIl5fIGJJJCXXisdI", | |
| "password_reset_url": "https://your-app.com/reset-password?token=Z1uX3RbwcIl5fIGJJJCXXisdI" | |
| } |
GET/user_management /password_reset /:idParameters Returns Creates a one-time token that can be used to reset a user’s password.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const passwordReset = await workos.userManagement.createPasswordReset({ email: 'marcelina@example.com', });
{ "object": "password_reset", "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "password_reset_token": "Z1uX3RbwcIl5fIGJJJCXXisdI", "password_reset_url": "https://your-app.com/reset-password?token=Z1uX3RbwcIl5fIGJJJCXXisdI" }
| curl --request POST \ | |
| --url "https://api.workos.com/user_management/password_reset" \ | |
| --header "Authorization: Bearer sk_example_123456789" \ | |
| --header "Content-Type: application/json" \ | |
| -d @- <<'BODY' | |
| { | |
| "email": "marcelina.davis@example.com" | |
| } | |
| BODY |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const passwordReset = await workos.userManagement.createPasswordReset({ | |
| email: 'marcelina@example.com', | |
| }); |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.key = "sk_example_123456789" | |
| end | |
| password_reset = UserManagement.create_password_reset( | |
| email: "marcelina@example.com" | |
| ) |
| from workos import WorkOSClient | |
| workos_client = WorkOSClient( | |
| api_key="sk_example_123456789", client_id="client_123456789" | |
| ) | |
| password_reset = workos_client.user_management.create_password_reset( | |
| email="marcelina@example.com" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v2/pkg/usermanagement" | |
| ) | |
| func main() { | |
| usermanagement.SetAPIKey( | |
| "sk_example_123456789", | |
| ) | |
| response, err := usermanagement.CreatePasswordReset( | |
| context.Background(), | |
| usermanagement.CreatePasswordResetOpts{ | |
| Email: "marcelina@example.com", | |
| }, | |
| ) | |
| } |
| <?php | |
| WorkOS\WorkOS::setApiKey("sk_example_123456789"); | |
| $userManagement = new WorkOS\UserManagement(); | |
| $passwordReset = $userManagement->createPasswordReset("marcelina@example.com"); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| PasswordReset passwordReset = | |
| workos.userManagement.createPasswordReset("marcelina@example.com"); |
| { | |
| "object": "password_reset", | |
| "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", | |
| "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", | |
| "email": "marcelina.davis@example.com", | |
| "expires_at": "2026-01-15T12:00:00.000Z", | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "password_reset_token": "Z1uX3RbwcIl5fIGJJJCXXisdI", | |
| "password_reset_url": "https://your-app.com/reset-password?token=Z1uX3RbwcIl5fIGJJJCXXisdI" | |
| } |
POST/user_management /password_resetReturns Sets a new password using the token query parameter from the link that the user received. Successfully resetting the password will verify a user’s email, if it hasn’t been verified yet.
curl --request POST \ --url https://api.workos.com/user_management/password_reset/confirm \ --header "Authorization: Bearer sk_example_123456789" \ --header "Content-Type: application/json" \ -d @- <<BODY { "token": "stpIJ48IFJt0HhSIqjf8eppe0", "new_password": "i8uv6g34kd490s" } BODY
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const { user } = await workos.userManagement.resetPassword({ token: 'stpIJ48IFJt0HhSIqjf8eppe0', newPassword: 'i8uv6g34kd490s', });
require "workos" WorkOS.configure do |config| config.key = "sk_example_123456789" end user = WorkOS::UserManagement.reset_password( token: "stpIJ48IFJt0HhSIqjf8eppe0", new_password: "i8uv6g34kd490s" )
from workos import WorkOSClient workos_client = WorkOSClient( api_key="sk_example_123456789", client_id="client_123456789" ) workos_client.user_management.reset_password( token="stpIJ48IFJt0HhSIqjf8eppe0", new_password="i8uv6g34kd490s" )
package main import ( "context" "github.com/workos/workos-go/v2/pkg/usermanagement" ) func main() { usermanagement.SetAPIKey( "sk_example_123456789", ) user, err := usermanagement.ResetPassword( context.Background(), usermanagement.ResetPasswordOpts{ Token: "stpIJ48IFJt0HhSIqjf8eppe0", NewPassword: "i8uv6g34kd490s", }, ) }
<?php WorkOS\WorkOS::setApiKey("sk_example_123456789"); $userManagement = new WorkOS\UserManagement(); $user = $userManagement->resetPassword( "stpIJ48IFJt0HhSIqjf8eppe0", "i8uv6g34kd490s" );
import com.workos.WorkOS; import com.workos.usermanagement.models.User; WorkOS workos = new WorkOS("sk_example_123456789"); User user = workos.userManagement.resetPassword("stpIJ48IFJt0HhSIqjf8eppe0", "i8uv6g34kd490s");
POST/user_management /password_reset /confirmReturns