Upload Endpoints

To clip a video file that isn’t available at a public link, upload it to Klap’s temporary storage in three steps, then pass the resulting URL as source_video_url to Create Project from Video.

1. Get an Upload URL

Reserve storage for one video file.

Endpoint: POST /media/upload

Request

POST /media/upload
Authorization: Bearer <access_token>
Content-Type: application/json
 
{
  "type": "video/mp4"
}

Request Parameters

ParameterTypeRequiredDescription
typestringYesMIME type of the file: "video/mp4", "video/quicktime" (.mov) or "video/webm"

Response

{
  "signed_upload_url": "https://storage.googleapis.com/klap-upload-tmp-regional/0b6f4c1e-2d3a-4f5b-8c9d-1e2f3a4b5c6d.mp4?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=...&X-Goog-Signature=...",
  "filename": "0b6f4c1e-2d3a-4f5b-8c9d-1e2f3a4b5c6d.mp4"
}
  • signed_upload_url (string): Pre-signed URL to upload the file to (step 2). Valid for 48 hours.
  • filename (string): Name of the stored file. Keep it for step 3.

2. Upload the File

Send the file’s raw bytes to the signed_upload_url.

Endpoint: PUT <signed_upload_url>

Request

PUT <signed_upload_url>
Content-Type: video/mp4
 
<raw file bytes>
curl -X PUT "SIGNED_UPLOAD_URL" \
  -H "Content-Type: video/mp4" \
  --upload-file my-video.mp4

Notes

  • Send the raw bytes as the request body, not a multipart form.
  • The Content-Type header must be exactly the type you sent in step 1.
  • Don’t send an Authorization header (and never your access token): the URL is already signed.
  • A successful upload returns 200 with an empty body.

3. Get a Read URL

Get a URL Klap can read the uploaded file from.

Endpoint: GET /media/upload

Request

GET /media/upload?filename={filename}
Authorization: Bearer <access_token>

Query Parameters

ParameterTypeRequiredDescription
filenamestringYesThe filename returned in step 1

Response

{
  "signed_read_url": "https://storage.googleapis.com/klap-upload-tmp-regional/0b6f4c1e-2d3a-4f5b-8c9d-1e2f3a4b5c6d.mp4?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=...&X-Goog-Signature=..."
}
  • signed_read_url (string): Pre-signed URL to the uploaded file. Valid for 48 hours.

4. Create the Project

Pass the signed_read_url as source_video_url, and the original file name as name (an uploaded file has no title of its own):

POST /tasks/video-to-shorts
Authorization: Bearer <access_token>
Content-Type: application/json
 
{
  "source_video_url": "<signed_read_url>",
  "name": "Team offsite keynote"
}

The project’s source_url will contain this signed URL, which gives read access to the file: don’t display or share it.