Skip to content

Media API

The Media API manages the media assets of a workspace. You upload a file with a resumable upload, PlayTelly processes it in the background (video ladder, image optimization, document pages, audio encoding, thumbnails), and you get ready-to-use URLs back. It also holds the transcoding profiles that choose how each upload is processed, and media playlists that group media in order.

Resources

Resource What it is
Media One asset in a workspace: a video, image, audio file, document, or a web app. Carries its status, processing stage and asset URLs.
Upload A file on its way in. Starts with Prepare an upload and becomes media when the last byte arrives.
Transcoding profile A reusable recipe that says how an upload is processed. Each edit creates a new version.
Slide One page image of a rasterized document.
Media playlist An ordered list of existing media, checked as a unit.

Authentication and permissions

All routes need a bearer token, except the health check. See Authentication. Permissions are workspace permissions, checked in the {workspaceId} of the path.

Action Permission
List and read media, uploads, folders, tags, statistics, usage, slides workspace:media:view
Prepare an upload, retry a transcode, register a web app, check a page, dismiss an upload workspace:media:upload
Update media, start processing workspace:media:edit
Delete media workspace:media:delete
List and read transcoding profiles and their versions workspace:media:view
Create, update and delete transcoding profiles workspace:settings:manage
List and read media playlists workspace:playlists:view
Create a media playlist workspace:playlists:create
Reorder a media playlist workspace:playlists:edit
Delete a media playlist workspace:playlists:delete
Health check None (public)

Base path

The Media API is served by CoreAPI (<API_HOST>):

https://<API_HOST>/api/v1/media/{workspaceId}/…

{workspaceId} is the workspace whose media you act on. A workspace whose permission your role lacks returns 403. Media from another workspace is never returned: a media ID outside your workspace returns 404.

Capabilities

  • Resumable (tus) upload, with an upload token and progress for uploads in flight
  • Video: audio level and container fix, then an HLS ladder from a transcoding profile, plus a SMIL file for Castis streamers
  • Images optimized to WebP, audio re-encoded with loudness normalization, documents rasterized to page images
  • Passthrough: a profile that skips processing and serves the file as it is, per category
  • Thumbnails for video, image, PDF and Office documents
  • Web apps: upload an HTML file, or register a live web page
  • Retry a failed video transcode without uploading again
  • Media playlists
  • Delete with storage cleanup, and a usage check before you delete
  • Purging cached copies when media is renamed, deleted or reprocessed (planned): a stale copy can be served until its cache entry expires
  • Resuming an upload after a page reload is a client concern; the API only offers GET /uploads

Object model

Media

The fields below are those you read and write. Fields marked read-only are set by the server.

Field Type Meaning
id integer Media ID. Read-only.
title string Display name.
description, altText, tags, license, provider string Free metadata. tags is comma-separated.
folder, fileName string Logical folder and file name. Changing them does not move the stored file.
workspaceId string Owning workspace. Read-only.
uploadedBy string User ID of the uploader. Read-only.
mediaType string video, image, audio, document, app or other. Read-only, inferred from the file.
status string See Lifecycle and states. Read-only.
fileSize integer Bytes. Read-only.
width, height integer Pixels. For a web app, the target playback size.
duration number Seconds. Video and audio. Read-only.
transcodingProfileId integer The profile chosen at upload time. Read-only.
transcodingProfileVersionId integer The profile version actually used. Set when processing starts and never changes afterwards. Read-only.
transcodingProfileName, aspectRatio string Name and output canvas (16:9, 9:16, 1:1) of the version used. Read-only.
transcodingStage string Progress of processing. Read-only.
transcodingError string Why the last transcode failed. Cleared when a retry starts. Read-only.
isActive boolean false hides the media from the default list. Default true.
activeStartDate, activeEndDate date Optional validity window (YYYY-MM-DD).
url string Complete URL of the source file. Read-only.
thumbnailUrl string Thumbnail. Empty until it exists. Read-only.
manifestUrl string HLS master playlist of a transcoded video. Read-only.
smilUrl string SMIL file of a transcoded video, for Castis streamers. Read-only.
progressiveUrl string One MP4 at the tallest rung, for players that do not use HLS. Read-only.
optimizedUrl string Optimized image or audio output. Read-only.
sourceUrl string The page URL of a registered web app. Read-only.

Use the *Url fields as they are. They are complete URLs; do not build asset URLs yourself from other fields. All times are ISO 8601 UTC.

{
  "id": 4521,
  "title": "Lobby welcome",
  "folder": "acme/hotel-lobby",
  "fileName": "lobby-welcome.mp4",
  "mediaType": "video",
  "status": "ready",
  "fileSize": 6533201,
  "duration": 42.5,
  "transcodingProfileId": 3,
  "transcodingProfileName": "Standard 3-Rung Ladder",
  "aspectRatio": "16:9",
  "transcodingStage": "done",
  "isActive": true,
  "url": "https://<ASSET_HOST>/playtelly/acme/hotel-lobby/4521/source/lobby-welcome.mp4",
  "manifestUrl": "https://<ASSET_HOST>/playtelly/acme/hotel-lobby/4521/hls/master.m3u8"
}

