> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Recovery Codes

> Get Recovery Codes using the Stytch React Native SDK

Wraps the [Get TOTP Recovery Codes](/docs/api-reference/consumer/api/totp/get-recovery-codes) endpoint. Call this method to retrieve the recovery codes for a TOTP instance tied to a user.

<Note>
  If a user has enrolled another MFA method, this method will require MFA. See the [Multi-factor authentication](../../resources/multi-factor-authentication) section for more details.
</Note>

## Response

<ResponseField name="user_id" type="string">
  The unique ID of the affected User.
</ResponseField>

<ResponseField name="totps" type="array[objects]">
  An array containing a list of all TOTP instances for a given User in the Stytch API.

  <Expandable title="properties">
    <ResponseField name="totp_id" type="string">
      The unique ID for a TOTP instance.
    </ResponseField>

    <ResponseField name="verified" type="boolean">
      The verified boolean denotes whether or not this send method, e.g. phone number, email address, etc., has been successfully authenticated by the User.
    </ResponseField>

    <ResponseField name="recovery_codes" type="array[strings]">
      The recovery codes used to authenticate the user without an authenticator app.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="request_id" type="string">
  Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we
  may ask for this value to help identify a specific API call when helping you debug an issue.
</ResponseField>

<ResponseField name="status_code" type="number">
  The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values
  equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
</ResponseField>

<Panel>
  <RequestExample>
    ```jsx theme={null}
    import React, { useCallback } from 'react';
    import { Text, TouchableOpacity, View } from 'react-native';
    import { useStytch } from '@stytch/react-native';

    export const GetTOTPRecoveryCodes = () => {
    const stytch = useStytch();
    const getTOTPRecoveryCodes = useCallback(() => {
      stytch.totp.recoveryCodes();
    }, [stytch]);

    return (
      <View>
        <TouchableOpacity onPress={getTOTPRecoveryCodes}>
          <Text>Get TOTP Recovery Codes</Text>
        </TouchableOpacity>
      </View>
    );
    };
    ```
  </RequestExample>

  <ResponseExample>
    ```json 200 theme={null}
    {
      "status_code": 200,
      "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
      "user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
      "totps": [
        {
          "totp_id": "totp-test-41920359-8bbb-4fe8-8fa3-aaa83f35f02c",
          "verified": true,
          "recovery_codes": [
            "ckss-2skx-ebow",
            "spbc-424h-usy0",
            "hi08-n5tk-lns5",
            "1n6i-l5na-8axe",
            "aduj-eufq-w6yy",
            "i4l3-dxyt-urmx",
            "ayyi-utb0-gj0s",
            "lz0m-02bi-psbx",
            "l2qm-zrk1-8ujs",
            "c2qd-k7m4-ifmc"
          ]
        }
      ]
    }
    ```

    ```json 400 theme={null}
    {
      "status_code": 400,
      "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
      "error_type": "invalid_public_key_credential",
      "error_message": "Invalid public key credential. Please confirm you're passing a correctly formatted public key credential.",
      "error_url": "https://stytch.com/docs/api/errors/400"
    }
    ```

    ```json 404 theme={null}
    {
      "status_code": 404,
      "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
      "error_type": "user_not_found",
      "error_message": "User could not be found.",
      "error_url": "https://stytch.com/docs/api/errors/404"
    }
    ```

    ```json 429 theme={null}
    {
      "status_code": 429,
      "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
      "error_type": "too_many_requests",
      "error_message": "Too many requests have been made.",
      "error_url": "https://stytch.com/docs/api/errors/429"
    }
    ```

    ```json 500 theme={null}
    {
      "status_code": 500,
      "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
      "error_type": "internal_server_error",
      "error_message": "Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.",
      "error_url": "https://stytch.com/docs/api/errors/500"
    }
    ```
  </ResponseExample>
</Panel>
