Webhooks
Set webhook_url when creating the task. When the task reaches done or failed, GPTunneL sends a POST request to that URL. The notification uses the same id as the task creation response.
Request body
Section titled “Request body”The notification contains id, status and result. When the status is failed, error explains the failure and result is empty. The API response fields code and webhook are omitted. To check delivery status, poll the task.
{ "id": "6a61e021a6e77553a989c41d", "model": "kling-v3", "status": "done", "result": [ { "url": "https://.../6a61e021a6e77553a989c41d_result.mp4" } ], "created_at": 1784799265}Headers
Section titled “Headers”| Header | Meaning |
|---|---|
X-Gptunnel-Event |
Type of event: task.done or task.failed |
X-Gptunnel-Delivery |
Task Identifier |
X-Gptunnel-Signature |
Body signature: t=<unix>,v1=<hex> |
User-Agent |
gptunnel-webhook/2 |
Outgoing Addresses
Section titled “Outgoing Addresses”If your server or WAF filters incoming requests, allow the webhook source IP listed on the Network addresses page.
We notify the account email before a planned address change. During an emergency migration, advance notice may be unavailable.
Verification of signature
Section titled “Verification of signature”The signature lets you verify that GPTunneL sent the request. The header format is compatible with Stripe’s signature format.
X-Gptunnel-Signature: t=1784799265,v1=5f8c...e21aHere t is the Unix timestamp in seconds, and v1 is the hex-encoded HMAC-SHA256 of "<t>.<request body>". Use the API key that created the task as the signing secret. Verify the signature before reading the fields and reject unsigned requests.
Take t and the raw request body, compute HMAC-SHA256 over `${t}.${rawBody}` using your API key as the secret, and compare the result with v1. The examples allow a five-minute clock difference.
import hashlibimport hmacimport reimport time
def verify(raw_body: bytes, header: str, api_key: str) -> bool: match = re.fullmatch(r't=([0-9]{1,12}),v1=([0-9a-f]{64})', header) if not match or abs(time.time() - int(match[1])) > 300: return False signed = match[1].encode('ascii') + b'.' + raw_body expected = hmac.new(api_key.encode(), signed, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, match[2])import { createHmac, timingSafeEqual } from 'node:crypto'
function verify(rawBody: Buffer, header: string, apiKey: string): boolean { const match = /^t=([0-9]{1,12}),v1=([0-9a-f]{64})$/.exec(header) if (!match || Math.abs(Date.now() / 1000 - Number(match[1])) > 300) return false const expected = createHmac('sha256', apiKey) .update(match[1] + '.') .update(rawBody) .digest() return timingSafeEqual(expected, Buffer.from(match[2], 'hex'))}Respond with a 2xx status. If delivery fails, GPTunneL retries after increasing delays of about 5, 20, 60 and 180 seconds.