Qué necesitas
- Equipo que ejecute tu propio software o envíe peticiones HTTP (pool de módems, banco de SIM, GoIP)
- Tarjetas SIM registradas legalmente a tu nombre o al de tu empresa, en tu país
- Una solicitud de pasarela aprobada
Conecta tu pool de módems, banco de SIM o pasarela GoIP con una API REST firmada. Registra tus puertos, envía heartbeats, reenvía los SMS entrantes y confirma cada asignación por webhook, long-poll o heartbeat.
Tu parte con este método: 100 % de cada venta.
Cuéntanos tu equipo, tus operadores y cuántas líneas tienes. Cada solicitud la revisa una persona.
Una vez aprobado, crea una pasarela en tu panel. Recibes una clave y un secreto que se muestran una sola vez.
Envía cada puerto con su número y operador, y verifica cada línea con el código SMS que te damos.
Envía heartbeats, reenvía cada SMS entrante y confirma las asignaciones. Tus líneas venden como cualquier otra línea del pool.
Una API JSON sobre HTTPS. Cada petición se firma con el secreto de tu pasarela, así que la clave sola no le sirve a nadie que la vea.
https://smsgrab.com/api/supply/v1
Envía estas cuatro cabeceras en cada petición. La marca de tiempo debe estar a menos de 5 minutos de nuestro reloj y cada nonce solo se puede usar una vez.
SmsGrab-KeySmsGrab-TimestampSmsGrab-NonceSmsGrab-SignatureUne estas siete partes con un salto de línea: el prefijo fijo SGSUPPLY1, el método HTTP, la ruta tal como se envía, la cadena de consulta sin procesar (o nada), la marca de tiempo, el nonce y el SHA-256 en hexadecimal en minúsculas del cuerpo (de una cadena vacía si no hay). Fírmala con tu secreto.
SGSUPPLY1
POST
/api/supply/v1/messages
1790503200
3q9ZkQe7Tn2vYp8LwXc1Ab
a507e2e670909f12a167f25eb94140a4b5f799b75cc1d9a6c736eead88501bbe
secret sgss_AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8
body {"messages":[{"id":"gw-7781","port":"1","from":"WhatsApp","text":"Your WhatsApp code: 123-456","received_at":"2026-11-28T10:00:00Z"}]}
signature v1=db3e086faba31b85c508811b82a90d73c19719d650e03602fdd2d5a02b381618
Python
import hashlib, hmac, json, os, secrets, time, urllib.parse
import requests
KEY_ID = os.environ["SMSGRAB_SUPPLY_KEY"]
SECRET = os.environ["SMSGRAB_SUPPLY_SECRET"].encode()
def signed(method, url, payload=None):
body = b"" if payload is None else json.dumps(payload, separators=(",", ":")).encode()
parts = urllib.parse.urlsplit(url)
timestamp = str(int(time.time()))
nonce = secrets.token_urlsafe(24)
canonical = "\n".join(["SGSUPPLY1", method, parts.path, parts.query,
timestamp, nonce, hashlib.sha256(body).hexdigest()])
headers = {
"SmsGrab-Key": KEY_ID,
"SmsGrab-Timestamp": timestamp,
"SmsGrab-Nonce": nonce,
"SmsGrab-Signature": "v1=" + hmac.new(SECRET, canonical.encode(), hashlib.sha256).hexdigest(),
}
if body:
headers["Content-Type"] = "application/json"
return requests.request(method, url, data=body or None, headers=headers, timeout=30)
signed("POST", "https://smsgrab.com/api/supply/v1/messages", {"messages": [{
"id": "gw-7781", "port": "1", "from": "WhatsApp",
"text": "Your WhatsApp code: 482-913", "received_at": "2026-11-28T10:00:00Z",
}]})
Node.js
import { createHash, createHmac, randomBytes } from 'node:crypto';
const keyId = process.env.SMSGRAB_SUPPLY_KEY;
const secret = process.env.SMSGRAB_SUPPLY_SECRET;
export async function signed(method, url, payload) {
const body = payload === undefined ? '' : JSON.stringify(payload);
const { pathname, search } = new URL(url);
const timestamp = String(Math.floor(Date.now() / 1000));
const nonce = randomBytes(18).toString('base64url');
const canonical = ['SGSUPPLY1', method, pathname, search.replace(/^\?/, ''), timestamp, nonce,
createHash('sha256').update(body).digest('hex')].join('\n');
return fetch(url, {
method,
body: body === '' ? undefined : body,
headers: {
'SmsGrab-Key': keyId,
'SmsGrab-Timestamp': timestamp,
'SmsGrab-Nonce': nonce,
'SmsGrab-Signature': `v1=${createHmac('sha256', secret).update(canonical).digest('hex')}`,
...(body === '' ? {} : { 'Content-Type': 'application/json' }),
},
});
}
await signed('POST', 'https://smsgrab.com/api/supply/v1/heartbeat', {
agent: 'my-gateway/1.0',
interval_seconds: 30,
ports: [{ port: '1', state: 'ready', signal_dbm: -71, operator: 'Turkcell' }],
});
PHP
function smsgrab_signed(string $method, string $url, ?array $payload = null): array
{
$body = $payload === null ? '' : json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR);
$parts = parse_url($url);
$timestamp = (string) time();
$nonce = rtrim(strtr(base64_encode(random_bytes(18)), '+/', '-_'), '=');
$canonical = implode("\n", ['SGSUPPLY1', $method, $parts['path'], $parts['query'] ?? '',
$timestamp, $nonce, hash('sha256', $body)]);
$headers = [
'SmsGrab-Key: '.getenv('SMSGRAB_SUPPLY_KEY'),
'SmsGrab-Timestamp: '.$timestamp,
'SmsGrab-Nonce: '.$nonce,
'SmsGrab-Signature: v1='.hash_hmac('sha256', $canonical, getenv('SMSGRAB_SUPPLY_SECRET')),
];
$curl = curl_init($url);
curl_setopt_array($curl, [CURLOPT_CUSTOMREQUEST => $method, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30]);
if ($body !== '') {
$headers[] = 'Content-Type: application/json';
curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
}
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$response = (string) curl_exec($curl);
return ['status' => curl_getinfo($curl, CURLINFO_RESPONSE_CODE), 'body' => json_decode($response, true)];
}
smsgrab_signed('PUT', 'https://smsgrab.com/api/supply/v1/lines', ['lines' => [
['port' => '1', 'phone_e164' => '+905321112233', 'country_iso' => 'TR', 'operator' => 'Turkcell'],
]]);
curl
URL="https://smsgrab.com/api/supply/v1/messages"
BODY='{"messages":[{"id":"gw-7781","port":"1","from":"WhatsApp","text":"Your WhatsApp code: 123-456","received_at":"2026-11-28T10:00:00Z"}]}'
TS=$(date +%s)
NONCE=$(openssl rand -base64 18 | tr '+/' '-_' | tr -d '=')
REQUEST_PATH=$(printf '%s' "$URL" | sed -E 's#^https?://[^/]+##; s#\?.*$##')
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 -hex | sed 's/^.* //')
SIGNATURE=$(printf 'SGSUPPLY1\nPOST\n%s\n\n%s\n%s\n%s' "$REQUEST_PATH" "$TS" "$NONCE" "$BODY_HASH" \
| openssl dgst -sha256 -hmac "$SMSGRAB_SUPPLY_SECRET" -hex | sed 's/^.* //')
curl -s -X POST "$URL" \
-H "SmsGrab-Key: $SMSGRAB_SUPPLY_KEY" \
-H "SmsGrab-Timestamp: $TS" \
-H "SmsGrab-Nonce: $NONCE" \
-H "SmsGrab-Signature: v1=$SIGNATURE" \
-H "Content-Type: application/json" \
-d "$BODY"
Cualquier problema de autenticación responde 401 con el motivo SUPPLY_SIGNATURE_INVALID, y un nonce reutilizado responde SUPPLY_NONCE_REUSED. Los cuerpos son JSON de hasta 256 KiB. Cada clave puede enviar 600 peticiones por minuto.
| Endpoint | Qué hace |
|---|---|
GET/me |
Tu pasarela, su modo de confirmación y las ventas de hoy frente a tu límite diario |
POST/heartbeat |
Informa del estado de cada puerto y mantiene la pasarela en línea; responde con el siguiente intervalo |
PUT/lines |
Registra o actualiza hasta 512 puertos con sus números y operadores |
DELETE/lines/{port} |
Elimina un puerto que ya no tiene SIM |
POST/lines/{port}/pause |
Pausa un puerto: sigue registrado pero no recibe ventas nuevas |
POST/lines/{port}/resume |
Permite que un puerto pausado vuelva a recibir ventas |
POST/messages |
Envía hasta 100 SMS entrantes; cada id de mensaje se acepta una vez |
GET/assignments?wait=25&after={cursor} |
Long-poll de asignaciones nuevas y cerradas, mantenido hasta 25 segundos |
POST/assignments/{id}/ack |
Confirma que el puerto está listo para la asignación |
POST/webhook/test |
Envía un evento de prueba a tu webhook e informa del resultado |
Cuando un cliente compra un número en uno de tus puertos, abrimos una asignación. Elige en los ajustes de la pasarela cómo la confirma.
Webhook
Enviamos assignment.opened por POST a tu URL. Responde 2xx con {"ack":true} en menos de 3 segundos.
Long-poll
Tu pasarela mantiene abierto GET /assignments y confirma cada asignación que recibe.
Heartbeat
Basta con un heartbeat reciente con el puerto listo. Ideal para configuraciones sencillas.
Cada webhook lleva SmsGrab-Signature: t=<unix time>,v1=<hex>. Calcula el HMAC-SHA256 de "<t>.<raw body>" con tu secreto de webhook, compara en tiempo constante y rechaza marcas de tiempo antiguas. Los eventos de cierre se reintentan tras 1, 5 y 15 minutos y tras 1 hora.
{
"id": "evt_6f1c2a5e-9b0d-4a77-8a51-2d3e4f5a6b7c",
"type": "assignment.opened",
"created_at": "2026-11-28T10:00:00.000Z",
"data": {
"assignment": {
"id": "0b8e7c1a-4d2f-4e6a-9c3b-5a1d2e3f4a5b",
"port": "1",
"phone_e164": "+905321112233",
"service": { "id": "whatsapp", "name": "WhatsApp" },
"since": "2026-11-28T10:00:00.000Z",
"until": "2026-11-28T10:20:00.000Z"
}
}
}
PHP
$body = (string) file_get_contents('php://input');
parse_str(str_replace(',', '&', $_SERVER['HTTP_SMSGRAB_SIGNATURE'] ?? ''), $signature);
$timestamp = (string) ($signature['t'] ?? '');
$expected = hash_hmac('sha256', $timestamp.'.'.$body, getenv('SMSGRAB_SUPPLY_WEBHOOK_SECRET'));
if (! ctype_digit($timestamp) || abs(time() - (int) $timestamp) > 300
|| ! hash_equals($expected, (string) ($signature['v1'] ?? ''))) {
http_response_code(401);
exit;
}
$event = json_decode($body, true, 32, JSON_THROW_ON_ERROR);
if ($event['type'] === 'assignment.opened') {
remember_assignment($event['data']['assignment']);
}
header('Content-Type: application/json');
echo json_encode(['ack' => true]);
Python
import hashlib, hmac, os, time
from flask import Flask, abort, jsonify, request
app = Flask(__name__)
SECRET = os.environ["SMSGRAB_SUPPLY_WEBHOOK_SECRET"].encode()
@app.post("/smsgrab")
def smsgrab():
header = request.headers.get("SmsGrab-Signature", "")
signature = dict(item.split("=", 1) for item in header.split(",") if "=" in item)
timestamp = signature.get("t", "")
expected = hmac.new(SECRET, timestamp.encode() + b"." + request.get_data(), hashlib.sha256).hexdigest()
if not timestamp.isdigit() or abs(time.time() - int(timestamp)) > 300 \
or not hmac.compare_digest(expected, signature.get("v1", "")):
abort(401)
event = request.get_json()
if event["type"] == "assignment.opened":
remember_assignment(event["data"]["assignment"])
return jsonify(ack=True)
Node.js
import express from 'express';
import { createHmac, timingSafeEqual } from 'node:crypto';
const app = express();
const secret = process.env.SMSGRAB_SUPPLY_WEBHOOK_SECRET;
app.post('/smsgrab', express.raw({ type: 'application/json' }), (req, res) => {
const signature = Object.fromEntries((req.get('SmsGrab-Signature') ?? '').split(',').map((item) => item.split('=', 2)));
const timestamp = Number(signature.t);
const expected = Buffer.from(createHmac('sha256', secret).update(`${signature.t}.${req.body}`).digest('hex'));
const received = Buffer.from(signature.v1 ?? '');
if (!Number.isInteger(timestamp) || Math.abs(Date.now() / 1000 - timestamp) > 300
|| received.length !== expected.length || !timingSafeEqual(received, expected)) {
return res.sendStatus(401);
}
const event = JSON.parse(req.body);
if (event.type === 'assignment.opened') {
rememberAssignment(event.data.assignment);
}
return res.json({ ack: true });
});
Una línea registrada solo vende cuando demuestra que recibe SMS. Pide un código de verificación en tu panel y envía a la línea, en menos de 15 minutos, cualquier SMS que lo contenga. El mensaje solo se usa para la comprobación y nunca se guarda.
Las pasarelas GoIP pueden reenviar SMS a una URL sin software adicional.
Tu URL de entrada se parece a esta
https://smsgrab.com/api/supply/v1/inbound/goip/YOUR-PRIVATE-TOKEN
Cualquier teléfono Android con tu SIM dentro
Cualquier app de reenvío de SMS, Tasker, MacroDroid o Atajos de iOS
Envíanos tus SIM o códigos eSIM y nosotros los alojamos