用于与 SMS-Activate 交互的 API 协议
API 是您的软件与我们的服务器之间的通信协议
API 用于自动化您端的短信、OTP 和 PVA 接收流程
我们的 API 与竞争对手网站完全兼容
所有请求必须发送至 https://api.sms-activate.ai/stubs/handler_api.php
POST 或 GET 请求。
所有请求必须包含以 api_key GET 参数形式提供的 API 密钥
下载 PHP 版本的协议实现 下载 Python 版本的现成协议实现激活 API
参数:
$api_key - API 密钥
$country * - 国家代码 查看表格
$operator * 移动运营商编号,您可以指定多个用逗号分隔的编号(仅适用于:
** 适用于 $country = 0, $country = 1, $country = 2
响应:
服务响应将以 JSON 格式返回,示例:
{"vk_0":76,"ok_0":139,"wa_0":90,"vi_0":223,"tg_0":158,"wb_0":106,"go_0":182,"av_0":244,"av_1":211,"fb_0":107}
其中连字符前为服务名称,连字符后表示是否包含重定向。0 - 否,1 - 是。
参数:
$api_key - API 密钥
$service * - 服务 查看表格
* 可选参数。如果未指定,默认将显示所有服务的热门国家/地区。
$freePrice * - 可选参数。如果提供 true,数量和价格将根据 Free Price 提供
响应:
服务响应将以 JSON 格式返回,示例:
{
0: {
"country: 0,
"count": 43575,
"price": 15.00,
"retail_price": 30.00
}, ...
}
$freePrice = true:
{
0: {
"country: 0,
"count": 43575,
"price": 15.00,
"retail_price": 30.00,
"freePriceMap": {
"15.00": 43242,
"18.00": 333
}
}, ...
}
带返现账户的余额查询:
* 如果在返现账户设置中勾选了“使用返现进行激活”,则返回包含累计返现的余额
参数:
$api_key - API 密钥
响应:
ACCESS_BALANCE: '账户余额'
可能出现的错误:
BAD_KEY - API 密钥无效
ERROR_SQL - SQL 服务器错误
* 返回指定国家/地区可用的所有运营商;如果未指定国家/地区,则返回每个国家/地区可用的所有运营商
参数:
$api_key - API 密钥
$country - 国家/地区代码
响应:
服务响应将以 JSON 格式返回:
{"status":"success", "countryOperators": {
"Country1Code": ["operator1Name","operator2Name","operator3Name", ...],
"Country2Code": ["operator1Name","operator2Name","operator3Name", ...],
...
}}
示例:
{"status":"success", "countryOperators": {
"0": ["beeline","megafon","mts", ...],
"1": ["life","mts","kyivstar","utel" ...],
...
}}
* 在 'countryOperators' 内部,键为国家/地区代码
可能出现的错误:
BAD_KEY - API 密钥无效
ERROR_SQL - SQL 服务器错误
OPERATORS_NOT_FOUND - 未找到记录(例如,传入了不存在的国家/地区)
参数:
$api_key - API 密钥
响应:
服务响应将以 JSON 格式返回:
{"status":"success", "activeActivations": [
{
"activationId" : "635468021",
"serviceCode" : "vk",
"phoneNumber" : "79********1",
"activationCost" : "12.50",
"activationStatus" : "4",
"smsCode" : ["CODE"],
"smsText" : "[Your CODE registration code]",
"activationTime" : "2022-06-01 16:59:16",
"discount" : "0.00",
"repeated" : "0",
"countryCode" : "0",
"countryName" : "Russia",
"canGetAnotherSms" : "1",
}]
可能出现的错误:
BAD_KEY - API 密钥无效
ERROR_SQL - SQL 服务器错误
NO_ACTIVATIONS - 未找到条目(无活跃激活)
参数:
$api_key - API 密钥
$service - 订购服务 查看表格
$forward * - 是否需要请求带转发的号码
* 可选参数,接受 0(不执行,默认值)或 1(执行)
$maxPrice * - 您愿意以 Free Price 购买号码的最高价格
* 可选参数,如果未指定,将以常规价格进行购买
$phoneException * - 排除俄罗斯号码的前缀。用逗号分隔。记录格式:国家/地区代码和 3 到 6 位掩码数字(例如 7918、7900111)。默认值为账户中指定的值。
$operator* 是号码所属的移动运营商,您可以使用逗号指定多个运营商(仅适用于 **)
$activationType - 激活类型:0 - 通过短信(默认),1 - 通过号码,2 - 通过语音
$language - 解析语言(语音激活时需要) 查看表格
$userId * - 因激活统计不佳而被封禁的用户 ID,但代理商自己的账户不受影响。
* 可选字段
** 适用于 $country = 0, $country = 1, $country = 2
$ref - 传递推荐人 ID。
$country - 国家代码 查看表格
$useCashBack* - 接受布尔值,如果参数为 'true',购买号码时将使用返现余额支付。当返现余额用完后,后续所有购买将使用主余额。请务必记住,后续所有购买将优先使用返现余额,之后才使用主余额(即使之后传递参数 'false' 也是如此)。
* 可选参数,接受 'true'
可能出现的错误:
WRONG_MAX_PRICE:$min- 指定的最高价格低于允许的价格
$min - 最低允许价格
BAD_ACTION - 操作不正确
BAD_SERVICE - 服务名称不正确
BAD_KEY - API 密钥无效
ERROR_SQL - SQL 服务器错误
BANNED:'YYYY-m-d H-i-s' - 账户被封锁的时间
WRONG_EXCEPTION_PHONE - 排除前缀不正确
NO_BALANCE_FORWARD - 资金不足,无法购买呼叫转移
CHANNELS_LIMIT - 账户已被封锁
NO_NUMBERS - 无可用号码
如果您尝试获取特定运营商的号码,而该运营商不在所选国家/地区运营或不提供所选服务,系统将返回符合请求参数的第一个运营商的号码
该方法的工作方式类似于方法 getNumber,接受相同的参数以及下面描述的额外参数,但会返回额外的激活信息
参数:
$orderId- 来自代理商系统的激活 ID。在购买时,此数据会与系统中的激活 ID 和代理商进行比对。因此,我们希望实现幂等性(同一订单不会被重复处理)。
响应:
如果请求成功,响应将采用以下格式:
{
"activationId": 635468024,
"phoneNumber": "79584******",
"activationCost": "12.50",
"countryCode": "0",
"canGetAnotherSms": "1",
"activationTime": "2022-06-01 17:30:57",
"activationOperator": "mtt"
}
如果您尝试获取特定运营商的号码,而该运营商不在所选国家/地区运营或不提供所选服务,系统将返回符合请求参数的第一个运营商的号码
可能出现的错误:
ORDER_ALREADY_EXISTS- 订单已创建
当您收到发送到号码的短信时,如果您在设置中启用了 Webhooks 功能,我们将通过 POST 请求向您指定的地址发送有关该短信的信息
响应:
响应格式如下:
{
"activationId": 635468024,
"service": "go",
"text": "Your sms text",
"code": "Your sms code",
"country": 0,
"receivedAt": "2022-06-01 17:30:57",
}
发送请求时,我们将等待您的脚本返回 HTTP 状态码 200。如果您的脚本未响应,我们将在 2 小时内重试发送请求,但最多不超过 8 次。
您可以在以下位置启用此功能 个人资料设置
参数:
$api_key - API 密钥
$service - 订购服务 查看表格
$forward * - 是否需要请求带转发的号码
* 可选参数,转发字符以逗号分隔,转发位数必须与参数中传输的服务数量相匹配 $service。仅允许传输 1 个带重定向的服务,例如 "0,1,0,0" - 正确,"0,1,1,0" - 错误。取值为 0(不执行,默认)或 1(执行)
$operator * - 号码的移动运营商,您可以指定多个以逗号分隔的数字(仅适用于 **):
$ref - 传递推荐人 ID。
$country - 国家代码 查看表格
响应:
NO_NUMBERS - 无可用号码
NO_BALANCE - 余额不足
{{'phone':phone,'activation':activation,'service':service},
{'phone':phone,'activation':activation,'service':service}}, 其中 (phone - 操作 ID,activation - 电话号码,service - 服务)
可能出现的错误:
BAD_ACTION - 操作不正确
BAD_SERVICE - 服务名称不正确
BAD_KEY - API 密钥无效
ERROR_SQL - SQL 服务器错误
BANNED:'YYYY-m-d H-i-s' - 账户被封锁的时间
参数:
$api_key - API 密钥
$id - 激活 ID
$forward * - 您希望转发到的电话号码
* 仅在传递了 getNumber forward=1 参数时才需要。
$status - 激活状态
1 - 通知号码可用(短信已发送至该号码)
3 - 请求再获取一个验证码(免费)
6 - 完成激活 *
8 - 报告号码已被使用并取消激活
* 如果状态为“已收到代码”,则标记为成功并完成;如果状态为“准备中”,则删除并标记为错误;如果状态为“等待重试”,则将激活转移至待处理短信
** 如果号码已到达,则无法更改选择了电话验证方式的激活状态
API 工作流程的简单逻辑顺序:
使用 getNumber 方法获取号码后,可执行以下操作:
8 - 取消激活(如果号码不适合您)
1 - 通知短信已发送(可选)
对于状态为 1 的激活:
8 - 取消激活
收到验证码后立即执行:
3 - 请求再发送一条短信
6 - 确认短信验证码并完成激活
对于状态为 3 的激活:
6 - 确认短信验证码并完成激活
响应:
ACCESS_READY - 号码就绪确认
ACCESS_RETRY_GET - 等待新的短信
ACCESS_ACTIVATION - 服务已成功激活
ACCESS_CANCEL - 激活已取消
可能出现的错误:
EARLY_CANCEL_DENIED - 不允许在前2分钟内取消号码
ERROR_SQL - SQL 服务器错误
NO_ACTIVATION - 激活ID不存在
BAD_SERVICE - 服务名称不正确
BAD_STATUS - 状态不正确
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
WRONG_ACTIVATION_ID - 无效的ID或ID不是数字。
参数:
$api_key - API 密钥
$id - 激活 ID
响应:
STATUS_WAIT_CODE - 等待短信
STATUS_WAIT_RETRY: '过去,未匹配的代码' - 等待代码澄清
STATUS_WAIT_RESEND - 等待重新发送短信 *
* 软件必须点击“重新发送短信”并将状态更改为 6
STATUS_CANCEL - 激活已取消
STATUS_OK: 'activation code' - 已收到验证码
可能出现的错误:
NO_ACTIVATION - 激活ID不存在
ERROR_SQL - SQL 服务器错误
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
参数:
$api_key - API 密钥
$id - 激活 ID
响应:
响应格式如下:
{
"verificationType": 2,
"sms": {
"dateTime": "0000-00-00 00:00:00",
"code": "code",
"text": "sms text",
},
"call": {
"from": "phone",
"text": "voice text",
"dateTime": "0000-00-00 00:00:00",
"url": "voice file url",
"parsingCount": 1,
}
}
STATUS_CANCEL - 激活已取消
可能出现的错误:
NO_ACTIVATION - 激活ID不存在
ERROR_SQL - SQL 服务器错误
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
参数:
$api_key - API 密钥
$start - Unix 时间戳格式的时间戳(可选)- 从哪个日期开始统计激活
$end - Unix 时间戳格式的时间戳(可选)- 统计激活的截止日期
$offset - 响应中返回的第一个元素的偏移量。默认为 0
$limit - 返回记录的最大数量。最大值为 100。默认为 50。
响应:
响应格式如下:
[{
"id": 635468024,
"date": "2022-11-12 15:58:39",
"phone": "79918529716",
"sms": "sms":"["Your sms code"]",
"cost": 100 //Если активация не завершена, то cost = 0,
"status": "4",
}]
可能出现的错误:
ERROR_SQL - SQL 服务器错误
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
参数:
$api_key - API 密钥
$service - 服务名称
响应:
响应格式如下:
[{
"country": 0,
"share": 50 - // (Purchases of the chosen service by country as a percentage of the total quantity of purchases at our service),
"rate": 50 - // (% of successful activations among the total number of activations by the country)
}]
可能出现的错误:
ERROR_SQL - SQL 服务器错误
BAD_KEY - API 密钥无效
WRONG_SERVICE - 服务不正确
BAD_ACTION - 操作不正确
参数:
$api_key - API 密钥
$id - 激活 ID
响应:
服务响应将以 JSON 格式返回,示例:
{"status":"2","phone":false}
可能的状态:
2 - 新激活
3 - 成功完成
4 - 已取消
5 - 已退回
可能出现的错误:
BAD_KEY - API 密钥无效
INVALID_ACTIVATION_ID - 无效的激活 ID
响应:
JSON - 对象格式
{"Service":{"Country":{"count":Quantity,"price":"Price"}}}
参数:
$api_key - API 密钥
响应:
JSON - 对象格式 {{'Страна':{'id':0,'rus':"Россия","eng:"Russia","chn":"俄罗斯","visible":1,"retry":1,"rent":1,"multiService":1}},
其中(
id :国家 ID;
rus :俄语国家名称;
eng :英语国家名称;
chn :中文国家名称;
visible :0 - 国家不在网站上显示,1 - 显示;
retry :0 - 不支持重复发送短信,1 - 支持;
rent :0 - 国家不可租赁,1 - 可租赁;
multiService :0 - 国家不支持多服务,1 - 支持。)
参数:
$api_key- API 密钥
$country *- 国家 ID。如果指定了国家,我们将返回该国有定价的服务
$lang *- 用于提供 `name` 的语言。可选值:'ru'、'en'、'es'、'cn'。默认为 'en'
* 可选参数
响应:
JSON - 对象格式 { "status": "success", "services": [ { "code": "aoo", "name": "Pegasus Airlines" } ] }
在收到转发号码的首条短信后,您可以购买其他相关服务,如 Yula、Yandex、Avito 等任意服务
额外服务的费用仅为 5p
响应:
ADDITIONAL:$id:$phone - 新激活已成功创建。其中 ID 为额外激活的 ID,phone 为电话号码
可能出现的错误:
WRONG_ADDITIONAL_SERVICE - 无效的额外服务(仅允许转发类服务)
WRONG_ACTIVATION_ID - 父级激活 ID 不正确
WRONG_SECURITY - 尝试传输未重定向的激活 ID,或已完成的/非活跃激活时发生错误
REPEAT_ADDITIONAL_SERVICE - 尝试重复订购已购买的服务时出错 NO_BALANCE - 余额不足
ERROR_SQL- 数据库错误,请联系客户服务
如果您已成功激活该号码,则可以再次进行激活。
额外激活的费用取决于国家和服务。具体费用可从 . 获取
参数:
$api_key - API 密钥
$activationId - 父级激活 ID
响应:
ACCESS_NUMBER:$id:$phone - 新激活已成功创建。其中 $id 为额外激活的 ID,$phone 为电话号码
可能出现的错误:
RENEW_ACTIVATION_NOT_AVAILABLE- 该号码不支持额外激活
WRONG_ACTIVATION_ID - 父级激活 ID 不正确
ERROR_SQL- 数据库错误,请联系客户服务
NEW_ACTIVATION_IMPOSSIBLE- 无法进行额外激活
NO_BALANCE - 账户余额不足
您可以查询号码是否支持额外激活并获取其费用
参数:
$api_key - API 密钥
$activationId - 父级激活 ID
响应:
JSON - 对象格式 {'status': 'success', 'cost':200,"service":"tw","phone":777777777,"country":14},
可能出现的错误:
RENEW_ACTIVATION_NOT_AVAILABLE- 该号码不支持额外激活
WRONG_ACTIVATION_ID - 父级激活 ID 不正确
SIM_OFFLINE - SIM 卡离线
响应:
响应格式如下:
{
"result": "OK"
}
STATUS_CANCEL - 激活已取消
NO_CALL- 未收到呼叫
PARSE_COUNT_EXCEED- 解析尝试次数超限(最多4次)
可能出现的错误:
WRONG_ACTIVATION_ID - ID无效,激活不存在
ERROR_SQL - SQL 服务器错误
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
租赁 API
参数:
$api_key - API 密钥
$time* - 租用时长(默认:4小时)
$operator* - 号码所属移动运营商,可指定多个,以逗号分隔(默认:任意)
$country* - 国家(默认:俄罗斯)
$incomingCall * - 如果已转移 "true"获取支持接听电话功能的号码
响应:
服务响应将以 JSON 格式返回,示例:
{ "countries": { "0": 0 }, "operators": { "0": "aiva", "1": "any", "2": "beeline", ... "16": "yota" }, "services": { "full": { "cost": 42.93, "quant": 20 }, "vk": { "cost": 21.95, "quant": 20 }, "ok": { "cost": 7.68, "quant": 55 }, "ot": { "cost": 5.2, "quant": 42 } } }
可能出现的错误:
BAD_KEY - API 密钥无效
OUT_OF_STOCK - 该国家的号码不可用
参数:
$api_key - API 密钥
$service - 您需要获取号码的服务
$time* - 租用时长(小时)(默认:4小时)。下一个可用时段为12小时,然后是24小时。当请求租用一天或更长时间时,必须传入:24、48、72等。
$operator* - 号码所属移动运营商,可指定多个,以逗号分隔(默认:任意)
$country* - 国家(默认:俄罗斯)
$url * - Webhook链接(默认不处理)
$incomingCall * - 如果已转移 "true"获取支持接听电话功能的号码
* 可选参数。如果未指定,将使用默认参数。
响应:
服务响应将以 JSON 格式返回,示例:
{ "status": "success", "phone": { "id": 1049, "endDate": "2020-01-31T12:01:52", "number": "79959707564" } }
可能出现的错误:
BAD_KEY - API 密钥无效
JSON格式响应:
{ "status": "error", "message": "*possible_answer*" }
字段中可能的答案 "message":
BAD_SERVICE - 未指定服务或名称不正确
NO_BALANCE - 账户余额不足
NO_NUMBERS - 无可用号码
ACCOUNT_INACTIVE - 无可用号码
SERVER_ERROR - 服务器错误
CHANNELS_LIMIT - 账户已被封锁
参数:
$api_key - API 密钥
$id - 订购号码时回复中收到的租用ID
$page* - 开始选择的页码(页码从0开始,从新到旧;默认为0)
$size* - 每页大小(默认10)
* 可选参数。如果未指定,将使用默认参数。
响应:
服务响应将以 JSON 格式返回,示例:
{ "status": "success", "quantity": "2", "values": { "0": { "phoneFrom": "79180230628", "text": "5", "service": "ot", "date": "2020-01-30 14:31:58" }, "1": { "phoneFrom": "79180230628", "text": "4", "service": "ot", "date": "2020-01-30 14:04:16" } } }
* 仅当存在短信时成功('quantity' > 0)。
可能出现的错误:
BAD_KEY - API 密钥无效
JSON格式响应:
{ "status": "error", "message": "*possible_answer*" } 字段中可能的答案 "message": NO_ID_RENT - 未指定租用ID INVALID_PHONE - 号码并非由您租用(无效的租用ID) STATUS_FINISH - 租用已支付并完成 STATUS_CANCEL - 租用已取消并退款 STATUS_WAIT_CODE - 等待第一条短信 STATUS_REVOKE - 号码已被屏蔽,您的资金已退回
参数:
$api_key - API 密钥
$id - 订购号码时回复中收到的租用ID
$status - 更改状态代码(号码)
状态可以是:
响应:
服务响应将以 JSON 格式返回:
{ "status": "success" }
可能出现的错误:
BAD_KEY - API 密钥无效
JSON格式响应:
{ "status": "error", "message": "*possible_answer*" }
字段中可能的答案 "message":
NO_ID_RENT - 未指定租用ID
INCORECT_STATUS - 状态缺失或指定错误
CANT_CANCEL - 无法取消租用(超过20分钟)
INVALID_PHONE - 号码并非由您租用(无效的租用ID)
ALREADY_FINISH - 租用已完成
ALREADY_CANCEL - 租用已取消
SERVER_ERROR - 服务器错误
👉注意!此方法仅显示最近10个号码。如果您需要更多号码,请使用 getRentStatus 方法来检查状态。
参数:
$api_key - API 密钥
响应:
服务响应将以 JSON 格式返回:
{ "status": "success", "values": { "0": { "id": "12345", "phone": "79181234567" }, "1": { "id": "12345", "phone": "79181234568" } } }
可能出现的错误:
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
JSON格式响应:
{ "status": "error", "message": "*possible_answer*" }
字段中可能的答案 "message":
NO_NUMBERS - 没有租用的号码
SERVER_ERROR - 服务器错误
参数:
$api_key - API 密钥
$id - 租用ID
$rent_time- 租用时长(默认:4小时)
响应:
服务响应将以 JSON 格式返回:
{ "status": "success", "phone": { "id": 1049, "endDate": "2020-01-31T12:01:52", "number": "79959707564"} }
当续订已完成的租用时,将重新下单并提供新的ID
可能出现的错误:
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
SERVER_ERROR - 服务器错误
JSON格式响应:
{ "status": "error", "message": "*possible_answer*", "info": "*details*" }
字段中可能的答案 "message":
NO_ID_RENT - 没有租用ID
INVALID_TIME - 时间错误。可用时长范围为4至1344小时
MAX_HOURS_EXCEED - 超出最大可用时长
最大 - 最大可用时长
INVALID_PHONE - 无效的租用ID
RENT_DIE - 无法延长租用时间,因为号码已过期
NO_BALANCE - 余额不足
CHANNELS_LIMIT - 账户已被封锁
* 此方法仅适用于 MTT 运营商的租用服务。
参数:
$api_key - API 密钥
$id - 租用ID
$rent_time - 租用时长
响应:
服务响应将以 JSON 格式返回:
{ "status": "success", "price": 6.33 }
可能出现的错误:
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
SERVER_ERROR - 服务器错误
JSON格式响应:
{ "status": "error", "message": "*possible_answer*" }
字段中可能的答案 "message":
NO_ID_RENT - 没有租用ID
INVALID_PHONE - 无效的租用ID
INVALID_TIME - 时间设置错误
RENT_DIE - 无法延长租用时间,因为号码已过期
MAX_HOURS_EXCEED - 超出最大可用时长
最大 - 最大可用时长
CHANNELS_LIMIT - 账户已被封锁
API JAVA
在 Maven 中包含库
<artifactId>SMSActivateApi</artifactId>
<version>1.0</version>
</dependecy>
您可以查看注册示例,请点击 MavenRepository 链接
导入主类以与 SMS-Activate API 进行交互。
要使用该库,您需要一个 API 密钥,您可以在本页面及下方链接中获取。
SMS-Activate API 密钥要获取账户当前余额,请使用方法 getBalance... 如果您除了余额外还关心返现金额,请调用方法 getBalanceAndCashBack.
方式 getBalanceAndCashBack 返回类对象SMSActivateGetBalanceAndCashBack.
参数:
无
返回类型:
BigDecimal
参数:
无
参数:
countryId(Integer) - 国家/地区标识符。
service(String) - 服务的简称。
forward*(boolean) - 是否请求带有呼叫转移功能的号码。
operatorSet*(集合) - 运营商集合。
phoneException*(集合) - 仅排除俄罗斯前缀,号码范围为3到6位(例如7918、7900111)。
* 可选参数。如果未指定,将根据个人资料中的设置提供默认数量。
返回类型:
参数:
countryId(Integer) - 国家/地区标识符。
operatorSet*(集合) - 该服务可用的运营商集合
参数:
id(整数) - 激活标识符
service(String) - 服务的简称。
可以传递接收到的类对象来代替激活标识符 SMSActivateActivation 在使用该方法后 getNumber 或使用后的某个激活 getMultiServiceNumber.
参数:
countryId(Integer) - 国家/地区标识符。
serviceMap(集合) - 购买激活的服务集合
multiForwardList(列表) - 支持呼叫转移的服务列表
operatorSet(集合) - 运营商集合。
参数:
无
返回类型:
参数:
countryId(Integer) - 国家/地区标识符。
service(String) - 服务的简称。
返回类型:
参数:
countryId(Integer) - 国家/地区标识符。
返回类型:
参数:
activationId(整数) - 激活标识符
可以传递接收到的类对象来代替激活标识符 SMSActivateActivation 在使用该方法后 getNumber 或使用后的某个激活 getMultiServiceNumber.
参数:
id(整数) - 激活标识符
status(SMSActivateClientStatus) - 要设置的激活状态
可以传递接收到的类对象来代替激活标识符 SMSActivateActivation 在使用该方法后 getNumber 或使用后的某个激活 getMultiServiceNumber.
参数:
无
参数:
activationId(整数) - 激活标识符
可以传递接收到的类对象来代替激活标识符 SMSActivateActivation 在使用该方法后 getNumber 或使用后的某个激活 getMultiServiceNumber.
通过激活接收完整短信文本的算法
使用 getNumber 方法获取号码后,可执行以下操作:
CANCEL - 8 - 取消激活(如果号码不符合您的要求)
MESSAGE_WAS_SENT - 通知短信已发送(必须设置此状态才能接收完整短信内容)
在强制设置 MESSAGE_WAS_SENT 状态后,请使用 waitSMS 方法并传入激活参数及等待超时时间,以接收短信。
收到短信后,您可以使用 getFullSMS 方法获取短信,然后通过 getText() 方法显示完整文本。
之后,您可以将激活状态设置为以下值:
要将激活状态设置为 MESSAGE_WAS_SENT:
CANCEL - 取消激活
收到验证码后立即执行:
REQUEST_ONE_MORE_CODE - 请求再次发送短信
FINISH - 确认短信验证码并完成激活
要将激活状态设置为 REQUEST_ONE_MORE_CODE:
FINISH - 确认短信验证码并完成激活
参数:
countryId(Integer) - 国家/地区标识符。
service(String) - 服务的简称。
hours(Integer)* - 租赁时长
operator(String)* - 移动运营商名称
urlWebhook(String)* - Webhook 链接(默认情况下不处理)
什么是WebHook?* 可选参数。如果未指定,将使用默认值
参数:
countryId(Integer) - 国家/地区标识符。
operatorSet(集合) - 移动运营商集合
hours(Integer)* - 租赁时长
* 可选参数。如果未指定,将使用默认值
参数:
rentId(Integer) - 租赁号码的标识符
除了 rentId,您还可以传递生成的类对象 SMSActivateRentActivation 在使用该方法后 getRentNumber
返回类型:
电子邮件 API
API 状态说明
3 - 等待中
4 - 已取消
5 - 成功
描述:
更严格地遵循 REST API 原则,并增加了用于注册 Telegram 账户的 gmail.com 邮箱数量。
参数:
$api_key - API 密钥
$site- 您需要邮箱的网站
响应:
服务响应将以 JSON 格式返回,示例:
{
"status":"OK",
"response":{
"zones":[
{
"name":"info",
"cost":2.5
},
...
],
"popular":[
{
"name":"mail.ru",
"cost":6,
"count":159008
},
...
]
}
}
可能出现的错误:
BAD_SITE- 未指定网站
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
参数:
$api_key - API 密钥
$site - 您需要邮箱的网站
$mail_type - 邮箱类型:热门域名或区域(1 - 区域,2 - 热门)
$mail_domain - 已选择的区域或域名
可能出现的错误:
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
MAIL_TYPE_ERROR - 指定站点不存在该域名
CHANNELS_LIMIT - 账户已被封锁
参数:
$api_key - API 密钥
$id- 需要重新激活的邮件ID
响应:
服务响应将以 JSON 格式返回,示例:
{
"status": "OK",
"response": {
"email": "[email protected]",
"id": 360
}
}
可能出现的错误:
BAD_KEY - API 密钥无效
BAD_ACTION - 操作不正确
BLOCKED_SITE - 被屏蔽的网站
BAD_BALANCE - 余额不足
ACTIVATION_NOT_FOUND - 未找到激活记录
CHANNELS_LIMIT - 账户已被封锁
参数:
$api_key - API 密钥
$page- 页码
$per_page- 每页的购买数量
$search- 搜索栏
$sort- 排序方向(desc:降序,asc:升序)
响应:
服务响应将以 JSON 格式返回,示例:
{
"status":"OK",
"response":{
"list":[
{
"id":"241",
"site":"apple.com",
"email":"[email protected]",
"status":"3",
"value":null,
"cost":"6.00",
"date":"2023-10-06 14:24:13",
"full_message":""
}
],
"pages":1,
"count":1
}
}
参数:
$api_key - API 密钥
$id- 购买ID
响应:
服务响应将以 JSON 格式返回,示例:
{
"status":"OK",
"response":true
}
可能出现的错误:
EARLY_CANCEL_DENIED - 前2分钟内无法取消邮件。
参数:
$api_key - API 密钥
$id- 已购买邮箱的ID,在购买邮箱后返回
响应:
服务响应将以 JSON 格式返回,示例:
{
"status":"OK",
"response":{
"value":"Содержания письма"
}
}
API 合作伙伴软件
参数:
$api_key - API 密钥
$id- 您需要购买的软件ID
响应:
服务响应将以 JSON 格式返回,示例:
{
"status": "success",
"key": "F5qrzFoY6afj3zrEq7SeMplbx",
"manual": "Software download link:"
}
可能出现的错误:
BAD_DATA - ID不正确或ID不是数字
BAD_ACTION - 操作无效或分销商未经验证。
<?php
include_once ("smsactivateApi.php");//Inclusion of a class in a project
$sms = new SMSActivate($API_KEY);//Create class instance SMSActivate
$freeSlots = $sms->getNumbersStatus(0, 'tele2');//Get the number of available numbers for the country of Russia and the tele2 operator
echo "Номеров Вконтакте: " . $freeSlots['vk']."\n";//Show for Vk
echo "Номеров Whatsapp: " . $freeSlots['wa']."\n";//Show for whatsapp
var_dump($freeSlots); //Show all services with quantity
$array=$activate->getTopCountriesByService(); //Get an array whose elements contain information for each country
$balance = $sms->getBalance();//Get balance
echo "On the account " . $balance." rub.\n";//Show balance
$balance = $sms->getBalanceAndCashBack();//Request a balance with cashback account
echo "On the account " . $balance." rub.\n";//Request a balance with cashback account
$operators = $sms->getOperators();
//Get operators for all countries
if (in_array('mts', $operators['countryOperators'][0])) {
//check if 'mts' is available for Russia
//perform an action
}
if (in_array('chinamobile', $operators['countryOperators'][3])) {
//check if 'chinamobile' is available for China
//perform an action
}
$activations = $sms->getActiveActivations();
$number = $sms->getNumber('ok',0, 0, 'tele2');//Get Odnoklassniki number without forwarding
echo "Activation № " . $number['id']. "Phone ". $number['number'] \n";//Show id and activation number
$result = $sms->getNumber('vk', 0 , 1);
if (!is_array($result)) {
echo 'Ошибка: ' . $result . '\n';//If an error occurs, a string will be returned, if successful, an array will be returned.
} else {
echo 'Id: ' . $result['id'] ."\n";
echo 'Номер: ' . $result['number'] ."\n";
}
$result = $sms->getNumberV2('vk', 0 , 1);
$number = $sms->getMultiServiceNumber('ok,vk,vi,av','0,0,0,1', 0, 'tele2');//Get a number for services Odnoklassniki, Vkontakte, Viber without call forwarding and Avito with call forwarding
foreach ($number as $value) {
echo "Activation № " . $value['activation']. " for service ". $value['service'] ."\n";
}
echo "Number " . $value['phone'] ."\n";//Show activation id and number
$status = $sms->setStatus($number['id'], 3);//Change activation status by id (get 1 more code)
$status = $sms->getStatus($number['id']);//Get activation status by id
if (is_array($status) {
echo "статус : " . $status['status'];//Can be STATUS_OK or STATUS_WAIT_RETRY, otherwise a line with error text will be returned
echo "код: " . $status['code'];
} else {
echo $status ."\n";
}
$incomingCall = $sms->getIncomingCallStatus($id);//Get activation data by call
echo $incomingCall['phone'] //Show incoming number
$prices = $sms->getPrices(1, 'vk');//Get the current price for the service
echo "Price for VK (Ukraine) : " .$prices[1]['vk']['cost']." rub. quantity: ". $prices[1]['vk']['count'];//Show the result
$countries = $sms->getCountries();//Get a list of all countries
$additional = $sms->getAdditionalService('fx', $id);//Get additional activation for PGbonus service based on id activation
echo "Activation no.: " . $additional[id] . " Telephone: " . $additional[number];//Show the result
$getAvailableRentNumbers = $sms->getRentServicesAndCountries('2');//Request available countries for rent and services (for 2 hours for all operators)
echo "Full rental - Cost:" . $getAvailableRentNumbers['services']['full']['cost'] . " Quant :" .$getAvailableRentNumbers['services']['full']['quant'] ." \n"; //Display full price information
foreach( $getAvailableRentNumbers['operators'] as $value) {
echo " Operator " . $value ."\n"; }//List operators
$getRentNumber = $sms->getRentNumber('vk','10','0','yota');//Get a number for rent for Vkontakte for 10 hours, operator 'Yota', country - Russia
if ($getRentNumber['status'] === 'success'){
echo "The rental was successful! Your phone number is: " . $getRentNumber['phone']['number']." \nRent expiration : ". $getRentNumber['phone']['endDate']." \nId numbers :" .$getRentNumber['phone']['id'] ; }//Display rental information
else
echo "Error code : " . $getRentNumber['message'];
$getRentStatus = $sms->getRentStatus($getRentNumber['phone']['id']);//Get the rent status with id from the received number
if ($getRentStatus['status'] == 'success'){
foreach( $getRentStatus['values']as $index => $value) {
echo " Message " . $index .": from the number - " . $value['phoneFrom'] . " Service - " . $value ['service'] . "message text - " . $value['text'] . "Date - " . $value['date']; } }//display a list of messages received while renting a phone
else
echo "Error code : " . $getRentStatus['message'];
$setRentStatus = $sms->setRentStatus($getRentNumber['phone']['id'],1);//Set rental status 'finish' with id from received number
if ($setRentStatus['status'] == 'success')
echo " Status change was successful! ";
else
echo "Error code : " . $setRentStatus['message'];
$getRentList = $sms->getRentList();//Get a list of currently rented numbers
if (getRentList['status'] == 'success')
foreach( $getRentList['values'] as $value) {
echo " ID " . $value["id"] . " Number " . $value["phone"] ."\n"; }//List numbers
else
echo "Error code : " . $getRentList['message'];
$result = $sms->continueRentNumber($id);//Extend the lease of activation id for 4 hours (by default)
if ($result['status'] == 'success') {
echo "Number: " . $result['phone']['number']"//Display number
echo "id: " . $result['phone']['id']"//Display activation id
echo "The lease is valid until: " . $result['phone']['endDate']"//Display the date and time of the end of the lease
} else {
echo "Error code : " . $result['msg'];
}
$result = $sms->getContinueRentPriceNumber($id, 12);//Get the cost of renewing the lease to activate the id for 12 hours
if ($result['status'] == 'success') {
echo " Renewal cost " . $result['price'];//Withdraw the cost
} else {
echo "Error code: " . $result['message']; //Display error code
}
from sms-activate.la import SMSActivateAPI
# SMSActivateAPI Contains all basic tools for working with the SMSActivate API
sa = SMSActivateAPI(API_KEY)
sa.debug_mode = True
# Used for debugging. When debug_mode is active, all responses from the server and class will be output to the console
print(sa.version())
# Returns the current version of the library
status = sa.getNumbersStatus(country=0, operator='tele2')
try:
print(status['vk_0']) # 274789
except:
print(status['message']) # Error text
result = sa.getTopCountriesByService('vk')
try:
print(result[0]['count']) # 2350
except:
print(result['message']) # Error text
balance = sa.getBalance() # {'balance': '100.00'}
try:
print(balance['balance']) # 100.00
except:
print(balance['message']) # Error text
balance = sa.getBalanceAndCashBack() # {'balance': '100.00'}
try:
print(balance['balance']) # 100.00
except:
print(balance['message']) # Error text
operators = sa.getOperators(country=0)
try:
print(operators['countryOperators']['0'])
except:
print(operators['error']) # Error status
activations = sa.getActiveActivations()
try:
print(activations['activeActivations'])
except:
print(activations['error']) # Error status
number = sa.getNumber(service='vk', operator='tele2', country=0, verification="true") # {'activation_id': 000000000, 'phone': 79999999999}
try:
print(number['phone']) # 79999999999
except:
print(number['message']) # Error text
number = sa.getNumberV2(service='vk', country=0)
try:
print(number['phoneNumber']) # 79999999999
except:
print(number['message']) # Error text
multinumber = sa.getMultiServiceNumber(service='fb,ig', operator='tele2', country=0) # [{'phone': '79999999999', 'activation': 000000000, 'service': 'fb'}, {'phone': '79999999999', 'activation': 000000001, 'service': 'ig'}]
try:
print(multinumber[0]['phone']) # 79999999999
except:
print(multinumber['message']) # Error text
status = sa.setStatus(id=000000000, status=1) # ACCESS_READY
try:
print(status) # ACCESS_READY
except:
print(status['message']) # Error text
status = sa.getStatus(id=000000000) # STATUS_WAIT_CODE
try:
print(sa.activationStatus(status)) # {'status': 'STATUS_WAIT_CODE', 'message': 'Ожидание смс'}
except:
print(status['message']) # Error text
status = sa.getIncomingCallStatus(id=000000000)
try:
print(status['status']) # 2
except:
print(status['message']) # Error text
prices = sa.getPrices(service='fb', country=0)
try:
print(prices['0']) # {'fb': {'cost': 9, 'count': 27934}}
except:
print(prices['message']) # Error text
countries = sa.getCountries()
try:
print(countries['0']['eng']) # Russia
except:
print(countries['message']) # Error text
service = sa.getAdditionalService(id=000000000, service='ig')
try:
print(service['phone']) # 79999999999
except:
print(service['message']) # Error text
service = sa.getRentServicesAndCountries(time=4, operator='tele2', country=0)
try:
print(service['services']['full']['cost']) # 100.00
except:
print(service['message']) # Error text
rent = sa.getRentNumber(service='ig', time=4, operator='tele2', country=0)
try:
print(rent['phone']['number']) # 79999999999
except:
print(rent['message']) # Error text
status = sa.getRentStatus(000000000)
try:
print(status['values']['0']['text']) # SMS
except:
print(status['message']) # Error text
status = sa.setRentStatus(id=000000000, status=1)
try:
print(status['status']) # success
except:
print(status['message']) # Error text
rent = sa.getRentList()
try:
print(rent['values']['0']['phone']) # 79999999999
except:
print(rent['message']) # Error text
rent = sa.continueRentNumber(id=000000000, time=4)
try:
print(rent['phone']['number']) # 79999999999
except:
print(rent['message']) # Error text
rent = sa.getContinueRentPriceNumber(000000000)
try:
print(status['price']) # 4.00
except:
print(status['message']) # Error text
import ru.sms_activate.SMSActivateApi;//Inclusion of a class in a project
SMSActivateApi smsActivateApi = new SMSActivate("API_KEY");//Create an instance of the SMSActivate class
BigDecimal balance = smsActivateApi.getBalance();//Get the current account balance
System.out.println("Balance: "+ balance)//Withdraw the received balance
SMSActivateGetBalanceAndCashbackResponse smsActivateGetBalanceAndCashbackResponse = smsActivateApi.getBalanceAndCashback();//Get current balance and cashback
System.out.println("Cashback + balance: "+ smsActivateGetBalanceAndCashbackResponse.getBalanceAndCashback());//Withdraw the amount of balance and cashback
SMSActivateActivation activation=smsActivateApi.getNumber(0,"vk")//Get activation for the Vkontakte service in Russia
System.out.println(activation);//Withdraw the received activation
SMSActivateGetNumbersStatusResponse smsActivateGetNumbersStatusResponse= smsActivateApi.getNumberStatus(0,null);//Get information about available services for Russia
SMSActivateServiceInfo go = smsActivateGetNumbersStatusResponse.getSMSActivateServiceInfoByShortName("go");//Getting information about numbers for the Google service
System.out.println("Short name service: " + go.getShortName();//Get the short name of the service
System.out.println("count phone numbers: "+ go.getCountPhoneNumber();//Get the number of numbers for the service
System.out.println(""Forwarding is available: "+ go.isForward() ? "yes" : "no"//Find out if the service has a redirect
SMSActivateActivation activation=smsActivateApi.getNumbersStatus(0,"ot",true);//Activations
smsActivateApi.setStatus(activation, SMSActivateClientStatus.MESSAGE_WAS_SENT);//Setting the MESSAGE_WAS_SENT status after sending SMS for the number
SMSActivateActivation childActivation =smsActivateApi.getAdditionalService(activation,"av");//Requesting a new activation for an additional service
System.out.println(childActivation);//Displaying information about additional activation
Set<String>operatorSet= new HashSet<>();
operatorSet.add("mts");//Adding an MTS operator to the set of operators
Map<String,Boolean>serviceMap= new HashMap<>();
serviceMap.put("av",false);//Adding the Avito service to the list of services (specify true if you need a service with redirection)
SMSActivateGetMultiServiceNumberResponse multiServiceNumberResponse=smsActivateApi.getMultiServiceNumber(0, serviceMap, operatorSet);//Getting activation for multiple services
multiServiceNumberResponse.getSMSActivateActivationList().forEach(activation->{
System.out.println("Id: " + activation.getId());
System.out.println("Number: " + activation.getNumber());
System.out.println("Service name: " + activation.getShortName());
}
//Displaying information about received activations
SMSActivateGetPricesResponse smsActivateGetPricesResponse=smsActivateApi.getPricesByCountryIdAndServiceShortName(0, "vk");//Obtaining a list of prices for Russia on the Vkontakte service. For a complete list of prices, use the getAllPrices () method;
SMSActivateGetPriceInfo vk=smsActivateGetPricesResponse.getPriceInfo(0, "vk");//Getting information about the Vkontakte service for Russia
System.out.println(">>> Cost: "+ vk.getCost());//Get a price for the service
System.out.println(">>> count phone numbers: " + vk.getCountPhoneNumbers());//Get the number of numbers for the service
SMSActivateActivation activation=smsActivateApi.getNumber(0,"vk")//Get activation for the Vkontakte service in Russia
System.out.println(activation);//Withdraw the received activation
SMSActivateGetStatusResponse getResponse = smsActivateApi.getStatus(activation);//Getting a status for activation
System.out.println(getResponse.getSMSActivateGetStatus());//Displaying information about the activation status
smsActivateApi.setStatus(activation, SMSActivateClientStatus.MESSAGE_WAS_SENT);//Setting the MESSAGE_WAS_SENT status after receiving SMS for the number
smsActivateApi.setStatus(activation, SMSActivateClientStatus.FINISH);//Setting the FINISH status after receiving SMS for the number
SMSActivateGetCountriesResponse smsActivateGetCountriesResponse =smsActivateApi.getCountries();//Getting a list of countries with information
SMSActivateCountryInfo countryInfo = smsActivateGetCountriesResponse.get(0)//Getting information about the first country on the list
System.out.println("Russian name: "+countryInfo.getRussianName();//Display the Russian name of the country
System.out.println("English name: "+countryInfo.getEnglishName();//Display the Russian name of the country
System.out.println("Support multi-service: "+ countryInfo.isSupportMultiService() ? "yes" : "no"//Show if the country supports multi-services
SMSActivateActivation activation=smsActivateApi.getNumber(0,"vk")//Get activation for the Vkontakte service in Russia
smsActivateApi.setStatus(activation, SMSActivateClientStatus.MESSAGE_WAS_SENT);//Setting the MESSAGE_WAS_SENT status after sending SMS for the number
String code=smsActivateApi.waitSms(activation,2)//Set receiving sms within 2 minutes
if(code == null) {
smsActivateApi.setStatus(activation, SMSActivateClientStatus.CANCEL);//Setting the CANCEL status if sms has not arrived
}
else{
SMSActivateGetFullSmsResponse smsActivateGetFullSmsResponse=smsActivateApi.getFullSms(activation)//Receiving sms text
System.out.println("Full SMS: "+smsActivateGetFullSmsResponse.getText());//SMS text output
}
SMSActivateRentActivation rentActivation= smsActivateApi.getRentNumber(0, "vk", 6);//Getting a number with rent
System.out.println(">> ID: "+rentActivation.getId());//Activation ID withdrawal
System.out.println(">> Number: "+rentActivation.getId());//Displaying the activation number
System.out.println(">> End date: "+rentActivation.getId());//Displaying the activation expiration date
SMSActivateGetRentServicesAndCountriesResponse smsActivateGetRentServicesAndCountriesResponse= smsActivateApi.getRentServicesAndCountries(0, null, 4);//Obtaining information on services and countries that support rental
smsActivateGetRentServicesAndCountriesResponse.getAllRentServices().forEach((serviceShortName, smsActivateRentService)->{
System.out.println("Service shortname: " + serviceShortName);
System.out.println(" count phone numbers: " + smsActivateRentService.getCountPhoneNumbers());
System.out.println(">> Cost: " + smsActivateRentService.getCost());
}
//Displaying information about received services
SMSActivateRentActivation rentActivation= smsActivateApi.getRentNumber(0, "vk");//Getting a number with rent
SMSActivateGetRentStatusResponse smsActivateGetRentStatusResponse= smsActivateApi.getRentStatus(rentActivation);//Getting activation status
System.out.println(">> Count sms: "+ smsActivateGetRentStatusResponse.getCountSms());//Displaying the number of sms on the rented number





















































