Skip to content

    Arabic or English · ↑↓ to move · Enter to open · Esc to close

    العربية
    On this page

    OTP done right

    Send one-time codes from your own number: Mursilat generates and hashes the code, uses a fixed safe text, and limits attempts and recipients.

    POST /v2/otp sends a verification code; POST /v2/otp/{otpId}/verify checks what the person typed. You never handle or store the code: Mursilat generates it with a secure random generator and keeps only a keyed hash.

    curl -X POST "https://mursilat.com/api/v2/otp" \
      -H "Authorization: Bearer $WASLA_API_KEY" \
      -H "Idempotency-Key: order-1042-confirm" \
      -H "Content-Type: application/json" \
      -d '{
      "numberId": "cm1abcd2345efgh6789ijkl",
      "to": "201001234567",
      "length": 6,
      "ttlSeconds": 300,
      "maxAttempts": 5,
      "app": "متجر النور",
      "copyButton": true
    }'

    Fixed templates

    Official numbers: an AUTHENTICATION template

    WhatsApp only lets official numbers send codes through an approved AUTHENTICATION template (Meta’s fixed text with a copy-code button). Add one in one click from the ready-made templates (or build your own on the Templates page) and wait for Meta’s approval (template.status webhook). Mursilat picks the approved one in the OTP’s language (else the newest) — the code then reaches the customer at any time, also outside the 24-hour window. Without one, POST /v2/otp answers 409 OTP_TEMPLATE_REQUIRED. The texts below are the fallback wording shown in Mursilat.

    The text is fixed and localized, so the OTP endpoint can never relay arbitrary messages or phishing links. Only the code, the validity and your app name are filled in (\n is a line break):

    localeText
    ar (default)Text«كود التحقق{app}: {code}\nصالح لمدة {duration}. متشاركهوش مع أي حد.»
    enText“Your verification code{app}: {code}\nValid for {duration}. Do not share it with anyone.”

    {app} becomes “ for <your app>” when you send app and disappears otherwise. {duration} is the validity in minutes, written correctly: "1 minute", "5 minutes", "15 minutes" (Arabic: «دقيقة واحدة», «دقيقتين», «5 دقائق», «15 دقيقة»).

    app accepts letters, digits and spaces (≤ 30) — no links, no domain endings such as com or sa, no link services, no runs of 6+ digits. copyButton: true adds a “Copy code” button.

    Limits

    LimitValue
    Code length / validity / attemptsValue4–8 digits · 60–900 s · 1–10 attempts
    Codes per recipientValue5 per hour
    Different recipients per accountValue200 per hour (OTP_ACCOUNT_RATE_LIMITED)
    Verify callsValue60 per key per minute
    QuotaValue1 message unit, refunded if the send fails

    Opted-out recipients are refused. OTP rows are deleted after 7 days; the recipient is stored masked.

    Verifying

    Send the code as a string (leading zeros matter). Each call spends one attempt before the constant-time comparison; at maxAttempts the OTP locks. valid: false comes with a reason: INVALID_CODE, EXPIRED, TOO_MANY_ATTEMPTS or ALREADY_VERIFIED. The otp.verified webhook (without the code) fires on success.

    curl -X POST "https://mursilat.com/api/v2/otp/otp_8f2c1d9a7b3e4f56a1b2c3d4/verify" \
      -H "Authorization: Bearer $WASLA_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "code": "048213"
    }'

    Deliverability

    Send OTPs from a number people already know — ideally a dedicated one, not the number you use for campaigns, so marketing reports never block your logins. See Using a dedicated business number.