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

# Email OTP

> Implement email OTP in your mobile apps using the Authsignal SDKs for iOS, Android, React Native, and Flutter.

<Info>
  All Mobile SDK methods for email OTP require you to [initiate an action
  first](/sdks/client/mobile/actions). Check out our [guide on email OTP
  authentication](/authentication-methods/email/otp) for more details.
</Info>

## Enroll email

Start enrollment for a new email OTP authenticator by sending the user an email containing an OTP code.

This method is typically used when you've **not yet verified** the user's email address.

<CodeGroup>
  ```swift iOS theme={null}
  await authsignal.email.enroll(email: "jane.smith@authsignal.com")
  ```

  ```kotlin Android theme={null}
  authsignal.email.enroll(email = "jane.smith@authsignal.com")
  ```

  ```ts React Native theme={null}
  await authsignal.email.enroll({ email: "jane.smith@authsignal.com" });
  ```

  ```dart Flutter theme={null}
  await authsignal.email.enroll("jane.smith@authsignal.com");
  ```
</CodeGroup>

<Info>
  If you've already verified a user's email address independently of Authsignal, you can
  alternatively use a Server SDK to [enroll the user
  programmatically](/advanced-usage/programmatic-authenticator-management).
</Info>

### Parameters

<ResponseField name="email" type="string">
  The user's email address.
</ResponseField>

### Response

<ResponseField name="response" type="AuthsignalResponse<void>">
  <Expandable title="properties">
    <ResponseField name="error" type="string">
      An unstructured error description present if the SDK call encountered an error.
    </ResponseField>
  </Expandable>
</ResponseField>

## Challenge email

Start an email OTP challenge by sending the user an email containing an OTP code.

<CodeGroup>
  ```swift iOS theme={null}
  await authsignal.email.challenge()
  ```

  ```kotlin Android theme={null}
  authsignal.email.challenge()
  ```

  ```ts React Native theme={null}
  await authsignal.email.challenge();
  ```

  ```dart Flutter theme={null}
  await authsignal.email.challenge();
  ```
</CodeGroup>

#### Response

<ResponseField name="response" type="AuthsignalResponse<void>">
  <Expandable title="properties">
    <ResponseField name="error" type="string">
      An unstructured error description present if the SDK call encountered an error.
    </ResponseField>
  </Expandable>
</ResponseField>

## Verify email

Finish enrolling or re-authenticating a new or existing email OTP authenticator by verifying the code submitted by the user.

<CodeGroup>
  ```swift iOS theme={null}
  await authsignal.email.verify(code: "123456")
  ```

  ```kotlin Android theme={null}
  authsignal.email.verify(code = "123456")
  ```

  ```ts React Native theme={null}
  await authsignal.email.verify({ code: "123456" });
  ```

  ```dart Flutter theme={null}
  await authsignal.email.verify("123456");
  ```
</CodeGroup>

### Parameters

<ResponseField name="code" type="string">
  The OTP code inputted by the user.
</ResponseField>

### Response

<ResponseField name="response" type="AuthsignalResponse<VerifyResponse>">
  <Expandable title="properties">
    <ResponseField name="error" type="string">
      An unstructured error description present if the SDK call encountered an error.
    </ResponseField>
  </Expandable>

  <ResponseField name="data" type="VerifyResponse">
    <Expandable title="properties">
      <ResponseField name="isVerified" type="boolean" required>
        True if the verification was successful.
      </ResponseField>

      <ResponseField name="token" type="string">
        A token which can be used for [server-side
        validation](/sdks/server/challenges#validate-challenge).
      </ResponseField>

      <ResponseField name="failureReason" type="string">
        A structured code present if the verification failed due to user error. Possible values are:
        `CODE_INVALID_OR_EXPIRED` or `MAX_ATTEMPTS_EXCEEDED`.
      </ResponseField>
    </Expandable>
  </ResponseField>
</ResponseField>
