Skip to main content

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.

Endpoint

POST https://api.opus.pro/api/upload-links

Headers

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>

Headers

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

Example Response Headers

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>

Headers

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

Headers

Accept: application/json
Content-Type: application/json
Authorization: Bearer <API_KEY>

Response Headers

...other headers
x-opus-upload-id: <source_id_from_upload_source>

Request Body

{
  "videoUrl": "<uploadId>",
  "conclusionActions": [
    {
      "type": "EMAIL",
      "notifyFailure": true,
      "email": "[email protected]"
    }
  ],
  "curationPref": {
    "range": {
      "startSec": 28,
      "endSec": 636
    },
    "clipDurations": [
      [
        0,
        90
      ]
    ],
    "topicKeywords": [
      "OpusClip"
    ],
    "genre": "Auto",
    "skipCurate": false
  },
  "importPref": {
    "sourceLang": "auto"
  },
  "brandTemplateId": "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>",
    "conclusionActions": [
      {
        "type": "EMAIL",
        "notifyFailure": true,
        "email": "[email protected]"
      }
    ],
    "curationPref": {
      "range": {
        "startSec": 28,
        "endSec": 636
      },
      "clipDurations": [
        [
          0,
          90
        ]
      ],
      "topicKeywords": [
        "OpusClip"
      ],
      "genre": "Auto",
      "skipCurate": false
    },
    "importPref": {
      "sourceLang": "auto"
    },
    "brandTemplateId": "preset-fancy-Karaoke"
  }'
  • Replace <uploadId> with the ID returned in Step 1
You can find detailed explanations for each parameter and test this endpoint at Create Project Playground.

Full Workflow Summary

1

Generate Upload Link

Get url and uploadId from the upload-links endpoint
2

Start Resumable Session

Get location from response headers using the url from Step 1
3

Upload Video File

Upload your video file to the location from Step 2
4

Create Clip Project

Create a new clip project using the uploadId from Step 1