curl --request PUT \
--url https://api.soundpiece.co/v1/adapt.auto_cut_down \
--header 'Content-Type: application/json' \
--data '
{
"idempotency_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": {
"url": "<string>"
},
"target_duration": 152.5,
"callback_url": "<string>"
}
'import requests
url = "https://api.soundpiece.co/v1/adapt.auto_cut_down"
payload = {
"idempotency_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": { "url": "<string>" },
"target_duration": 152.5,
"callback_url": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
idempotency_key: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
source: {url: '<string>'},
target_duration: 152.5,
callback_url: '<string>'
})
};
fetch('https://api.soundpiece.co/v1/adapt.auto_cut_down', 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://api.soundpiece.co/v1/adapt.auto_cut_down",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'source' => [
'url' => '<string>'
],
'target_duration' => 152.5,
'callback_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://api.soundpiece.co/v1/adapt.auto_cut_down"
payload := strings.NewReader("{\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": {\n \"url\": \"<string>\"\n },\n \"target_duration\": 152.5,\n \"callback_url\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://api.soundpiece.co/v1/adapt.auto_cut_down")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": {\n \"url\": \"<string>\"\n },\n \"target_duration\": 152.5,\n \"callback_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.soundpiece.co/v1/adapt.auto_cut_down")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": {\n \"url\": \"<string>\"\n },\n \"target_duration\": 152.5,\n \"callback_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"auto_cut": {
"id": "<string>",
"status": "processing",
"created_at": "2023-11-07T05:31:56Z",
"idempotency_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"target_duration": 152.5,
"output": {
"url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"duration": 123
},
"error": {
"code": "internal_error",
"message": "<string>"
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}adapt.auto_cut_down
Submit an auto-cut request.
Returns immediately with status: processing. Use the matching GET to
poll for completion, or supply a callback_url to receive a webhook.
Auto-cut trims a longer audio source to a target duration, choosing
musically natural cut points. The output duration may be slightly shorter
or longer than target_duration to land on a natural boundary.
target_duration is a target, not an exact length. Its absolute bounds — at
least 5 seconds and at most 5 minutes — are checked up front (422). It must
also be at most twice the source duration; since the source duration is only
known after ingestion, exceeding that surfaces asynchronously as a failed
operation with target_duration_too_long. The source must be fetchable,
decodable audio within the supported format/size limits and at least 2.5
seconds long (half the minimum target), else a source_* error — validated
once the source is fetched and decoded (see errors).
Credits cost: 1 per request. Insufficient credits returns 402 — see
errors.
curl --request PUT \
--url https://api.soundpiece.co/v1/adapt.auto_cut_down \
--header 'Content-Type: application/json' \
--data '
{
"idempotency_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": {
"url": "<string>"
},
"target_duration": 152.5,
"callback_url": "<string>"
}
'import requests
url = "https://api.soundpiece.co/v1/adapt.auto_cut_down"
payload = {
"idempotency_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": { "url": "<string>" },
"target_duration": 152.5,
"callback_url": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
idempotency_key: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
source: {url: '<string>'},
target_duration: 152.5,
callback_url: '<string>'
})
};
fetch('https://api.soundpiece.co/v1/adapt.auto_cut_down', 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://api.soundpiece.co/v1/adapt.auto_cut_down",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'source' => [
'url' => '<string>'
],
'target_duration' => 152.5,
'callback_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://api.soundpiece.co/v1/adapt.auto_cut_down"
payload := strings.NewReader("{\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": {\n \"url\": \"<string>\"\n },\n \"target_duration\": 152.5,\n \"callback_url\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://api.soundpiece.co/v1/adapt.auto_cut_down")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": {\n \"url\": \"<string>\"\n },\n \"target_duration\": 152.5,\n \"callback_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.soundpiece.co/v1/adapt.auto_cut_down")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"source\": {\n \"url\": \"<string>\"\n },\n \"target_duration\": 152.5,\n \"callback_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"auto_cut": {
"id": "<string>",
"status": "processing",
"created_at": "2023-11-07T05:31:56Z",
"idempotency_key": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"target_duration": 152.5,
"output": {
"url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"duration": 123
},
"error": {
"code": "internal_error",
"message": "<string>"
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
A unique UUID you choose. Send the same key to retry safely; we'll return the original response without doing the work again.
The audio source to operate on.
Show child attributes
Show child attributes
The desired output duration in seconds. This is a target, not an exact length — the result may be slightly shorter or longer to land on a natural cut point. Must be between 5 seconds and 5 minutes (enforced up front; out of range is a 422), and at most twice the source duration. Because the source duration is only known after the source is fetched and decoded, exceeding twice the source surfaces asynchronously as a failed operation with target_duration_too_long. See errors.
5 <= x <= 300Optional HTTPS URL we'll POST the final response to when the operation reaches ready or failed. Polling remains the canonical source of truth; webhooks are a best-effort latency optimisation.
1 - 2048Response
Successful Response
Show child attributes
Show child attributes
