Skip to main content

Overview

Create a processing task and launch a worker in a single request.
  • With the default source_type: "srt_listener", the endpoint blocks until the worker publishes an SRT URL (typically a few seconds).
  • With source_type: "hls_pull", Narrative pulls the supplied HLS manifest and returns immediately. There is no inbound SRT URL, so srt_url is null.
  • An hls_pull task can also be scheduled: pass scheduled_start_at and nothing is launched (or billed) right away. The task is stored with status scheduled, and Narrative starts the worker 15 minutes before that time so it is already pulling the manifest when the stream goes live. See Scheduling an HLS Pull.
This is the recommended way to start a task. The legacy Warmup + Assign Task flow is deprecated but still supported for backward compatibility.

Request Parameters

Input Stream Requirements

For SRT listener tasks, stream to the returned URL. For HLS pull tasks, the manifest at source_url must remain reachable for the task duration. Both inputs must meet these media requirements: See Video Input Requirements for validation commands and FFmpeg examples.

HLS Start Position

source_start controls where an HLS pull begins. The selected position becomes time 0 for the task’s transcript, detections, edits, and source archive. For an EVENT or VOD playlist, offset 0 is normally the beginning of the event. For a sliding live playlist, offset 0 is the oldest segment still retained when the worker starts. Use program_date_time when a stable wall-clock position matters across a sliding DVR window. Requests outside the retained range fail instead of silently starting at a different point.

Scheduling an HLS Pull

Pass scheduled_start_at on an hls_pull request to create the task ahead of the event:
What happens next: If scheduled_start_at is less than 15 minutes away, the launch window is already open and the task starts immediately (status queued), exactly like an unscheduled hls_pull request; the response still echoes scheduled_start_at. If your organization is at its concurrent task limit when the launch time arrives, Narrative retries every few seconds and launches as soon as a slot frees. If no slot frees within 30 minutes of the scheduled start, the task is marked failed with a failure_reason explaining why.

Render Videos Object

When render_video is set to "ffmpeg", rendered highlight clips are automatically uploaded to a project in your dashboard at app.narrative-sports.com. You can review, download, and manage your clips there. See Dashboard Integration for details.

Team Names Object

For soccer, baseball, and American football, use team names. For MMA and squash singles, use individual competitor names.

Example Request

Example Response

HLS Pull Example

This example begins processing 44 minutes into the retained HLS timeline. Use {"mode":"live_edge"} instead when only newly published media should be processed. The response has the same shape, with srt_url: null:

Response Fields

The generated project ID is available from Get Task Info: call GET /v1/tasks/{task_id}/info and read task.project_id. The value may be null until the worker has linked the task to a project; retry after the task has started producing project data.

SRT Stream Configuration

URL Format

The srt_url includes everything needed to connect:
Connect in SRT caller mode (the default for FFmpeg/OBS) over UDP 9000. SRT latency is negotiated automatically (the server uses 5 seconds); you may also set &latency=5000000 on your encoder.
Use the complete srt_url exactly as returned by the API. It contains the per-task host and encryption passphrase and is valid only for that task — don’t rebuild or modify it.

SMPTE Timecode

Provide srt_zero_relative_smpte_timecode in HH:MM:SS:FF (non-drop) or HH:MM:SS;FF (drop-frame) format. If framerate is provided, it is used to interpret the timecode. Otherwise, the framerate is inferred from the stream (note: inference can be inconsistent with VFR encoding). Drop-frame timecodes are only valid with 29.97 (30000/1001) or 59.94 (60000/1001) framerates; incompatible combinations cause the task to fail fast. For OTIO output, srt_zero_relative_smpte_timecode does not by itself shift source_range.start_time.value. Use otio.source_start_offset when you need a fixed frame offset in OTIO.

Task Lifecycle

  1. scheduled - hls_pull task with a future scheduled_start_at; no worker is running yet and nothing is billed
  2. queued - Task created, worker launching
  3. running - Worker active (booting or processing)
  4. ready - SRT URL published, ready to receive stream
  5. completed - Task finished successfully
  6. error - Worker failed to launch (infrastructure / instance startup failure)
  7. failed - Worker started but processing failed (pipeline / runtime error)
  8. stopping - Graceful stop requested; ingest is stopping while already-submitted renders drain
  9. stopped - Task was manually stopped via kill (immediate) or after stopping drain completes
  10. cancelled - A scheduled task was killed before its worker launched

Error Handling

Rate Limits

Each account has a concurrent task limit. Narrative manages this limit centrally; organization members cannot change it through the API or dashboard. If you have no limit configured, the API returns 403:
If you are at your limit, the API returns 429:
Kill a running task or wait for one to finish before creating a new one.

Worker Launch Failure

If the worker fails to start (e.g., due to high traffic), the API returns a 500 error:
Retry with a new create-task request after a short delay.

Worker Did Not Publish SRT URL in Time

If the worker takes too long to publish the SRT URL, the API returns 504:
The task is still running in the background — poll Get Task Status or read srt_url from Get Task Info once the worker finishes booting.