Skip to content

Async video pipeline

Longer video jobs run asynchronously so your app never blocks on transcoding. You submit a job with wait: false and an Idempotency-Key, receive notifications through signed webhooks, and fetch the delivered output. See Pricing and limits for stream-copy and transcoding rates.

  1. Submit an async video job

    Send a POST request to https://api.splixir.com/v1/jobs with kind set to video, wait set to false, an Idempotency-Key header, and a callbackUrl for completion events.

    Terminal window
    curl -X POST https://api.splixir.com/v1/jobs \
    -H "Authorization: Bearer $SPLIXIR_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: transcode-clip-001" \
    -d '{
    "kind": "video",
    "input": "https://cdn.example.com/raw.mov",
    "operations": [
    { "type": "resize", "resolution": "1080p", "fit": "inside", "withoutEnlargement": true },
    { "type": "transcode", "codec": "h264", "container": "mp4", "quality": "balanced" }
    ],
    "output": { "format": "mp4" },
    "wait": false,
    "callbackUrl": "https://example.com/webhooks/splixir"
    }'
  2. Store the job ID from the 202 response

    Splixir returns HTTP 202 with state set to queued. Save job.id in your database. If a network error occurs during submission, retry safely with the same Idempotency-Key and Splixir returns the original job instead of creating a duplicate.

  3. Verify incoming webhook signatures

    When the job reaches a terminal state (delivered, partial, failed, or rejected), Splixir sends a POST request to callbackUrl or your matching configured webhook endpoint with X-Splixir-Signature, X-Splixir-Event, X-Splixir-Delivery, and Standard Webhooks headers (webhook-id, webhook-timestamp, webhook-signature). Verify the HMAC-SHA256 signature over ${timestamp}.${rawBody} before trusting the payload:

    import { createHmac, timingSafeEqual } from "node:crypto";
    function verifyWebhook(rawBody: string, signatureHeader: string, secret: string): boolean {
    const parts = Object.fromEntries(
    signatureHeader.split(",").map((pair) => pair.split("=") as [string, string]),
    );
    if (!parts.t || !parts.v1) return false;
    if (Math.abs(Math.floor(Date.now() / 1000) - Number(parts.t)) > 300) return false;
    const expected = createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
    return timingSafeEqual(Buffer.from(expected, "hex"), Buffer.from(parts.v1, "hex"));
    }

    If your endpoint does not use webhooks, poll GET /v1/jobs/:id with exponential backoff until state is terminal.

  4. Fetch the verification report and download the output

    After receiving job.delivered, inspect GET /v1/jobs/:id/report to audit keyframe checks, audio-video sync drift, and SHA-256 checksums, then download the video from output.downloadUrl.

    Continue with the Video reference, Webhooks guide, and Flex Async guide.