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

# Verify email OTP (KYC)

> Validate the email OTP so the user can create a KYC session.

<ParamField header="x-api-key" type="string" required placeholder="your-api-key">
  Your StarkFi API key when required by your environment.
</ParamField>

<ParamField body="email" type="string" required>
  Same email used for send OTP.
</ParamField>

<ParamField body="code" type="string" required>
  One-time code received by the user.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.starkfi.io/security/email/verify-otp \
    --header 'Content-Type: application/json' \
    --header 'x-api-key: <api_key>' \
    --data '{"email":"user@example.com","code":"123456"}'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.starkfi.io/security/email/verify-otp", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": "<api_key>",
    },
    body: JSON.stringify({ email: "user@example.com", code: "123456" }),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.starkfi.io/security/email/verify-otp",
      headers={"Content-Type": "application/json", "x-api-key": "<api_key>"},
      json={"email": "user@example.com", "code": "123456"},
  )
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "statusCode": 200,
    "success": true,
    "status": "email_verified",
    "message": "Email verified successfully"
  }
  ```

  ```json 400 - Missing fields theme={null}
  {
    "statusCode": 400,
    "success": false,
    "status": "missing_params",
    "message": "email and code are required"
  }
  ```

  ```json 400 - Invalid code theme={null}
  {
    "statusCode": 400,
    "success": false,
    "status": "otp_invalid",
    "message": "Invalid code"
  }
  ```

  ```json 400 - Expired theme={null}
  {
    "statusCode": 400,
    "success": false,
    "status": "otp_expired",
    "message": "Code expired, please request a new one"
  }
  ```

  ```json 400 - Max attempts theme={null}
  {
    "statusCode": 400,
    "success": false,
    "status": "otp_max_attempts",
    "message": "Max attempts reached, please request a new code"
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "statusCode": 404,
    "success": false,
    "status": "user_not_found",
    "message": "User not found in whitelist"
  }
  ```

  ```json 400 - Already verified theme={null}
  {
    "statusCode": 400,
    "success": false,
    "status": "email_already_verified",
    "message": "Email is already verified"
  }
  ```

  ```json 500 - Server Error theme={null}
  {
    "statusCode": 500,
    "success": false,
    "status": "server_error",
    "message": "Server failed, try again later"
  }
  ```
</ResponseExample>
