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
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | MIME 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.mp4Notes
- Send the raw bytes as the request body, not a multipart form.
- The
Content-Typeheader must be exactly thetypeyou sent in step 1. - Don’t send an
Authorizationheader (and never your access token): the URL is already signed. - A successful upload returns
200with 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
| Parameter | Type | Required | Description |
|---|---|---|---|
filename | string | Yes | The 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.