208个应用154个国家

API v12026-11-04

用于订购验证号码和读取短信验证码的 JSON API。

基础URL https://snsverify.com/api/v1

本页面的每个路径都是相对于它的。金额以美元为单位,保留两位小数,时间为UTC(ISO 8601)。

两种格式,一个账户

本文档描述JSON格式的REST API。如果您的工具已支持通用短信验证接口(handler_api.php带action参数),请直接使用短信验证API。两种方式共享您的API密钥、价格、未完成验证及退款记录。

概述

SMS验证API允许您自己的软件为某个应用购买电话号码,等待验证短信并读取验证码,而无需打开网站。每个订单都是一个激活:一个服务、一个国家、一个号码和一个20分钟的窗口。没有收到验证码的订单将在窗口结束时全额退款。

请求使用GET进行读取,使用POST进行操作。POST主体可以是表单字段或JSON。成功的响应是JSON对象;错误信息在所有地方都具有相同的结构: {"error":{"code":"...","message":"..."}}.

认证

在控制台的API密钥下创建一个API密钥。它只显示一次;我们只保留一个加密副本。将其作为Bearer令牌发送在Authorization头中。对于无法设置头的工具,也接受key参数。

Authorization: Bearer vfk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

创建新密钥会立即替换旧密钥。服务、国家和价格端点无需密钥即可使用。

错误

HTTP含义
400缺少或错误的字段(missing_filter, bad_json)。
401没有密钥或错误的密钥(no_key, bad_key)。
402余额不足(no_balance)。
404未知的服务、国家、订单或端点。
409订单当前无法执行该操作(has_code, not_ready, too_many_open, no_numbers)。
429每分钟超过300次请求(rate_limited)。

快速入门

使用curl订购一个英国WhatsApp号码,然后每隔几秒轮询订单,直到收到验证码。

curl -X POST https://snsverify.com/api/v1/orders \
  -H "Authorization: Bearer $SNSVERIFY_KEY" \
  -d service=whatsapp -d country=gb

Python

import os, time, requests

API = "https://snsverify.com/api/v1"
H = {"Authorization": f"Bearer {os.environ['SNSVERIFY_KEY']}"}

order = requests.post(f"{API}/orders", headers=H,
    data={"service": "whatsapp", "country": "gb"}).json()["order"]
print("Use this number:", order["phone"])

while True:
    o = requests.get(f"{API}/orders/{order['id']}", headers=H).json()["order"]
    if o["code"] or o["status"] in ("refunded", "canceled"):
        break
    time.sleep(4)
print("Code:", o["code"])

Node.js

const API = "https://snsverify.com/api/v1";
const H = { Authorization: `Bearer ${process.env.SNSVERIFY_KEY}` };

const { order } = await fetch(`${API}/orders`, {
  method: "POST", headers: H,
  body: new URLSearchParams({ service: "telegram", country: "nl" }),
}).then((r) => r.json());
console.log("Use this number:", order.phone);

let o = order;
while (!o.code && !["refunded", "canceled"].includes(o.status)) {
  await new Promise((r) => setTimeout(r, 4000));
  ({ order: o } = await fetch(`${API}/orders/${order.id}`, { headers: H }).then((r) => r.json()));
}
console.log("Code:", o.code);

速率限制

每个密钥每分钟300次请求,每个账户最多20个未完成订单。每隔3到5秒轮询一次订单就足够了:大多数验证码在一分钟内到达。

订单状态

  • waiting 号码已激活,但尚未收到验证码。
  • received 至少收到一个验证码;在窗口开放期间,可以使用resend请求另一个验证码。
  • finished 在收到验证码后,由您或在窗口结束时关闭。
  • refunded 窗口结束时未收到验证码;全额退款到您的余额。
  • canceled 您在收到验证码前取消了订单;全额退款到您的余额。

端点

GET/services

每个服务代码及其名称、类别和最低价格。无需密钥。

{"services":[{"code":"whatsapp","name":"WhatsApp","category":"social","from":"0.31"}]}

GET/countries

每个国家代码(ISO,小写)及其名称和拨号代码。无需密钥。

{"countries":[{"code":"gb","name":"United Kingdom","dial_code":"44"}]}

GET/prices?service=whatsapp&country=gb

价格以美元为单位。按服务、国家或两者进行筛选。无需密钥。

{"prices":[{"service":"whatsapp","country":"gb","price":"0.94"}]}

GET/balance

您的余额(美元)。

{"balance":"25.00","currency":"USD"}

POST/orders

购买一个号码(HTTP 201)。返回包含电话号码和窗口结束时间的订单。

主体: service=whatsapp&country=gb

{"order":{"id":"AC-7K2M9QX4PB","service":"whatsapp","country":"gb","phone":"+447700900123","price":"0.94","status":"waiting","code":null,"expires_at":"2026-11-04T12:20:00.000Z"},"window_minutes":20}

GET/orders/AC-7K2M9QX4PB

一个订单及其状态和所有收到的验证码。状态:waiting, received, finished, refunded, canceled。

{"order":{"id":"AC-7K2M9QX4PB","status":"received","code":"482915","sms":"Your WhatsApp code: 482-915"}}

GET/orders?status=open

您的未完成订单;status=all返回最近的100个订单。

{"orders":[{"id":"AC-7K2M9QX4PB","status":"waiting"}]}

POST/orders/AC-7K2M9QX4PB/resend

在收到第一个验证码后,在窗口开放期间请求同一号码的另一个验证码。不额外收费。

{"order":{"status":"received","waiting_for_resend":true}}

POST/orders/AC-7K2M9QX4PB/finish

关闭已收到验证码的订单。

{"order":{"status":"finished"}}

POST/orders/AC-7K2M9QX4PB/cancel

在收到验证码前取消订单。全额退款到您的余额。

{"order":{"status":"canceled","refunded":"0.94"}}
SMS验证API:用于WhatsApp、Telegram和Google号码的REST JSON | SNSVerify