Choose a language

Supplier program
Reviewed

Supply through the SmsGrab gateway API

Connect your modem pool, SIM bank or GoIP gateway with a signed REST API. Register your ports, keep a heartbeat, push incoming SMS and confirm each assignment by webhook, long-poll or heartbeat.

Your share with this method: 100% of each sale.

What you need

  • Hardware that runs your own software or sends HTTP requests (modem pool, SIM bank, GoIP)
  • SIM cards registered to you or your company, lawfully, in your country
  • An approved gateway application

Why suppliers choose it

  • HMAC-SHA256 signed requests with replay protection
  • Up to 512 lines per request, 100 messages per push
  • Webhook, long-poll or heartbeat confirmation
  • Idempotent message push: retries are safe

Step by step

  1. Apply

    Tell us about your hardware, your operators and how many lines you run. A person reviews every application.

  2. Create a gateway

    Once approved, create a gateway in your dashboard. You get a key and a secret, shown once.

  3. Register your lines

    Send each port with its number and operator, then verify every line with the SMS code we give you.

  4. Go live

    Send a heartbeat, push every incoming SMS and confirm assignments. Your lines sell like every other line in the pool.

Gateway API reference

A JSON API over HTTPS. Every request is signed with your gateway secret, so the key alone is useless to anyone who sees it.

Base URL https://smsgrab.com/api/supply/v1

Authentication

Send these four headers with every request. The timestamp must be within 5 minutes of our clock and each nonce can be used once.

SmsGrab-Key
Your gateway key id, starting with sgs_
SmsGrab-Timestamp
Unix time in seconds
SmsGrab-Nonce
22 to 64 random characters of A-Z, a-z, 0-9, _ and -
SmsGrab-Signature
v1= followed by the lowercase hex HMAC-SHA256 of the canonical string

Canonical string

Join these seven parts with a line feed: the fixed prefix SGSUPPLY1, the HTTP method, the path as sent, the raw query string (or nothing), the timestamp, the nonce and the lowercase hex SHA-256 of the body (of an empty string when there is none). Sign it with your secret.

Example for a message push
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

Signing a request

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"

Every authentication problem answers 401 with the reason SUPPLY_SIGNATURE_INVALID, and a reused nonce answers SUPPLY_NONCE_REUSED. Bodies are JSON up to 256 KiB. Each key may send 600 requests per minute.

Endpoints

EndpointWhat it does
GET/me Your gateway, its confirmation mode and today's sales against your daily cap
POST/heartbeat Reports the state of each port and keeps the gateway online; answers the next interval
PUT/lines Registers or updates up to 512 ports with their numbers and operators
DELETE/lines/{port} Removes a port that no longer holds a SIM
POST/lines/{port}/pause Pauses a port: it stays registered but takes no new sales
POST/lines/{port}/resume Lets a paused port take sales again
POST/messages Pushes up to 100 incoming SMS; each message id is accepted once
GET/assignments?wait=25&after={cursor} Long-poll for new and closed assignments, held up to 25 seconds
POST/assignments/{id}/ack Confirms that the port is ready for the assignment
POST/webhook/test Sends a test event to your webhook and reports the result

Confirming assignments

When a customer buys a number on one of your ports, we open an assignment. Choose how your gateway confirms it in the gateway settings.

  • Webhook

    We POST assignment.opened to your URL. Answer 2xx with {"ack":true} within 3 seconds.

  • Long-poll

    Your gateway holds GET /assignments open and acknowledges each assignment it receives.

  • Heartbeat

    A fresh heartbeat with the port ready is enough. Best for simple setups.

Verifying webhooks

Each webhook carries SmsGrab-Signature: t=<unix time>,v1=<hex>. Compute HMAC-SHA256 of "<t>.<raw body>" with your webhook secret, compare in constant time and refuse old timestamps. Closed events are retried after 1, 5 and 15 minutes and after 1 hour.

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 });
});

Verifying each line

A registered line sells only after it proves it receives SMS. Ask for a verification code in your dashboard and send any SMS that contains it to the line within 15 minutes. The message is used for the check and never stored.

GoIP setup

GoIP gateways can forward SMS to a URL without any extra software.

  1. In your dashboard, open GoIP and add the gateway with the number of each port. You get a private inbound URL and a ping URL.
  2. In the GoIP web panel, open the SMS forwarding settings (the menu name depends on the firmware) and paste the inbound URL. Keep the default fields: sender, message, port and time.
  3. Schedule a request to the ping URL every 15 minutes, or let the gateway forward at least one message in that time.
  4. Verify every port with the code from your dashboard, declare the services you use yourself and switch the lines on.

Your inbound URL looks like this

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

Other ways to supply

  • Instant

    SmsGrab Node app

    Any Android phone with your SIM in it

    • Join instantly, no review
    • Pair with a code or a QR scan in under a minute
    • You choose which lines sell and which services you keep for yourself
    100% of each sale How it works
  • Instant

    SMS forwarder

    Any SMS forwarder app, Tasker, MacroDroid or iOS Shortcuts

    • Join instantly, one line per forwarder
    • JSON, form fields or plain text are all accepted
    • A private URL per line that you can replace at any time
    100% of each sale How it works
  • Reviewed

    SIM consignment

    Send us your SIMs or eSIM codes and we host them

    • No hardware, no app, no electricity bill
    • eSIM codes are sealed on arrival and never shown again
    • You follow every card from shipping to selling
    80% of each sale How it works

Your SIM cards can start earning today

Modem pools, SIM banks and GoIP for equipped suppliers