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

# Solicitar OTP

> Envía un código OTP de 6 dígitos al cliente vía WhatsApp para iniciar sesión.

Envía un código de verificación (OTP) al número de teléfono del cliente vía WhatsApp. El cliente debe estar previamente registrado con [POST /customers](/client/customers/create).

<Note>
  En modo test (`sk_test_xxx`), el OTP se retorna directamente en la respuesta y **no** se envía por WhatsApp.
</Note>

### Body

<ParamField body="phone" type="string" required placeholder="+573001234567">
  Número de teléfono del cliente en formato E.164 (ejemplo: `+573001234567`).
</ParamField>

### Rate limiting

Este endpoint tiene un rate limit de **1 request cada 30 segundos** por teléfono, con un cooldown de **1 minuto** entre reenvíos.

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.onepay.la/v1/customers/login/request \
    -X POST \
    -H "Authorization: Bearer sk_test_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "phone": "+573001234567"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.onepay.la/v1/customers/login/request', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_test_xxx',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      phone: '+573001234567'
    })
  });

  const data = await response.json();
  ```

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

  response = requests.post(
      'https://api.onepay.la/v1/customers/login/request',
      headers={
          'Authorization': 'Bearer sk_test_xxx',
          'Content-Type': 'application/json'
      },
      json={
          'phone': '+573001234567'
      }
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Modo live theme={null}
  {
    "message": "OTP enviado exitosamente."
  }
  ```

  ```json 200 - Modo test theme={null}
  {
    "message": "OTP enviado exitosamente.",
    "otp": "482916"
  }
  ```

  ```json 422 theme={null}
  {
    "message": "El campo teléfono es obligatorio.",
    "errors": {
      "phone": [
        "El campo teléfono es obligatorio."
      ]
    }
  }
  ```

  ```json 429 theme={null}
  {
    "message": "Too Many Attempts."
  }
  ```
</ResponseExample>
