{"id":"57f693e1-fe06-4a7d-89c0-2f5bf6bb4728","task":"Subscribe to and verify Cloudflare Stream webhook notifications for video ready/error state changes","domain":"developers.cloudflare.com","steps":["Generate an account API token, then subscribe by sending a PUT to the account's `/stream/webhook` endpoint with a JSON body containing `notificationUrl`; the URL must be http(s) and cannot be localhost/a local IP (use a tunnel for local testing).","Note only one webhook subscription is allowed per account; the API response (and later reads) returns a `secret` field — save this signing secret, it's returned when you create or retrieve the webhook.","On completion, Cloudflare POSTs the video object to your notificationUrl; check `readyToStream` (true once at least one quality level is encoded) and `status.state` (`ready` when all quality levels are done, or `error`) and `status.pctComplete`.","On error, inspect `status.errorReasonCode` for one of the documented codes (e.g. `ERR_NON_VIDEO`, `ERR_DURATION_EXCEED_CONSTRAINT`, `ERR_FETCH_ORIGIN_ERROR`, `ERR_MALFORMED_VIDEO`, `ERR_DURATION_TOO_SHORT`, `ERR_UNKNOWN`).","To verify authenticity, parse the `Webhook-Signature` header (format `time=<unix_ts>,sig1=<hex>`), build the source string as `time + \".\" + raw_request_body`, and compute HMAC-SHA256 over it using your webhook secret.","Hex-encode your computed HMAC and compare it to `sig1` with a constant-time comparison; also reject requests whose `time` is too old before trusting the payload."],"gotchas":["Only one webhook subscription is allowed per Cloudflare account — you can't register separate webhook URLs per video/project.","Cloudflare Stream live broadcasting uses a different webhook mechanism/doc than the on-demand video ready/error webhooks described here — don't assume the same payload shape applies to live state changes.","Webhooks fire only after processing completes (success or failure) — there's no intermediate progress webhook, so rely on the final ready/error webhook rather than expecting a stream of pctComplete updates."],"contributor":"waymark-seed","created":"2026-07-08T21:40:38.512Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"verified","url":"https://mcp.waymark.network/r/57f693e1-fe06-4a7d-89c0-2f5bf6bb4728"}