Overview
This guide outlines the step-by-step process to upload a video file to Google Cloud Storage (GCS) using the Opus API and subsequently create a clip project. This includes generating an upload link, initiating a resumable upload session, uploading a video, and creating a clip project using that uploaded file.
Authentication
All API requests require an API key:
Authorization: Bearer <API_KEY>
Replace <API_KEY>
with your valid API token.
Step 1: Generate Upload Link
Endpoint
POST https://api.opus.pro/api/upload-links
Accept: application/json
Content-Type: application/json
Authorization: Bearer <API_KEY>
Request Body
{
"video": {
"usecase": "LocalUpload"
}
}
Response Example
{
"url": "https://storage.googleapis.com/ext.gcs.opus.pro/upload/org_000000000/google-upload",
"uploadId": "abc123xyz456",
"dnsUrl": "https://api.opus.pro",
"useAmount": 0,
"totalAmount": 107974182498
}
cURL Example
curl --request POST \
--url https://api.opus.pro/api/upload-links \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_KEY>' \
--data '{
"video": {
"usecase": "LocalUpload"
}
}'
Step 2: Initiate Resumable Upload Session
Endpoint
POST <url_from_previous_step>
x-goog-resumable: start
Content-Length: 0
Request Body
(empty)
- Replace
<url_from_previous_step>
with the url
received from Step 1
- No response body is returned
- Look for the
location
header in the response which contains the resumable upload URL
HTTP/2 201
x-goog-resumable-upload-id: AAkIAwy-YC6V...
location: https://storage.googleapis.com/ext.gcs.opus.pro/upload/org_000000000/google-upload
cURL Example
curl --request POST \
--url "<url_from_previous_step>" \
--header 'x-goog-resumable: start' \
--header 'Content-Length: 0' \
--verbose
Step 3: Upload Video File
Endpoint
PUT <resumable_upload_location>
Content-Type: application/octet-stream
Upload File
Use the --upload-file
option with your actual video file (e.g., test.mp4
).
cURL Example
curl -X PUT -v \
-H "Content-Type: application/octet-stream" \
--upload-file test.mp4 \
"<location>"
Replace <location>
with the location
URL from Step 2 response headers.
Step 4: Create Clip Project
Endpoint
POST https://api.opus.pro/api/clip-projects
Accept: application/json
Content-Type: application/json
Authorization: Bearer <API_KEY>
Request Body
{
"videoUrl": "<uploadId>",
"inputPref": {
"sourceLang": "auto"
},
"editJumpcuts": {
"enabled": true,
"silenceRanges": []
},
"uploadedVideoAttr": {
"title": "YOUR_TITLE"
},
"curationPref": {
"model": "ClipAnything",
"clipDurations": [[180, 300], [300, 600]]
},
"addKlyrics": false,
"addSplk": false,
"audio": {
"renderedPref": {
"templateId": "preset-fancy-Karaoke"
}
}
}
cURL Example
curl --request POST \
--url https://api.opus.pro/api/clip-projects \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_KEY>' \
--data '{
"videoUrl": "<uploadId>",
"inputPref": {
"sourceLang": "auto"
},
"editJumpcuts": {
"enabled": true,
"silenceRanges": []
},
"uploadedVideoAttr": {
"title": "YOUR_TITLE"
},
"curationPref": {
"model": "ClipAnything",
"clipDurations": [[180, 300], [300, 600]]
},
"addKlyrics": false,
"addSplk": false,
"audio": {
"renderedPref": {
"templateId": "preset-fancy-Karaoke"
}
}
}'
- Replace
<uploadId>
with the ID returned in Step 1
- Replace
"YOUR_TITLE"
with your desired clip project title
Full Workflow Summary
Generate Upload Link
Get url
and uploadId
from the upload-links endpoint
Start Resumable Session
Get location
from response headers using the url
from Step 1
Upload Video File
Upload your video file to the location
from Step 2
Create Clip Project
Create a new clip project using the uploadId
from Step 1