언어 선택

공급자 프로그램
검토 후

SmsGrab 게이트웨이 API로 공급하기

모뎀 풀, SIM 뱅크, GoIP 게이트웨이를 서명된 REST API로 연결하세요. 포트를 등록하고 heartbeat를 보내며, 수신 SMS를 전달하고 각 배정을 webhook, long-poll 또는 heartbeat로 확인합니다.

이 방법의 내 몫: 판매액의 100%.

필요한 것

  • 자체 소프트웨어를 실행하거나 HTTP 요청을 보낼 수 있는 하드웨어 (모뎀 풀, SIM 뱅크, GoIP)
  • 거주 국가에서 본인 또는 회사 명의로 합법적으로 등록된 SIM 카드
  • 승인된 게이트웨이 신청

공급자들이 선택하는 이유

  • 재전송 방지 기능이 있는 HMAC-SHA256 서명 요청
  • 요청당 최대 512회선, 배치당 최대 100건 메시지
  • webhook, long-poll 또는 heartbeat로 확인
  • 멱등 메시지 전송: 재시도해도 안전

단계별 안내

  1. 신청하기

    하드웨어, 통신사, 회선 수를 알려 주세요. 모든 신청서는 담당자가 직접 검토합니다.

  2. 게이트웨이 만들기

    승인 후 대시보드에서 게이트웨이를 만드세요. 키와 시크릿이 한 번만 표시됩니다.

  3. 회선 등록

    각 포트를 번호, 통신사와 함께 보내고, 저희가 드리는 SMS 코드로 회선마다 확인하세요.

  4. 가동

    heartbeat를 보내고, 모든 수신 SMS를 전달하며, 배정을 확인하세요. 내 회선은 풀의 다른 회선과 똑같이 판매됩니다.

게이트웨이 API 참조

HTTPS 기반 JSON API입니다. 모든 요청은 게이트웨이 시크릿으로 서명되므로 키만으로는 누구도 사용할 수 없습니다.

기본 URL https://smsgrab.com/api/supply/v1

인증

모든 요청에 이 네 가지 헤더를 보내세요. 타임스탬프는 저희 시계와 5분 이내여야 하며, 각 nonce는 한 번만 사용할 수 있습니다.

SmsGrab-Key
sgs_로 시작하는 게이트웨이 키 ID
SmsGrab-Timestamp
초 단위 Unix 시간
SmsGrab-Nonce
A-Z, a-z, 0-9, _, - 로 이루어진 22~64자의 무작위 문자
SmsGrab-Signature
v1= 뒤에 정규화 문자열의 HMAC-SHA256을 소문자 16진수로

정규화 문자열

다음 일곱 부분을 줄바꿈으로 연결하세요: 고정 접두사 SGSUPPLY1, HTTP 메서드, 보낸 그대로의 경로, 원본 쿼리 문자열(없으면 비움), 타임스탬프, nonce, 본문의 SHA-256 소문자 16진수(본문이 없으면 빈 문자열의 값). 이를 시크릿으로 서명합니다.

메시지 전송 예시
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

요청 서명

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"

모든 인증 문제는 401과 사유 SUPPLY_SIGNATURE_INVALID를 반환하고, 재사용된 nonce는 SUPPLY_NONCE_REUSED를 반환합니다. 본문은 최대 256 KiB의 JSON입니다. 키마다 분당 600건의 요청을 보낼 수 있습니다.

엔드포인트

엔드포인트기능
GET/me 게이트웨이, 확인 모드, 일일 한도 대비 오늘 판매
POST/heartbeat 각 포트 상태를 보고하고 게이트웨이를 온라인으로 유지하며 다음 간격을 반환
PUT/lines 최대 512개 포트를 번호, 통신사와 함께 등록하거나 갱신
DELETE/lines/{port} 더 이상 SIM이 없는 포트 삭제
POST/lines/{port}/pause 포트를 일시 중지합니다. 등록은 유지되지만 새 판매를 받지 않습니다
POST/lines/{port}/resume 일시 중지된 포트가 다시 판매를 받도록 합니다
POST/messages 최대 100건의 수신 SMS 전송, 메시지 ID마다 한 번만 접수
GET/assignments?wait=25&after={cursor} 새 배정과 종료된 배정을 long-poll로 조회, 최대 25초 유지
POST/assignments/{id}/ack 포트가 배정 가능한 상태임을 확인
POST/webhook/test webhook으로 테스트 이벤트를 보내고 결과를 보고

