Change the Okta 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 with valid credentials in Staged, Active, or Recovery status.
Applies To
- Recovery Question
- Okta Application Programming Interface (API0
- Okta Classic Engine
- Okta Identity Engine (OIE)
Solution
Prepare a PUT request to the following endpoint:
/api/v1/users/<user_id>/credentials/change_recovery_question
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>/factors endpoint instead.
-
Construct the JavaScript Object Notation (JSON) body by wrapping the question and answer inside a credentials object:
{ "password": { "value": "tlpWENT2m" }, "recovery_question": { "question": "How many roads must a man walk down?", "answer": "forty two" } }
-
Execute the request:
curl -i -X POST \ 'https://{youroktadomain}/api/v1/users/00ub0oNGTSWTBKOLGLNR/credentials/change_recovery_question' \ -H 'Content-Type: application/json' \ -d '{ "password": { "value": "tlpWENT2m" }, "recovery_question": { "question": "How many roads must a man walk down?", "answer": "forty two" } }'
