Passer à la navigation

Trim Audio

Prepare a new audio asset from the first durationSeconds of an audio file. Provide exactly one source: assetId or a sourceUrl for audio hosted in Sync storage that you can access. Returns 202 with the trim. Poll GET /v2/audio-trims/{id} until status is completed or failed. Use the completed assetId as an audio input to a generation. A source you cannot access returns 404. Unsupported sources can return 422 audio_trim_source_not_hosted or audio_trim_source_not_allowed. Each organization can have 4 trims in progress and start 60 per hour; requests beyond these limits return 429 audio_trim_rate_limited.

Authentification

x-api-keystring
Authentification par clé API via en-tête

En-têtes

Idempotency-KeystringRequis

Required. 1–128 characters matching [A-Za-z0-9._~-]+, scoped to your organization and the calling user or API key. Retrying with the same key and body returns the original trim; reusing the key with a different body returns 409.

Requête

This endpoint expects an object.
durationSecondsdoubleRequis

Length of the audio to keep from the start, in seconds (0.01–3600).

assetIdstringOptionnel
ID of a saved audio asset you can access.
sourceUrlstringOptionnel
URL of audio stored in sync. storage for your organization.
projectIdstringOptionnel
Project to add the trimmed audio asset to.

Réponse

Trim accepted.
idstring
Unique identifier for the trim.
statusenum
Status of an audio trim. Terminal states are completed and failed.
Valeurs autorisées:
retryAfterMsinteger
Milliseconds to wait before polling again. 0 once the trim is completed or failed.
assetIdstringOptionnel
ID of the trimmed audio asset. Null until status is completed.
durationSecondsdoubleOptionnel
Measured duration of the trimmed audio in seconds. Null until status is completed.
errorCodestringOptionnel

audio_trim_failed when status is failed; otherwise null.

Erreurs

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error
409
Conflict Error
422
Unprocessable Entity Error
429
Audio Trim Too Many Requests Error