Trim video
curl --request POST \
--url https://app.dumplingai.com/api/v1/trim-video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"videoUrl": "https://example.com/video.mp4",
"startTimestamp": "00:00:05",
"endTimestamp": "00:00:20"
}
'import requests
url = "https://app.dumplingai.com/api/v1/trim-video"
payload = {
"videoUrl": "https://example.com/video.mp4",
"startTimestamp": "00:00:05",
"endTimestamp": "00:00:20"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
videoUrl: 'https://example.com/video.mp4',
startTimestamp: '00:00:05',
endTimestamp: '00:00:20'
})
};
fetch('https://app.dumplingai.com/api/v1/trim-video', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.dumplingai.com/api/v1/trim-video",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'videoUrl' => 'https://example.com/video.mp4',
'startTimestamp' => '00:00:05',
'endTimestamp' => '00:00:20'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.dumplingai.com/api/v1/trim-video"
payload := strings.NewReader("{\n \"videoUrl\": \"https://example.com/video.mp4\",\n \"startTimestamp\": \"00:00:05\",\n \"endTimestamp\": \"00:00:20\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.dumplingai.com/api/v1/trim-video")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"videoUrl\": \"https://example.com/video.mp4\",\n \"startTimestamp\": \"00:00:05\",\n \"endTimestamp\": \"00:00:20\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.dumplingai.com/api/v1/trim-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"videoUrl\": \"https://example.com/video.mp4\",\n \"startTimestamp\": \"00:00:05\",\n \"endTimestamp\": \"00:00:20\"\n}"
response = http.request(request)
puts response.read_body{
"trimmedVideoUrl": "<string>",
"creditsUsed": 123
}{
"error": "<string>"
}{
"error": "<string>"
}Document Processing
Trim Video
Trim a video to a specific start and end time and return the resulting asset.
POST
/
api
/
v1
/
trim-video
Trim video
curl --request POST \
--url https://app.dumplingai.com/api/v1/trim-video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"videoUrl": "https://example.com/video.mp4",
"startTimestamp": "00:00:05",
"endTimestamp": "00:00:20"
}
'import requests
url = "https://app.dumplingai.com/api/v1/trim-video"
payload = {
"videoUrl": "https://example.com/video.mp4",
"startTimestamp": "00:00:05",
"endTimestamp": "00:00:20"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
videoUrl: 'https://example.com/video.mp4',
startTimestamp: '00:00:05',
endTimestamp: '00:00:20'
})
};
fetch('https://app.dumplingai.com/api/v1/trim-video', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.dumplingai.com/api/v1/trim-video",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'videoUrl' => 'https://example.com/video.mp4',
'startTimestamp' => '00:00:05',
'endTimestamp' => '00:00:20'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.dumplingai.com/api/v1/trim-video"
payload := strings.NewReader("{\n \"videoUrl\": \"https://example.com/video.mp4\",\n \"startTimestamp\": \"00:00:05\",\n \"endTimestamp\": \"00:00:20\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.dumplingai.com/api/v1/trim-video")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"videoUrl\": \"https://example.com/video.mp4\",\n \"startTimestamp\": \"00:00:05\",\n \"endTimestamp\": \"00:00:20\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.dumplingai.com/api/v1/trim-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"videoUrl\": \"https://example.com/video.mp4\",\n \"startTimestamp\": \"00:00:05\",\n \"endTimestamp\": \"00:00:20\"\n}"
response = http.request(request)
puts response.read_body{
"trimmedVideoUrl": "<string>",
"creditsUsed": 123
}{
"error": "<string>"
}{
"error": "<string>"
}Description
This endpoint allows users to trim a video from a specified URL based on start and end timestamps. The trimmed video is then uploaded to R2 storage, and the URL of the trimmed video is returned.Endpoint
POST https://app.dumplingai.com/api/v1/trim-video
Headers
- Content-Type:
application/json - Authorization: Bearer
<API_KEY>(required)
Request Body
{
"videoUrl": "string", // Required. The URL of the video to trim. Only MP4 videos are supported.
"startTimestamp": "string", // Required. The start time of the trim in HH:MM:SS format.
"endTimestamp": "string" // Required. The end time of the trim in HH:MM:SS format.
}
Responses
Success (200)
Returns the URL of the trimmed video and the number of credits used.{
"trimmedVideoUrl": "string", // URL of the trimmed video
"creditsUsed": "number" // Number of credits used for this operation
}
- X-RateLimit-Limit: The rate limit for the user.
- X-RateLimit-Remaining: The remaining number of requests for the user.
Bad Request (400)
Returned if the request is invalid or missing required parameters.{
"error": "Error message describing the issue"
}
Internal Server Error (500)
Returned if there’s an error during the video trimming process.{
"error": "Failed to trim video"
}
Example Request
curl -X POST https://app.dumplingai.com/api/v1/trim-video \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"videoUrl": "https://example.com/video.mp4",
"startTimestamp": "00:00:10",
"endTimestamp": "00:00:30"
}'
Example Response
{
"trimmedVideoUrl": "https://storage.example.com/trimmed-videos/abcdef123456.mp4",
"creditsUsed": 5
}
Notes
- The timestamp format should be HH:MM:SS (e.g., 00:01:15 for 1 minute and 15 seconds).
- Credits used are calculated based on the duration of the output video (200 credits per minute, rounded up).
- Output videos are limited to 200MB in size. You can reduce the size of the output video by trimming a smaller portion of the input video.
- The trimmed video is temporarily stored (~24 hours).
Rate Limiting
Rate limit headers (X-RateLimit-Limit and X-RateLimit-Remaining) are included in the response to indicate the user’s current rate limit status.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Publicly accessible MP4 URL to trim.
Start timecode for the trim in HH:MM:SS or HH:MM:SS.mmm format.
End timecode for the trim in HH:MM:SS or HH:MM:SS.mmm format.
Optional identifier describing where the API request originated.
Available options:
API, WEB, MAKE_DOT_COM, ZAPIER, N8N, PLAYGROUND, DEFAULT_AUTOMATION, AGENT_PREVIEW, AGENT_LIVE, AUTOPILOT, STUDIO