Change Recovery Question Using API
Last Updated:
Overview
This article explains how a Super Admin, Org Admin, or Help Desk Admin can update a user's recovery question using the API. This operation updates the recovery question used for password resets via the Update User endpoint.
NOTE: This operation can only be performed on users in STAGED, ACTIVE, or RECOVERY status that have valid credentials.
Applies To
- Recovery Question
- API
- Okta Classic Engine
Solution
-
Prepare a PUT request to the following endpoint:
/api/v1/users/<user_id>NOTE: This endpoint changes the Recovery Question used to reset a forgotten password. If the intent is to change the Security Question used for Multi-Factor Authentication (MFA) prompts during login, use the
/api/v1/users/<user_id>/factorsendpoint instead. -
Construct the JavaScript Object Notation (JSON) body by wrapping the question and answer inside a credentials object:
{ "credentials": { "recovery_question": { "question": "What is the name of your first pet?", "answer": "Fluffy" } } } -
Execute the request.
curl -v -X PUT \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <access_token>" \ -d '{ "credentials": { "recovery_question": { "question": "What is the name of your first pet?", "answer": "Fluffy" } } }' \ "https://<domain>.okta.com/api/v1/users/<user_id>"
