Skip to content

Videos

Manage video resources. Videos are created automatically when a file is uploaded via S3 and the webhook is triggered.

List Videos

Returns a paginated list of videos for the authenticated user.

GET /api/videos

Query Parameters:

ParameterTypeDescription
pageintegerPage number
per_pageintegerItems per page

Response:

json
{
  "data": [
    {
      "id": 1,
      "ulid": "01HX...",
      "name": "my-video.mp4",
      "status": "completed",
      "duration": 120.5,
      "aspect_ratio": "16:9",
      "thumbnail_path": "videos/01HX.../thumbnail.jpg",
      "template_id": 1,
      "streams": [...],
      "created_at": "2025-01-15T10:30:00Z"
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 5,
    "per_page": 15,
    "total": 72
  }
}

Get Video

GET /api/videos/{ulid}

Returns a single video with its streams and outputs.

Response:

json
{
  "data": {
    "id": 1,
    "ulid": "01HX...",
    "name": "my-video.mp4",
    "status": "completed",
    "duration": 120.5,
    "aspect_ratio": "16:9",
    "thumbnail_path": "videos/01HX.../thumbnail.jpg",
    "template": { ... },
    "streams": [
      {
        "ulid": "01HY...",
        "type": "video",
        "width": 1920,
        "height": 1080,
        "size": 52428800
      }
    ],
    "outputs": [
      {
        "ulid": "01HZ...",
        "format": "hls",
        "status": "completed",
        "progress": 100,
        "streams": [...]
      }
    ]
  }
}

Update Video

PUT /api/videos/{ulid}

Request Body:

json
{
  "name": "Updated Video Name",
  "template_id": 2
}

Delete Video

Deletes the video, its streams, outputs, and associated S3 files.

DELETE /api/videos/{ulid}

Get Video Sources

Returns signed streaming URLs for the video. Requires an active proxy node.

GET /api/videos/{ulid}/sources

Response:

json
{
  "sources": [
    {
      "format": "hls",
      "url": "https://proxy.example.com/hls/..."
    },
    {
      "format": "dash",
      "url": "https://proxy.example.com/dash/..."
    },
    {
      "format": "mp4",
      "url": "https://proxy.example.com/proxy/..."
    }
  ]
}

Video Statuses

video.status reflects the ingestion pipeline phase. Check individual outputs[].status to see which encodings succeeded or failed.

StatusDescription
pendingUploaded, waiting to be dispatched
downloadingSource file being fetched
runningSegmentation and encoding in progress
uploadingEncoded chunks being assembled and uploaded to S3
completedAll outputs have reached a terminal state (at least one completed)
failedIngestion pipeline failed before any output could be produced

Output Statuses

Each output tracks its own encoding independently. A video can have some outputs completed and others failed at the same time — failed outputs can be deleted by the user while the video continues to function with the remaining completed outputs.

StatusDescription
pendingWaiting for the encode batch to start
runningChunks being encoded and uploaded
completedFinal file assembled and available in S3
failedConcat or upload failed; output is unusable

Upload Flow

Videos are not created via a direct POST endpoint. Instead:

  1. Initiate a multipart upload to S3 (see S3 Upload).
  2. S3 triggers a webhook when the upload completes.
  3. NukeVideo creates the video record and starts processing.

S3 Multipart Upload

These endpoints coordinate multipart uploads with S3:

MethodEndpointDescription
GET/api/s3/paramsGet upload parameters
POST/api/s3/multipartCreate multipart upload
GET/api/s3/multipart/{uploadId}Get uploaded parts
GET/api/s3/multipart/{uploadId}/{partNumber}Sign a part
POST/api/s3/multipart/{uploadId}/completeComplete upload
DELETE/api/s3/multipart/{uploadId}Abort upload

Upload Metadata

When creating an upload, you can pass optional metadata to associate the video with external systems:

json
{
  "filename": "video.mp4",
  "metadata": {
    "template": "01ABC...",
    "externalUserId": "user-123",
    "externalResourceId": "post-456"
  }
}
FieldTypeDescription
metadata.templatestringRequired. Template ULID to use for processing
metadata.externalUserIdstringOptional. ID of the user in your external system
metadata.externalResourceIdstringOptional. ID of the resource (post, product, etc.) in your external system

These fields are stored on the video record and returned in API responses as externalUserId and externalResourceId. The externalUserId is also recorded in usage tracking, allowing you to query per-user metrics via the Usage API.

Released under the MIT License.