GraphQL API
Uploads
Upload video and image assets using TUS resumable uploads.
The Rad TV API uses the TUS protocol for resumable file uploads. This ensures large video files can be uploaded reliably, with automatic resume on network interruptions.
Upload Flow
Create an ingestion session
Use createContentAsset to get a TUS upload endpoint:
curl -X POST https://api.rad.live/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"query": "mutation { createContentAsset(id: \"did:rad.live:content/feature/123\", input: { filename: \"video.mp4\", size: 524288000 }) { id endpoint tus { filename } metadata { mimeType } } }"
}'const response = await fetch('https://api.rad.live/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY',
},
body: JSON.stringify({
query: `
mutation {
createContentAsset(
id: "did:rad.live:content/feature/123"
input: { filename: "video.mp4", size: 524288000 }
) {
id
endpoint
tus { filename }
metadata { mimeType }
}
}
`,
}),
});
const session = (await response.json()).data.createContentAsset;
console.log(session.endpoint); // TUS upload URLresponse = requests.post(
"https://api.rad.live/graphql",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY",
},
json={
"query": """
mutation {
createContentAsset(
id: "did:rad.live:content/feature/123"
input: { filename: "video.mp4", size: 524288000 }
) {
id
endpoint
tus { filename }
metadata { mimeType }
}
}
"""
},
)
session = response.json()["data"]["createContentAsset"]
print(session["endpoint"]) # TUS upload URLUpload the file
POST the file to the returned endpoint with your API key:
curl -X POST <ENDPOINT_URL> \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@video.mp4"The endpoint handles TUS protocol chunking and resumability.
Track progress
Check upload status via the ingestion session:
{
me {
ingestion(id: "ingestion-id") {
id
progress { current total }
metadata { mimeType filename }
}
}
}ContentAssetInput
| Field | Type | Required | Description |
|---|---|---|---|
filename | String! | Yes | File name with extension |
size | Long! | Yes | File size in bytes |
video | VideoHintInput | No | Video spatial hint |
VideoHintInput
| Value | Description |
|---|---|
NONE | Standard landscape video |
PORTRAIT | Vertical/portrait video |
EQUIRECTANGULAR | 360° VR video |
CUBEMAP | Cubemap VR format |
STEREOSCOPIC | Stereoscopic 3D |
Playlist Assets
Upload images for playlists using createPlaylistAsset:
mutation {
createPlaylistAsset(
id: "did:rad.live:content/playlist/456"
input: { filename: "cover.jpg", size: 2048000 }
) {
id
endpoint
}
}IngestionSession Type
| Field | Type | Description |
|---|---|---|
id | IngestionID! | Session identifier |
endpoint | URL | TUS upload endpoint |
tus | TUSInfo | File metadata (filename, initiator) |
metadata | IngestionMetadata | MIME type, filename |
progress | IngestionProgress | Current/total bytes uploaded |
For a simpler upload experience, use the publishVideo compound mutation which handles ingestion session creation automatically. See Publish to Rad.