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.

    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",
      "sender": "number",
      "numberId": "cm1abcd2345efgh6789ijkl",
      "to": "2010****4567",
      "status": "pending",
      "length": 6,
      "maxAttempts": 5,
      "expiresAt": "2026-10-13T08:05:00.000Z",
      "messageId": "3EB0A1B2C3D4E5F60718"
    }

    Fields in this response

    Fields of the example answer. Expand objects and arrays.

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

    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
    senderoptionalTypestringConstraintsone of: number · mursilatdefault numberDescription"number": your own number (numberId required). "mursilat": Mursilat's OTP number, paid per code from your wallet.
    numberIdoptionalTypestringConstraints—DescriptionNumber to act on (id from GET /v2/numbers). A key restricted to some numbers can use only those.
    currencyoptionalTypestringConstraintsone of: EGP · SARDescriptionsender "mursilat" only: the wallet that pays (default: a priced wallet that covers the price).
    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.

    Errors

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

    • 400 · OTP_INPUT_INVALID — Invalid OTP request.

      See details.field.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "OTP_INPUT_INVALID",
          "message": "Invalid OTP request.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#OTP_INPUT_INVALID",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 409 · OTP_TEMPLATE_REQUIRED — An official number sends codes only through an approved AUTHENTICATION template.

      Create an Authentication template (code + copy button) and wait for Meta’s approval.

      Correct the cause before repeating the request.

      HTTP 409 · application/json
      {
        "error": {
          "code": "OTP_TEMPLATE_REQUIRED",
          "message": "An official number sends codes only through an approved AUTHENTICATION template.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#OTP_TEMPLATE_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 429 · OTP_RECIPIENT_RATE_LIMITED — Too many codes to this recipient (5 per hour; with Mursilat's number counted across every account).

      Let the user wait; never loop sends.

      Retry after addressing the cause.

      HTTP 429 · application/json
      {
        "error": {
          "code": "OTP_RECIPIENT_RATE_LIMITED",
          "message": "Too many codes to this recipient (5 per hour; with Mursilat's number counted across every account).",
          "docsUrl": "https://mursilat.com/developers/v2/errors#OTP_RECIPIENT_RATE_LIMITED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 403 · MESSAGES_QUOTA_EXCEEDED — No messages left in your plan.

      Buy a message pack or upgrade.

      Correct the cause before repeating the request.

      HTTP 403 · application/json
      {
        "error": {
          "code": "MESSAGES_QUOTA_EXCEEDED",
          "message": "No messages left in your plan.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#MESSAGES_QUOTA_EXCEEDED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 409 · OTP_PLATFORM_DISABLED — Sending codes from Mursilat's number is off right now (details.reason: NOT_CONFIGURED, PAUSED, NUMBER_DISCONNECTED, TEMPLATE_MISSING, NUMBER_NOT_FOUND).

      Retry later, or send from your own number (sender "number").

      Retry after addressing the cause.

      HTTP 409 · application/json
      {
        "error": {
          "code": "OTP_PLATFORM_DISABLED",
          "message": "Sending codes from Mursilat's number is off right now (details.reason: NOT_CONFIGURED, PAUSED, NUMBER_DISCONNECTED, TEMPLATE_MISSING, NUMBER_NOT_FOUND).",
          "docsUrl": "https://mursilat.com/developers/v2/errors#OTP_PLATFORM_DISABLED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · OTP_BSUID_NOT_SUPPORTED — Codes from Mursilat's number need a phone number; WhatsApp user ids (BSUID) are not supported for authentication messages.

      Send to the phone number with country code.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "OTP_BSUID_NOT_SUPPORTED",
          "message": "Codes from Mursilat's number need a phone number; WhatsApp user ids (BSUID) are not supported for authentication messages.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#OTP_BSUID_NOT_SUPPORTED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 422 · OTP_COUNTRY_NOT_SUPPORTED — Mursilat's number does not send codes to this country yet.

      Send from your own number, or ask support to add the country.

      Correct the cause before repeating the request.

      HTTP 422 · application/json
      {
        "error": {
          "code": "OTP_COUNTRY_NOT_SUPPORTED",
          "message": "Mursilat's number does not send codes to this country yet.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#OTP_COUNTRY_NOT_SUPPORTED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 422 · OTP_PRICE_UNAVAILABLE — No price for this country in a currency your account has a wallet in.

      Top up a wallet in a priced currency (EGP for Egypt, SAR for Saudi Arabia), or pass currency.

      Correct the cause before repeating the request.

      HTTP 422 · application/json
      {
        "error": {
          "code": "OTP_PRICE_UNAVAILABLE",
          "message": "No price for this country in a currency your account has a wallet in.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#OTP_PRICE_UNAVAILABLE",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 402 · WALLET_INSUFFICIENT_FUNDS — Your wallet balance is lower than the price of the code. Nothing was sent or charged.

      Top up the wallet (Billing → Wallet) and retry.

      Correct the cause before repeating the request.

      HTTP 402 · application/json
      {
        "error": {
          "code": "WALLET_INSUFFICIENT_FUNDS",
          "message": "Your wallet balance is lower than the price of the code. Nothing was sent or charged.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#WALLET_INSUFFICIENT_FUNDS",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 429 · OTP_KEY_RATE_LIMITED — Too many codes from this API key in a minute (Mursilat's number).

      Wait Retry-After seconds; never loop sends.

      Retry after addressing the cause.

      HTTP 429 · application/json
      {
        "error": {
          "code": "OTP_KEY_RATE_LIMITED",
          "message": "Too many codes from this API key in a minute (Mursilat's number).",
          "docsUrl": "https://mursilat.com/developers/v2/errors#OTP_KEY_RATE_LIMITED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 429 · OTP_ACCOUNT_DAILY_LIMIT — The account reached its daily limit of codes from Mursilat's number.

      Wait Retry-After seconds, or contact support to raise the limit.

      Retry after addressing the cause.

      HTTP 429 · application/json
      {
        "error": {
          "code": "OTP_ACCOUNT_DAILY_LIMIT",
          "message": "The account reached its daily limit of codes from Mursilat's number.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#OTP_ACCOUNT_DAILY_LIMIT",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · IDEMPOTENCY_KEY_REQUIRED — Idempotency-Key header is required.

      Send one unique value per logical request.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "IDEMPOTENCY_KEY_REQUIRED",
          "message": "Idempotency-Key header is required.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#IDEMPOTENCY_KEY_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · IDEMPOTENCY_KEY_INVALID — Idempotency-Key must be 1–191 visible ASCII characters.

      Use e.g. order-1042-confirm.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "IDEMPOTENCY_KEY_INVALID",
          "message": "Idempotency-Key must be 1–191 visible ASCII characters.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#IDEMPOTENCY_KEY_INVALID",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 409 · IDEMPOTENCY_KEY_REUSED — This Idempotency-Key was used with a different request.

      Use a new key for a new request.

      Correct the cause before repeating the request.

      HTTP 409 · application/json
      {
        "error": {
          "code": "IDEMPOTENCY_KEY_REUSED",
          "message": "This Idempotency-Key was used with a different request.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#IDEMPOTENCY_KEY_REUSED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 409 · IDEMPOTENCY_IN_PROGRESS — The first request with this key is still running.

      Retry in a few seconds.

      Retry after addressing the cause.

      HTTP 409 · application/json
      {
        "error": {
          "code": "IDEMPOTENCY_IN_PROGRESS",
          "message": "The first request with this key is still running.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#IDEMPOTENCY_IN_PROGRESS",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 403 · SCOPE_REQUIRED — The key lacks the scope of this endpoint.

      Add the scope in details.required to the key.

      Correct the cause before repeating the request.

      HTTP 403 · application/json
      {
        "error": {
          "code": "SCOPE_REQUIRED",
          "message": "The key lacks the scope of this endpoint.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#SCOPE_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 401 · API_KEY_REQUIRED — No API key was sent.

      Send Authorization: Bearer wsl_live_…

      Correct the cause before repeating the request.

      HTTP 401 · application/json
      {
        "error": {
          "code": "API_KEY_REQUIRED",
          "message": "No API key was sent.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#API_KEY_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 401 · API_KEY_INVALID — The API key is not valid.

      Copy the key again from Settings → API keys (it is shown only once; create a new one if lost).

      Correct the cause before repeating the request.

      HTTP 401 · application/json
      {
        "error": {
          "code": "API_KEY_INVALID",
          "message": "The API key is not valid.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#API_KEY_INVALID",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 429 · RATE_LIMITED — Rate limit of this key reached.

      Wait Retry-After seconds; watch X-RateLimit-Remaining.

      Retry after addressing the cause.

      HTTP 429 · application/json
      {
        "error": {
          "code": "RATE_LIMITED",
          "message": "Rate limit of this key reached.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#RATE_LIMITED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors

    Errors →

    Behaviour notes

    sender "mursilat" (no number of your own): { "sender": "mursilat", "to": "201001234567" }. The code goes out from Mursilat's OTP number with its approved AUTHENTICATION template (copy-code button, ar/en); numberId is ignored and the plan message quota is not used. The price of the recipient's country is debited from your wallet when the send is accepted (Egypt EGP 0.40, Saudi Arabia SAR 0.08; prices can change) and refunded automatically if Meta rejects it or later reports it failed. The answer adds price { country, currency, amountMinor } and wallet { currency, balanceAfterMinor }; numberId is null. Phone numbers only (no BSUID). Limits: 5 codes per phone per hour across the platform, 60 per API key per minute, 10,000 per account per day.

    Verify, status and the otp.verified webhook are the same for both senders. With sender "mursilat", otp.verified goes to your account-level webhook (Settings → API → Webhooks).

    OTPs are limited to 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