<ASSET_HOST> stands for the host that serves media files. The API returns the real value in every URL.

Upload

Field Type Meaning
id integer The upload ID (uploadId in the Prepare response).
title, fileName, mediaType string As prepared.
fileSize integer Declared size in bytes.
bytesReceived integer Bytes received so far.
percent integer or null Whole percent received, at most 99 until the file is finished. null until the first byte count arrives.
state string waiting, uploading or stalled. See Lifecycle and states.
startedAt, lastProgressAt, expiresAt string ISO 8601 UTC.

Transcoding profile and slide

Transcoding profiles have their own page: Transcoding profiles. A slide has order (page number from 1), imageUrl, and durationSec, a default display time that a schedule or player may override.

Media playlist

Field Type Meaning
id integer Playlist ID. Read-only.
title string Display name.
status string pending, ready or failed. Read-only.
errorMessage string Why the playlist is failed. Read-only.
items array The media, in order. Each item has mediaId, order (from 0) and the full media object.

A playlist only references media; it creates no new file. It is ready when every item is ready and has been transcoded.

Lists

Two lists are paginated with page (from 1, default 1) and limit (default 10, maximum 100; larger values become 100): media (GET /media/{workspaceId}) and media playlists. Both are ordered by sortBy and sortDir, default newest first (created_at, desc). The upload list returns the newest 200 and is not paginated. Folders, tags and transcoding profiles (and their versions) are not paginated and return all items.

curl "https://<API_HOST>/api/v1/media/{workspaceId}?type=video&limit=1" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"
{
  "success": true,
  "data": [
    {
      "id": 4521,
      "title": "Lobby welcome",
      "folder": "acme/hotel-lobby",
      "fileName": "lobby-welcome.mp4",
      "mediaType": "video",
      "status": "ready",
      "fileSize": 6533201,
      "duration": 42.5,
      "transcodingProfileId": 3,
      "aspectRatio": "16:9",
      "transcodingStage": "done",
      "isActive": true,
      "url": "https://<ASSET_HOST>/playtelly/acme/hotel-lobby/4521/source/lobby-welcome.mp4",
      "manifestUrl": "https://<ASSET_HOST>/playtelly/acme/hotel-lobby/4521/hls/master.m3u8"
    }
  ],
  "meta": {
    "count": 1,
    "total": 12,
    "page": 1,
    "limit": 1,
    "total_pages": 12,
    "has_next": true,
    "has_prev": false,
    "timestamp": "2026-11-18T09:30:00Z"
  }
}

The unpaginated lists use { "success": true, "data": [ … ] } without meta.

Lifecycle and states

Media status

Value Meaning
pending The record exists and the upload has not started.
uploading The upload is in progress.
processing The file arrived and is being moved into place.
ready The file is usable. For a video, the ladder may still be running: check transcodingStage.
error Moving the file failed. Run Process a media object.
archived Excluded from the default list.

transcodingStage

Value Meaning
empty No processing applies: no profile, or a type that has none.
queued Waiting for a free worker.
normalize, probe, transcode, package, thumbnail Running. Video moves queued, normalize, transcode, package, done.
done Finished. Passthrough profiles also end here.
failed See transcodingError. The source file is still ready for direct playback. Retry with Retry a transcode.

Upload state

Value Meaning
waiting Prepared, no bytes received yet.
uploading Bytes received in the last 3 minutes.
stalled No bytes for more than 3 minutes, or the token expired before anything arrived. It stays listed for 48 hours.
created The file arrived and became media. Only Get an upload returns this, with mediaId.

Errors

Handler errors have the body { "success": false, "error": "<message>" }. Validation errors add an errors list of { "field", "message" }. A missing or insufficient token returns { "message": "<text>" }. See API conventions for the shared status codes.

Status When it happens What to do
400 A required field is missing or malformed. Read errors and fix the request.
400 Prepare an upload: the profile is unknown to the workspace, or an audio file is paired with a non-audio profile (or the reverse). Pick a profile from List transcoding profiles with the right category.
401 No valid access token. Sign in again.
403 Your role lacks the route's permission, or you edit a system profile. Ask an administrator for the permission, or copy the system profile.
404 The media, upload, profile or playlist does not exist in this workspace. Check the ID and the workspace.
409 Delete a profile that media uses, delete a playlist that a channel uses, or retry a transcode that has not failed. Remove the reference or wait, then try again.

Example bodies:

{ "success": false, "error": "validation failed", "errors": [ { "field": "title", "message": "title is required" } ] }

400 for a field that failed validation. Other 400 replies have { "success": false, "error": "<message>" } without errors; 404 and 409 use that shape too.

{ "message": "Unauthorized - No token provided" }

401. The text after the dash changes with the cause (for example Invalid token format).

{ "message": "Forbidden - Insufficient permissions" }

403 from the permission check. A 403 for a system profile has { "success": false, "error": "<message>" }.

{ "success": false, "error": "failed to process request" }

500 on a database failure.

Processing problems do not fail the request that started them. They appear later on the media object as transcodingStage: failed with transcodingError.

Endpoints