Signature
Every request to the Gateway and every webhook the Gateway sends is signed the same way.
| Header | Value |
|---|---|
X-GW-Key-ID | the keyId of an API key from the administrator (a client may hold several keys, so keys rotate without downtime) |
X-GW-Timestamp | current unix seconds, e.g. 1764471600, within ±300 s of the Gateway clock |
X-GW-Signature | hex(HMAC-SHA256(secret, rawBody + "." + timestamp)) |
rawBodyis the exact bytes you send; never parse and re-serialize before signing- requests without a body (e.g.
GET) sign an emptyrawBody - the Gateway checks your IP allowlist: other IPs get
403 IP_NOT_ALLOWED - a wrong signature or a stale timestamp gets
401 INVALID_SIGNATURE(more than ±300 s off)
Example (Node.js)
ts
import { createHmac } from 'node:crypto'
const body = JSON.stringify({ clientRef: 'smsup-0001', route: 'TRUE', from: 'SMSUPPLUS', to: '66812345678', text: 'hello' })
const timestamp = Math.floor(Date.now() / 1000).toString()
const signature = createHmac('sha256', process.env.GW_SECRET!)
.update(`${body}.${timestamp}`)
.digest('hex')
await fetch('http://localhost:30080/v1/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-GW-Key-ID': process.env.GW_KEY_ID!,
'X-GW-Timestamp': timestamp,
'X-GW-Signature': signature,
},
body,
})Example (Go)
go
mac := hmac.New(sha256.New, []byte(secret))
mac.Write(rawBody)
mac.Write([]byte("." + timestamp))
signature := hex.EncodeToString(mac.Sum(nil))Verify webhooks on your side with the same formula and a constant-time compare (crypto.timingSafeEqual, hmac.Equal).