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 获取服务、域名、价格和库存。调用 getActivation 后保存返回的 mailId。使用 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?

请以适中的间隔和有上限的退避进行轮询,并在收到最终响应后停止。

号码预订成功是否保证收到短信验证码?

不能。预订仅确认号码已分配,送达仍取决于外部网络和平台规则。

超时后可以重试 getNumber 吗?

请先通过保存的 ID、历史记录或状态确认是否已创建激活,以避免重复扣费。