> ## Documentation Index
> Fetch the complete documentation index at: https://help.opus.pro/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload Video and Create Clip Project

> Upload a video file to Google Cloud Storage and create a clip project using the Opus API.

## 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>
```

<Tip>
  Replace `<API_KEY>` with your valid API token.
</Tip>

***

## Step 1: Generate Upload Link

### Endpoint

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

### Headers

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

### Request Body

```json theme={"dark"}
{
  "video": {
    "usecase": "LocalUpload"
  }
}
```

### Response Example

```json theme={"dark"}
{
  "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

```bash theme={"dark"}
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)

<Note>
  * 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
</Note>

### 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

```bash theme={"dark"}
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

```bash theme={"dark"}
curl -X PUT -v \
  -H "Content-Type: application/octet-stream" \
  --upload-file test.mp4 \
  "<location>"
```

<Tip>
  Replace `<location>` with the `location` URL from Step 2 response headers.
</Tip>

***

## 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

```json theme={"dark"}
{
  "videoUrl": "<uploadId>",
  "conclusionActions": [
    {
      "type": "EMAIL",
      "notifyFailure": true,
      "email": "opusclip@opus.pro"
    }
  ],
  "curationPref": {
    "range": {
      "startSec": 28,
      "endSec": 636
    },
    "clipDurations": [
      [
        0,
        90
      ]
    ],
    "topicKeywords": [
      "OpusClip"
    ],
    "genre": "Auto",
    "skipCurate": false
  },
  "importPref": {
    "sourceLang": "auto"
  },
  "brandTemplateId": "preset-fancy-Karaoke"
}
```

### cURL Example

```bash theme={"dark"}
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": "opusclip@opus.pro"
      }
    ],
    "curationPref": {
      "range": {
        "startSec": 28,
        "endSec": 636
      },
      "clipDurations": [
        [
          0,
          90
        ]
      ],
      "topicKeywords": [
        "OpusClip"
      ],
      "genre": "Auto",
      "skipCurate": false
    },
    "importPref": {
      "sourceLang": "auto"
    },
    "brandTemplateId": "preset-fancy-Karaoke"
  }'
```

<Note>
  **`forceStrategy` (optional, advanced)** pins curation to an explicit
  strategy instead of letting OpusClip auto-select one.
  [Talk to our support team](https://www.opus.pro/contact-support) to learn how
  to use it.
</Note>

<Note>
  * Replace `<uploadId>` with the ID returned in Step 1
</Note>

<Tip>
  For detailed explanations of the project-creation request body, refer to [Create a New Project](/api-reference/endpoints/create-project), which documents the `POST /api/clip-projects` API.
</Tip>

***

## Full Workflow Summary

<Steps>
  <Step title="Generate Upload Link">
    Get `url` and `uploadId` from the upload-links endpoint
  </Step>

  <Step title="Start Resumable Session">
    Get `location` from response headers using the `url` from Step 1
  </Step>

  <Step title="Upload Video File">
    Upload your video file to the `location` from Step 2
  </Step>

  <Step title="Create Clip Project">
    Create a new clip project using the `uploadId` from Step 1
  </Step>
</Steps>

***

## Related Endpoints

<CardGroup cols={2}>
  <Card title="POST /api/clip-projects" icon="plus" href="/api-reference/endpoints/create-project">
    Refer to the full API reference for creating a clip project.
  </Card>

  <Card title="Get Clips" icon="video" href="/api-reference/endpoints/get-clips">
    Retrieve clips from your created projects
  </Card>
</CardGroup>
