Send activate account email without activating the user

Hi,
I would like to know how to properly do this flow:

  • Create user
  • Send Activation email.
  • Trigger resend the account activation email.

I’m using Okta classic and to create the user I do a post to /api/v1/users?activate=false. This creates the user in status STAGED and then when I call the activate life cycle it already activates the user. I want to send the account activation email WITHOUT activating the user.

I notices that when the user status is PROVISIONED I can use the activate lifecyle without activating the user. Thus I’ve been looking for a way to send the email, with the user on STAGED status, without activating it or an endpoint that would allow me to update the user status to PROVISIONED.

Do these exist? If not how should I implement the flow I want?

Thanks

ps.: Same issue since 2021 How to trigger user activiation email

1 Like

Hey, In Okta Classic, there is no specific endpoint to send the account activation email without activating the user when the user status is STAGED. However, you can achieve the desired flow by following these steps:

  1. Create the user with status STAGED: Make a POST request to /api/v1/users?activate=false as you mentioned. This will create the user with a STAGED status.
  2. Send the account activation email: To send the activation email, you can make use of Okta’s built-in functionality. You need to trigger the activation email by updating the user’s status to “PASSWORD_RESET” temporarily and then back to “STAGED.” Here’s how you can do it:a. Update the user’s status to PASSWORD_RESET: Make a POST request to /api/v1/users/{userId} endpoint, where {userId} is the user’s unique identifier. Set the status field to “PASSWORD_RESET” in the request body.b. Update the user’s status back to STAGED: Make another POST request to /api/v1/users/{userId} endpoint with the status field set to “STAGED” in the request body. This will reset the user’s status to STAGED.This sequence of updating the status to PASSWORD_RESET and then back to STAGED triggers the account activation email to be sent to the user while keeping the user’s status as STAGED.
  3. Resend the account activation email: If you need to resend the account activation email, you can repeat step 2, which involves updating the user’s status to PASSWORD_RESET and then back to STAGED.

Remember to replace {userId} with the actual unique identifier of the user you want to perform these actions on. This will definitely help you I am sure of it because it works for us when we do at triotech systems. Besides if you need further assistance please reach out.

Thanks!

Hello, I have tried your solution to trigger sending of activation email. However, I am getting error with the body as i changed the status because this is my format

{
“profile”: {
“status”: “PASSWORD_RESET”
}
}

And status is not under profile. however if I try

{
“status”: “PASSWORD_RESET”
}

still invalid body.

Hope you can help. Thanks

If I created a body like this

bodyparam = {
“profile”: {
“firstName”: first_name,
“lastName”: last_name,
“email”: user_email,
“login”: okta_login_email,
}
}

Will the email be sent on the email address I set on the body?

Hey there,

Sorry for any confusion in my previous response. Thanks for reaching out. To trigger the sending of the activation email, you should structure the request body like this:

{
  "status": "PASSWORD_RESET"
}

The status field must be set to “PASSWORD_RESET”. You can also include other profile fields in the body, such as first name, last name, and email address.

If you’re still getting an error, please make sure that you’re using the correct endpoint. The endpoint for updating the user status is /api/v1/users/{userId}.

Regarding your second question, yes, the email will be sent to the email address that you set in the bodyparam. In your example, the email will be sent to user_email. But, you don’t need to include the user’s email address in the body to trigger the activation email. Updating the status to “PASSWORD_RESET” is enough.

Feel free to reach out to us at Triotech Systems for free consultation, if you have any other questions.