Saltar a la navegación

Trim Audio

Make a new audio asset from the first durationSeconds of an audio file. Send exactly one source: assetId, or a sourceUrl for audio in Sync storage that you can access. Returns 202; poll GET /v2/audio-trims/{id} until status is completed or failed. If it’s completed, use its assetId as an audio input to a generation.

Each organization can run 4 trims at once and start 60 per hour. A source you can’t access returns 404. Other error codes are in Error Handling.

Autenticación

x-api-keystring
Autenticación con clave API vía encabezado

Encabezados

Idempotency-KeystringRequerido

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.

Solicitud

This endpoint expects an object.
durationSecondsdoubleRequerido

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

assetIdstringOpcional
ID of a saved audio asset you can access.
sourceUrlstringOpcional
URL of audio stored in sync. storage for your organization.
projectIdstringOpcional
Project to add the trimmed audio asset to.

Respuesta

Trim accepted.
idstring
Unique identifier for the trim.
statusenum
Status of an audio trim. Terminal states are completed and failed.
Valores permitidos:
retryAfterMsinteger
Milliseconds to wait before polling again. 0 once the trim is completed or failed.
assetIdstringOpcional
ID of the trimmed audio asset. Null until status is completed.
durationSecondsdoubleOpcional
Measured duration of the trimmed audio in seconds. Null until status is completed.
errorCodestringOpcional

audio_trim_failed when status is failed; otherwise null.

Errores

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