Skip to content

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

    العربية
    On this page

    OTP (verification codes)

    Send a code

    POST/v2/otp
    • Scope:otp
    • Idempotency-Key:required
    • sends messages

    length 4–8, ttlSeconds 60–900, maxAttempts 1–10, app name (letters, digits, spaces; no links). Fixed localized text. Max 5 codes per recipient and 200 recipients per account per hour; opted-out numbers are refused.

    Parameters

    Headers

    NameTypeConstraintsDescription
    Idempotency-KeyrequiredTypestringConstraints≤ 191 charsDescriptionYour unique id for this operation (≤ 191 visible ASCII). A retry with the same key and body returns the first answer with Idempotent-Replayed: true — it never runs twice. Kept 24 h.
    X-Request-IdoptionalTypestringConstraints—DescriptionOptional: your own request id, echoed back (otherwise we generate req_…). Quote it to support.

    Body

    NameTypeConstraintsDescription
    numberIdrequiredTypestringConstraints—DescriptionNumber to act on (id from GET /v2/numbers). A key restricted to some numbers can use only those.
    torequiredTypestringConstraints—DescriptionRecipient: international digits without + or leading zeros (e.g. 201001234567, 966501234567).
    lengthoptionalTypeintegerConstraints4–8default 6DescriptionDigits in the code (4–8).
    ttlSecondsoptionalTypeintegerConstraints60–900default 300DescriptionHow long the code is valid (60–900 s).
    maxAttemptsoptionalTypeintegerConstraints1–10default 5DescriptionWrong tries before the OTP locks (1–10).
    appoptionalTypestringConstraints≤ 30 charsDescriptionYour app or shop name in the fixed text: letters, digits and spaces (≤ 30), no links, no domain endings, no runs of 6+ digits.
    localeoptionalTypestringConstraintsone of: ar · endefault arDescriptionLanguage of the fixed OTP text.
    copyButtonoptionalTypebooleanConstraintsdefault falseDescriptionAdd a “Copy code” button under the message.

    Request

    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
    }'
    Request — JSON
    {
      "numberId": "cm1abcd2345efgh6789ijkl",
      "to": "201001234567",
      "length": 6,
      "ttlSeconds": 300,
      "maxAttempts": 5,
      "app": "متجر النور",
      "copyButton": true
    }

    Response

    201Example

    201 — application/json
    {
      "otpId": "otp_8f2c1d9a7b3e4f56a1b2c3d4",
      "numberId": "cm1abcd2345efgh6789ijkl",
      "to": "2010****4567",
      "status": "pending",
      "length": 6,
      "maxAttempts": 5,
      "expiresAt": "2026-10-13T08:05:00.000Z",
      "messageId": "3EB0A1B2C3D4E5F60718"
    }

    Response schema

    Fields of the example answer. Expand objects and arrays.

    • responseobject8 fields
      • otpIdstring "otp_8f2c1d9a7b3e4f56a1b2c3d4"
      • numberIdstring "cm1abcd2345efgh6789ijkl"
      • tostring "2010****4567"
      • statusstring "pending"
      • lengthinteger 6
      • maxAttemptsinteger 5
      • expiresAtstring "2026-10-13T08:05:00.000Z"
      • messageIdstring "3EB0A1B2C3D4E5F60718"

    Errors

    Besides the authentication, rate-limit and validation errors every endpoint can return:

    Errors →

    Number Shield & behaviour

    OTPs use their own Number Shield class: 30 per hour and 300 per day per number, 3–5 s apart, plus 5 codes per recipient and 200 recipients per account per hour. Opted-out recipients are refused.

    Try it

    Send this request from your browser to the Mursilat API.

    documented example

    Preview — this copy of the docs isn’t on mursilat.com, so the console shows the documented example instead of calling the API.

    Real requests use your real number and plan: they can send WhatsApp messages, spend quota and delete data. (sends messages)

    Kept only in this tab’s memory: never saved, never put in the URL, sent only to mursilat.com. Reloading the page forgets it.

    Send this request for real?

    This will send a real WhatsApp message (or campaign / code) from your number and use your plan quota.

    POST /v2/otp