Scegli una lingua

Programma fornitori
Con revisione

Fornisci tramite l’API gateway di SmsGrab

Collega il tuo pool di modem, SIM bank o gateway GoIP con un’API REST firmata. Registra le porte, invia heartbeat, inoltra gli SMS in arrivo e conferma ogni assegnazione via webhook, long-poll o heartbeat.

La tua quota con questo metodo: 100% di ogni vendita.

Cosa ti serve

  • Hardware che esegue il tuo software o invia richieste HTTP (pool di modem, SIM bank, GoIP)
  • SIM intestate legalmente a te o alla tua azienda, nel tuo paese
  • Una candidatura gateway approvata

Perché i fornitori lo scelgono

  • Richieste firmate HMAC-SHA256 con protezione dalle ripetizioni
  • Fino a 512 linee per richiesta e 100 messaggi per invio
  • Conferma via webhook, long-poll o heartbeat
  • Invio messaggi idempotente: i tentativi ripetuti sono sicuri

Passo dopo passo

  1. Candidati

    Descrivi hardware, operatori e quante linee gestisci. Ogni candidatura è esaminata da una persona.

  2. Crea un gateway

    Una volta approvato, crea un gateway nella dashboard. Ricevi una chiave e un segreto, mostrati una sola volta.

  3. Registra le linee

    Invia ogni porta con numero e operatore, poi verifica ogni linea con il codice SMS che ti diamo.

  4. Vai online

    Invia heartbeat, inoltra ogni SMS in arrivo e conferma le assegnazioni. Le tue linee vendono come ogni altra linea del pool.

Riferimento API gateway

Un’API JSON su HTTPS. Ogni richiesta è firmata con il segreto del tuo gateway, quindi la sola chiave è inutile a chiunque la veda.

URL di base https://smsgrab.com/api/supply/v1

Autenticazione

Invia queste quattro intestazioni con ogni richiesta. Il timestamp deve differire di meno di 5 minuti dal nostro orologio e ogni nonce vale una sola volta.

SmsGrab-Key
L’id della chiave del gateway, che inizia con sgs_
SmsGrab-Timestamp
Tempo Unix in secondi
SmsGrab-Nonce
Da 22 a 64 caratteri casuali tra A-Z, a-z, 0-9, _ e -
SmsGrab-Signature
v1= seguito dall’HMAC-SHA256 esadecimale minuscolo della stringa canonica

Stringa canonica

Unisci queste sette parti con un a capo: il prefisso fisso SGSUPPLY1, il metodo HTTP, il percorso così come inviato, la query string grezza (o niente), il timestamp, il nonce e lo SHA-256 esadecimale minuscolo del corpo (di una stringa vuota se manca). Firmala con il tuo segreto.

Esempio per un invio di messaggi
SGSUPPLY1
POST
/api/supply/v1/messages

1790503200
3q9ZkQe7Tn2vYp8LwXc1Ab
a507e2e670909f12a167f25eb94140a4b5f799b75cc1d9a6c736eead88501bbe
SmsGrab-Signature
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

Firmare una richiesta

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"

Ogni problema di autenticazione risponde 401 con motivo SUPPLY_SIGNATURE_INVALID, un nonce riutilizzato risponde SUPPLY_NONCE_REUSED. I corpi sono JSON fino a 256 KiB. Ogni chiave può inviare 600 richieste al minuto.

Endpoint

