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.
-
Submit an async video job
Send a
POSTrequest tohttps://api.splixir.com/v1/jobswithkindset tovideo,waitset tofalse, anIdempotency-Keyheader, and acallbackUrlfor 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"}'const response = await fetch("https://api.splixir.com/v1/jobs", {method: "POST",headers: {Authorization: `Bearer ${process.env.SPLIXIR_API_KEY}`,"Content-Type": "application/json","Idempotency-Key": "transcode-clip-001",},body: JSON.stringify({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",}),});const job = await response.json();console.log(job.id, job.state);import osimport requestsresponse = requests.post("https://api.splixir.com/v1/jobs",headers={"Authorization": f"Bearer {os.environ['SPLIXIR_API_KEY']}","Content-Type": "application/json","Idempotency-Key": "transcode-clip-001",},json={"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",},)job = response.json()print(job["id"], job["state"]) -
Store the job ID from the 202 response
Splixir returns HTTP
202withstateset toqueued. Savejob.idin your database. If a network error occurs during submission, retry safely with the sameIdempotency-Keyand Splixir returns the original job instead of creating a duplicate. -
Verify incoming webhook signatures
When the job reaches a terminal state (
delivered,partial,failed, orrejected), Splixir sends aPOSTrequest tocallbackUrlor your matching configured webhook endpoint withX-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/:idwith exponential backoff untilstateis terminal. -
Fetch the verification report and download the output
After receiving
job.delivered, inspectGET /v1/jobs/:id/reportto audit keyframe checks, audio-video sync drift, and SHA-256 checksums, then download the video fromoutput.downloadUrl.Continue with the Video reference, Webhooks guide, and Flex Async guide.