Speech to Text

Job webhook

The stt.job.completed event, its delivery and retries, and how to verify the Wistfare-Signature header.

When a job created with a webhook_url reaches a final status (completed, partial, failed or canceled), Wistfare sends one POST to that URL.

Request

POST /hooks/wistfare HTTP/1.1
Host: example.com
Content-Type: application/json
User-Agent: Wistfare-Webhooks/1.0
Wistfare-Signature: t=1791712800,v1=5f0c3b8e1d7a2c4b9e6f8a0d3c5b7e9f1a2c4d6e8f0b1a3c5d7e9f2b4c6d8e0a
{
  "type": "stt.job.completed",
  "job": {
    "id": "sttjob_k3n8q2x7d1v9m4b6c0zt",
    "status": "completed",
    "options": { "model": "wistfare-stt-v3-beta", "language": "auto", "timestamps": true, "diarize": false, "boost": [], "enhanced": true, "punctuation": true },
    "webhook_url": "https://example.com/hooks/wistfare",
    "created_at": "2026-10-11T09:40:00Z",
    "completed_at": "2026-10-11T09:46:31Z",
    "items": [
      { "id": "sttitem_p4w9c2m7x1k8d3q6v0bn", "name": "0915.mp3", "status": "succeeded", "audio_seconds": 312.48, "transcription_id": "tr_h2k7m4q9x1c6v3b8n5dz", "cost_cents": 4, "error": null }
    ],
    "totals": { "items": 1, "queued": 0, "running": 0, "succeeded": 1, "failed": 0, "canceled": 0, "audio_seconds": 312.48, "cost_cents": 4 }
  }
}
FieldDescription
typeAlways stt.job.completed.
jobThe job object, exactly as GET /v1/stt/jobs/{id} returns it. Check job.status to tell success from partial or failed jobs.

Delivery

  • Respond with 2xx within 10 seconds. Do slow work (fetching transcripts, writing to your database) after responding.
  • Retries: a non-2xx response, a timeout or a connection error is retried 3 times, after about 5, 20 and 80 seconds. Redirects aren't followed.
  • At least once: a delivery can repeat (for example after a restart mid-retry). Handle the event by job.id, so a repeat does no harm.
  • Allowed URLs: public https:// addresses only. Private, loopback and local hosts are refused.

If every attempt fails, the job is still complete: poll GET /v1/stt/jobs/{id} to recover.

Signature

Wistfare-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(webhook_secret, "<t>.<raw body>")>

webhook_secret (whsec_…) comes from the create response, once per job. To verify a delivery:

  1. Split the header on , and read t and v1.
  2. Compute HMAC-SHA256 with the job's webhook_secret as the key over the bytes <t>. followed by the raw request body, exactly as received (don't re-serialise parsed JSON).
  3. Compare the hex digest with v1 in constant time.
  4. Reject timestamps more than a few minutes from your clock, to stop replays.

With the SDKs

verify_webhook / verifyWebhook do all four steps (five minutes of tolerance by default) and return the parsed event, or raise WebhookVerificationError:

from wistfareai import WebhookVerificationError, verify_webhook

try:
    event = verify_webhook(raw_body, headers["Wistfare-Signature"], webhook_secret)
except WebhookVerificationError:
    ...  # respond 400 and ignore the delivery
print(event["type"], event["job"]["status"])

Without an SDK

import hashlib
import hmac
import time


def verify_wistfare_signature(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
    """True when `header` (Wistfare-Signature) signs `raw_body` with `secret`."""
    try:
        parts = dict(part.strip().split("=", 1) for part in header.split(","))
        timestamp, signature = parts["t"], parts["v1"]
        if abs(time.time() - int(timestamp)) > tolerance:
            return False
    except (KeyError, ValueError):
        return False
    expected = hmac.new(secret.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)

Complete FastAPI and Express handlers are in the Batch transcription guide.

On this page