<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content

Change Recovery Question Using API

API Access Management
Okta Classic Engine

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

  1. 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>/factors endpoint instead.

  2. 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"
        }
      }
    }
    
  3. 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>"

Related References

Loading
Okta Support - Change Recovery Question Using API