Skip to content

Send OTP Verification

Add one-time password (OTP) verification to your application. Send codes via SMS, voice call, or email, then validate the response — all through a single API.

What you are building

A verification flow where your application sends a one-time code to a user and validates their response. WAYSCloud handles code generation, delivery, expiration, and rate limiting.

When to use this approach

  • User sign-up or login verification
  • Two-factor authentication (2FA)
  • Phone number or email confirmation
  • Sensitive action confirmation (payments, password changes)

If you need to send general-purpose messages (not verification codes), use SMS instead.

What you need

  • A WAYSCloud account
  • A Verify API key (generated during activation)

Step 1 — Activate the Verify service

Dashboard

  1. Open ServicesCommunicationVerify in the dashboard
  2. Click Activate
  3. Copy your API key — it is only shown once

API

bash
curl -X POST https://api.wayscloud.services/v1/dashboard/verify/activate \
  -H "Authorization: Bearer $JWT_TOKEN"

Response:

json
{
  "api_key": "wayscloud_verify_abc1234567_aBcDeFgH...",
  "endpoint": "https://api.wayscloud.services/v1/verify"
}

Save the API key securely. It cannot be retrieved again.


Step 2 — Send a verification code

Call the Verify API to send a one-time code to your user:

SMS (most common):

bash
curl -X POST https://api.wayscloud.services/v1/verify/send \
  -H "X-API-Key: $VERIFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+4712345678",
    "channel": "sms"
  }'

Voice call:

bash
curl -X POST https://api.wayscloud.services/v1/verify/send \
  -H "X-API-Key: $VERIFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+4712345678",
    "channel": "voice"
  }'

Email:

bash
curl -X POST https://api.wayscloud.services/v1/verify/send \
  -H "X-API-Key: $VERIFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "user@example.com",
    "channel": "email"
  }'

Response:

json
{
  "session_id": "sess_abc123",
  "status": "sent",
  "channel": "sms",
  "expires_in": 300
}

The code expires after 5 minutes by default.


Step 3 — Verify the code

When the user submits their code, validate it:

bash
curl -X POST https://api.wayscloud.services/v1/verify/check \
  -H "X-API-Key: $VERIFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "sess_abc123",
    "code": "123456"
  }'

Response (success):

json
{
  "session_id": "sess_abc123",
  "status": "verified",
  "channel": "sms"
}

Response (failure):

json
{
  "session_id": "sess_abc123",
  "status": "failed",
  "attempts_remaining": 2
}

Step 4 — Integrate in your application

Python example:

python
import requests

VERIFY_KEY = "wayscloud_verify_abc1234567_..."
BASE = "https://api.wayscloud.services/v1/verify"

# Send code
resp = requests.post(f"{BASE}/send", headers={
    "X-API-Key": VERIFY_KEY,
    "Content-Type": "application/json"
}, json={"to": "+4712345678", "channel": "sms"})

session_id = resp.json()["session_id"]

# Later: check code submitted by user
check = requests.post(f"{BASE}/check", headers={
    "X-API-Key": VERIFY_KEY,
    "Content-Type": "application/json"
}, json={"session_id": session_id, "code": user_input})

if check.json()["status"] == "verified":
    # Grant access
    pass

API reference

WAYSCloud AS