Skip to content

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.

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

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.

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...e21a

Here 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 hashlib
import hmac
import re
import 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])

Respond with a 2xx status. If delivery fails, GPTunneL retries after increasing delays of about 5, 20, 60 and 180 seconds.