EndpointCosa fa
GET/me Il tuo gateway, la sua modalità di conferma e le vendite di oggi rispetto al limite giornaliero
POST/heartbeat Segnala lo stato di ogni porta e mantiene online il gateway; risponde con l’intervallo successivo
PUT/lines Registra o aggiorna fino a 512 porte con numeri e operatori
DELETE/lines/{port} Rimuove una porta che non contiene più una SIM
POST/lines/{port}/pause Mette in pausa una porta: resta registrata ma non riceve nuove vendite
POST/lines/{port}/resume Consente a una porta in pausa di ricevere di nuovo vendite
POST/messages Inoltra fino a 100 SMS in arrivo; ogni id messaggio è accettato una volta
GET/assignments?wait=25&after={cursor} Long-poll delle assegnazioni nuove e chiuse, mantenuto fino a 25 secondi
POST/assignments/{id}/ack Conferma che la porta è pronta per l’assegnazione
POST/webhook/test Invia un evento di prova al tuo webhook e riporta il risultato

Confermare le assegnazioni

Quando un cliente acquista un numero su una delle tue porte, apriamo un’assegnazione. Scegli come la conferma il gateway nelle sue impostazioni.

  • Webhook

    Inviamo assignment.opened in POST al tuo URL. Rispondi 2xx con {"ack":true} entro 3 secondi.

  • Long-poll

    Il gateway tiene aperto GET /assignments e conferma ogni assegnazione ricevuta.

  • Heartbeat

    Basta un heartbeat recente con la porta pronta. Ideale per configurazioni semplici.

Verificare i webhook

Ogni webhook contiene SmsGrab-Signature: t=<unix time>,v1=<hex>. Calcola l’HMAC-SHA256 di "<t>.<raw body>" con il segreto del webhook, confronta in tempo costante e rifiuta i timestamp vecchi. Gli eventi di chiusura vengono ritentati dopo 1, 5 e 15 minuti e dopo 1 ora.

assignment.opened
{
  "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 });
});

Verificare ogni linea

Una linea registrata vende solo dopo aver dimostrato di ricevere SMS. Richiedi un codice di verifica nella dashboard e invia alla linea, entro 15 minuti, un SMS che lo contenga. Il messaggio serve solo per il controllo e non viene mai conservato.

Configurazione GoIP

I gateway GoIP possono inoltrare gli SMS a un URL senza software aggiuntivo.

  1. Nella dashboard apri GoIP e aggiungi il gateway con il numero di ogni porta. Ricevi un URL di ingresso privato e un URL di ping.
  2. Nel pannello web del GoIP apri le impostazioni di inoltro SMS (il nome del menu dipende dal firmware) e incolla l’URL di ingresso. Mantieni i campi predefiniti: mittente, messaggio, porta e ora.
  3. Pianifica una richiesta all’URL di ping ogni 15 minuti, oppure fai inoltrare al gateway almeno un messaggio in quel tempo.
  4. Verifica ogni porta con il codice della dashboard, dichiara i servizi che usi tu e attiva le linee.

Il tuo URL di ingresso è simile a questo

https://smsgrab.com/api/supply/v1/inbound/goip/YOUR-PRIVATE-TOKEN

Altri modi per fornire

  • Immediato

    App SmsGrab Node

    Qualsiasi telefono Android con la tua SIM

    • Adesione immediata, senza revisione
    • Associazione con un codice o una scansione QR in meno di un minuto
    • Scegli tu quali linee vendono e quali servizi tieni per te
    100% di ogni vendita Come funziona
  • Immediato

    Inoltro SMS

    Qualsiasi app di inoltro SMS, Tasker, MacroDroid o Comandi Rapidi iOS

    • Adesione immediata, una linea per inoltro
    • Accettati JSON, campi di modulo o testo semplice
    • Un URL privato per linea, sostituibile in qualsiasi momento
    100% di ogni vendita Come funziona
  • Con revisione

    Conto deposito SIM

    Inviaci le tue SIM o i codici eSIM, li ospitiamo noi

    • Niente hardware, niente app, niente bolletta della luce
    • I codici eSIM vengono sigillati all’arrivo e mai più mostrati
    • Segui ogni SIM dalla spedizione alla vendita
    80% di ogni vendita Come funziona

Le tue SIM possono iniziare a guadagnare oggi

Pool di modem, SIM bank e GoIP per fornitori attrezzati