curl --location --request PATCH 'https://api.inworld.ai/voices/v1/pvcVoices/<voice-id>/samples/<sample-id>?updateMask=trim_start_ms,trim_end_ms' \
--header "Authorization: Basic $INWORLD_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"trimStartMs": 1000,
"trimEndMs": 5000
}'import requests
voice_id = "<voice-id>"
sample_id = "<sample-id>"
url = f"https://api.inworld.ai/voices/v1/pvcVoices/{voice_id}/samples/{sample_id}"
headers = {
"Authorization": "Basic <api-key>",
"Content-Type": "application/json"
}
params = {"updateMask": "trim_start_ms,trim_end_ms"}
payload = {"trimStartMs": 1000, "trimEndMs": 5000}
response = requests.patch(url, headers=headers, params=params, json=payload)
print(response.json())const voiceId = '<voice-id>';
const sampleId = '<sample-id>';
const url = `https://api.inworld.ai/voices/v1/pvcVoices/${voiceId}/samples/${sampleId}?updateMask=trim_start_ms,trim_end_ms`;
const response = await fetch(url, {
method: 'PATCH',
headers: {
'Authorization': 'Basic <api-key>',
'Content-Type': 'application/json',
},
body: JSON.stringify({ trimStartMs: 1000, trimEndMs: 5000 }),
});
const data = await response.json();
console.log(data);{
"sampleId": "s_9f1c2e",
"name": "workspaces/your_workspace_id/pvcVoices/my-professional-voice/samples/s_9f1c2e",
"sizeBytes": 24883220,
"durationSecs": 312.4,
"mimeType": "audio/wav",
"hash": "<base64-gcs-md5>",
"trimStartMs": 1000,
"trimEndMs": 5000
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Trim a PVC voice sample
Sets (or clears) the trim boundaries used on a sample during training. Trimming does not modify or re-upload the underlying audio file — it only marks the range that training should use.
curl --location --request PATCH 'https://api.inworld.ai/voices/v1/pvcVoices/<voice-id>/samples/<sample-id>?updateMask=trim_start_ms,trim_end_ms' \
--header "Authorization: Basic $INWORLD_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"trimStartMs": 1000,
"trimEndMs": 5000
}'import requests
voice_id = "<voice-id>"
sample_id = "<sample-id>"
url = f"https://api.inworld.ai/voices/v1/pvcVoices/{voice_id}/samples/{sample_id}"
headers = {
"Authorization": "Basic <api-key>",
"Content-Type": "application/json"
}
params = {"updateMask": "trim_start_ms,trim_end_ms"}
payload = {"trimStartMs": 1000, "trimEndMs": 5000}
response = requests.patch(url, headers=headers, params=params, json=payload)
print(response.json())const voiceId = '<voice-id>';
const sampleId = '<sample-id>';
const url = `https://api.inworld.ai/voices/v1/pvcVoices/${voiceId}/samples/${sampleId}?updateMask=trim_start_ms,trim_end_ms`;
const response = await fetch(url, {
method: 'PATCH',
headers: {
'Authorization': 'Basic <api-key>',
'Content-Type': 'application/json',
},
body: JSON.stringify({ trimStartMs: 1000, trimEndMs: 5000 }),
});
const data = await response.json();
console.log(data);{
"sampleId": "s_9f1c2e",
"name": "workspaces/your_workspace_id/pvcVoices/my-professional-voice/samples/s_9f1c2e",
"sizeBytes": 24883220,
"durationSecs": 312.4,
"mimeType": "audio/wav",
"hash": "<base64-gcs-md5>",
"trimStartMs": 1000,
"trimEndMs": 5000
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}updateMask query parameter is required and uses snake_case field paths (for example: ?updateMask=trim_start_ms,trim_end_ms). To clear an existing trim and use the full sample again, include the field in updateMask and send null in the body:
{ "trimStartMs": null, "trimEndMs": null }
Authorizations
Your API key. Read permissions are required for GET endpoints. Write permissions are required for POST, PATCH, and DELETE endpoints.
For Basic authentication, please populate Basic $INWORLD_API_KEY. You can create a key in one command with the Inworld CLI: inworld workspace add-key.
Path Parameters
Voice ID that owns the sample.
Sample ID to trim, from the sampleId field returned by Upload PVC voice samples or Get a PVC voice.
Query Parameters
Comma-separated list of fields to update. Mask paths use snake_case field names, even though the request body uses camelCase: trim_start_ms, trim_end_ms. To clear an existing trim, include the field in the mask and send null (or omit it from the body).
"trim_start_ms,trim_end_ms"
Body
Request message for UpdatePvcVoiceSample. updateMask is required.
Offset in milliseconds, from the start of the sample, where the audio used for training begins. Include trim_start_ms (snake_case) in updateMask to apply this field; send null to clear it.
Offset in milliseconds, from the start of the sample, where the audio used for training ends. Include trim_end_ms (snake_case) in updateMask to apply this field; send null to clear it.
Response
A successful response.
A single uploaded audio sample belonging to a PVC voice.
Sample ID. Use this value as {sampleId} when trimming or deleting the sample.
Resource name. Format: workspaces/{workspace}/pvcVoices/{voice}/samples/{sample}.
Size of the uploaded file, in bytes.
Analyzed duration of the sample, in seconds, before any trim is applied.
Detected audio format, sniffed from the file's byte content.
audio/wav, audio/webm, audio/mpeg Base64-encoded MD5 of the stored object, for verifying upload integrity against the source file.
Trim start offset in milliseconds, if set.
Trim end offset in milliseconds, if set.