배정 확인

고객이 내 포트에서 번호를 구매하면 배정이 열립니다. 게이트웨이 설정에서 확인 방법을 선택하세요.

  • Webhook

    assignment.opened를 내 URL로 POST합니다. 3초 안에 {"ack":true}와 함께 2xx로 응답하세요.

  • Long-poll

    게이트웨이가 GET /assignments를 열어 두고 받는 배정마다 확인합니다.

  • Heartbeat

    준비된 포트가 포함된 최신 heartbeat면 충분합니다. 간단한 구성에 가장 적합합니다.

webhook 검증

모든 webhook에는 SmsGrab-Signature: t=<unix time>,v1=<hex>가 포함됩니다. webhook 시크릿으로 "<t>.<raw body>"의 HMAC-SHA256을 계산하고, 상수 시간으로 비교하며, 오래된 타임스탬프는 거부하세요. 종료 이벤트는 1분, 5분, 15분, 1시간 후에 재전송됩니다.

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

회선마다 확인

등록한 회선은 SMS를 받을 수 있음이 확인된 뒤에만 판매됩니다. 대시보드에서 확인 코드를 요청하고 15분 안에 그 코드가 포함된 아무 SMS나 회선으로 보내세요. 메시지는 확인에만 쓰이며 절대 저장되지 않습니다.

GoIP 설정

GoIP 게이트웨이는 추가 소프트웨어 없이 SMS를 URL로 전달할 수 있습니다.

  1. 대시보드에서 GoIP를 열고 포트마다 번호를 입력해 게이트웨이를 추가하세요. 전용 inbound URL과 ping URL이 발급됩니다.
  2. GoIP 웹 패널에서 SMS 전달 설정을 열고(메뉴 이름은 펌웨어마다 다름) inbound URL을 붙여 넣으세요. 발신자, 메시지, 포트, 시간 기본 항목은 그대로 둡니다.
  3. 15분마다 ping URL 요청을 예약하거나, 그 사이에 게이트웨이가 메시지를 하나 이상 전달하도록 하세요.
  4. 대시보드의 코드로 포트마다 확인하고, 직접 사용하는 서비스를 신고한 뒤 회선을 켜세요.

inbound URL 형식

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

다른 공급 방법

  • 즉시

    SmsGrab Node 앱

    내 SIM이 들어 있는 모든 Android 휴대폰

    • 검토 없이 즉시 참여
    • 코드 입력이나 QR 스캔으로 1분 안에 연결
    • 판매할 회선과 나를 위해 남길 서비스는 내가 결정
    판매액의 100% 작동 방식
  • 즉시

    SMS 전달

    모든 SMS 전달 앱, Tasker, MacroDroid 또는 iOS 단축어

    • 즉시 참여, 전달 하나에 회선 하나
    • JSON, 폼 필드, 일반 텍스트 지원
    • 회선마다 언제든 바꿀 수 있는 전용 URL
    판매액의 100% 작동 방식
  • 검토 후

    SIM 위탁

    SIM이나 eSIM 코드를 보내 주시면 저희가 운영합니다

    • 하드웨어도, 앱도, 전기 요금도 필요 없음
    • eSIM 코드는 도착 즉시 봉인되어 다시 표시되지 않음
    • 발송부터 판매까지 카드마다 추적
    판매액의 80% 작동 방식

내 SIM 카드가 오늘부터 수익을 낼 수 있습니다

장비를 갖춘 공급자를 위한 모뎀 풀, SIM 뱅크, GoIP