SIMUB

SIMUB activation API

Integrate SIMUB SMS and temporary mail activations with documented authentication, lifecycle, error handling and safe server-side examples.

Authentication and endpoint choice

Protected requests use the API key associated with your verified SIMUB account. Send it only over HTTPS and keep it in a server-side secret store or environment variable; never embed it in client code, a public repository or a screenshot. The SMSHub-compatible handler receives action as a parameter, while SIMUB SMS routes put it in the path. Choose one interface and parse its documented response format.

  • Use /stubs/handler_api.php for an existing SMSHub-style client that sends action, api_key and action-specific parameters.
  • Use /api/sms/{action} when a direct SIMUB SMS route better fits your server application.
  • Use the dedicated /api/mail endpoints for temporary mail; SMS activation identifiers and mail identifiers are separate.

Discover services, countries, prices and balance first

Call getBalance for available funds, getServices or getServicesList for current service codes, and getCountries for supported country codes. Choose getPrices, getPricesV2 or getPricesV3 for the response shape your integration expects. Catalogs, counts and prices are provider snapshots: cache them briefly, display the returned price when relevant and revalidate before purchase. Never invent a code from a visible label.

Core SMS activation lifecycle

A purchase and a status check are different operations. Persist the activation identifier immediately so an application timeout does not lose a reserved number.

  • Select a documented service and country, inspect current price and stock, then call getNumber, getNumberV2 or getNumberV3 once.
  • Parse ACCESS_NUMBER:ID:NUMBER or the documented JSON equivalent and store the activation ID with your internal request reference.
  • Poll getStatus with that ID. STATUS_WAIT_CODE means the request is still waiting; STATUS_OK:CODE contains a received code.
  • Use setStatus only for a transition allowed by the reference: 1 ready, 3 request another SMS, 6 complete or 8 cancel. Do not reuse the number for another service.

Statuses, errors and uncertain requests

SMSHub-compatible actions can return text tokens, while newer routes may return JSON. Correct or rotate a BAD_KEY credential instead of retrying. BAD_SERVICE means an action or service is unsupported. NO_BALANCE requires funding; NO_NUMBERS means no matching offer is currently available; BAD_STATUS marks an invalid transition. After a timeout, reset or server error on getNumber, reconcile through the stored activation or status before purchasing again. A blind retry can create a duplicate reservation.

مسار تفعيل البريد المؤقت

يستخدم تفعيل البريد مسارات منفصلة واستجابات JSON. استخدم getPriceRests أو getPrices أو getRests لمعرفة الخدمات والنطاقات والأسعار والمخزون. احفظ mailId الذي يعيده getActivation. استخدم getStatus للحالة وgetCode للرمز المستلم. يجب أن يتوافق setStatus وrequestRefund مع الحالة الحالية والسياسة المنشورة. البريد المؤقت ليس صندوقاً دائماً ولا وسيلة آمنة لاستعادة الحساب.

أمثلة طلبات آمنة

القيم أدناه عناصر نائبة غير صالحة عمداً. استبدلها فقط داخل بيئة خادم محمية. تمرر أمثلة curl المعلمات المشفرة بشكل منفصل ولا تجمعها يدوياً في عنوان URL.

  • الرصيد: curl --get 'https://api.simub.com/stubs/handler_api.php' --data-urlencode 'api_key=YOUR_API_KEY' --data-urlencode 'action=getBalance'
  • حجز رقم: curl --get 'https://api.simub.com/stubs/handler_api.php' --data-urlencode 'api_key=YOUR_API_KEY' --data-urlencode 'action=getNumber' --data-urlencode 'service=tg' --data-urlencode 'country=0'
  • قراءة حالة الرسائل: curl --get 'https://api.simub.com/stubs/handler_api.php' --data-urlencode 'api_key=YOUR_API_KEY' --data-urlencode 'action=getStatus' --data-urlencode 'id=ACTIVATION_ID'
  • قراءة حالة البريد: curl --get 'https://simub.com/api/mail/getStatus' --data-urlencode 'api_key=YOUR_API_KEY' --data-urlencode 'id=MAIL_ACTIVATION_ID'

الموثوقية والأمان والاستخدام المسؤول

حدد مهلاً زمنية منتهية، واستخدم تراجعاً أسياً محدوداً عند استطلاع الحالة، وتوقف عند الحالة النهائية. احذف api_key وأرقام الهاتف والعناوين والرموز من السجلات. تحقق من الاستجابات وحدّ عمليات الشراء المتزامنة. يتغير المخزون والشبكات والتصفية، لذلك لا يمكن ضمان التوفر أو وصول الرمز.

الأسئلة الشائعة

أين يجب تخزين مفتاح SIMUB API؟

في مدير أسرار على الخادم أو متغير بيئة محمي. قيّد الوصول ولا تضع المفتاح أبداً في السجلات أو كود العميل.

كم مرة يجب استدعاء getStatus؟

استعلم بفاصل معتدل مع تراجع محدود وتوقف عند استجابة نهائية.

هل يضمن حجز الرقم بنجاح وصول رمز SMS؟

لا. الحجز يؤكد تخصيص الرقم فقط، أما التسليم فيعتمد على الشبكات الخارجية وقواعد المنصة.

هل يمكن إعادة getNumber بعد انتهاء المهلة؟

تحقق أولاً من المعرّفات المحفوظة أو السجل أو الحالة لمعرفة ما إذا تم إنشاء تفعيل وتجنب الرسوم المكررة.