Delete the stored media for a completed job
const url = 'https://api.bayle.ai/video/complete';const options = { method: 'POST', headers: { 'Accept-Language': 'pt-BR', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"model":"seedance-2-0-mini-text-to-video-basic","queue_id":"01a07f13-21eb-712a-92bf-b437f83c5b47"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.bayle.ai/video/complete \ --header 'Accept-Language: pt-BR' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "seedance-2-0-mini-text-to-video-basic", "queue_id": "01a07f13-21eb-712a-92bf-b437f83c5b47" }'Releases the media stored for a finished job. Send the model and the queue_id the job was queued with.
Bayle keeps no record of a queue_id, so calling this twice on the same job is answered on its merits rather than short-circuited.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Example
pt-BRChooses the language of any error message in this request’s response. A tag beginning with the two letters pt, in any case, selects Brazilian Portuguese; anything else, including an absent header, selects English. The tag may appear anywhere in a multi-tag header, for example fr-FR;q=0.9,pt;q=0.5,en;q=0.3. Quality values are accepted but ignored, since this is a presence check rather than weighted negotiation.
Request Bodyrequired
Section titled “Request Bodyrequired”The complete request. Any field not listed here is forwarded as sent.
object
The model the job was queued with.
The identifier returned by POST /video/queue.
Example
{ "model": "seedance-2-0-mini-text-to-video-basic", "queue_id": "01a07f13-21eb-712a-92bf-b437f83c5b47"}Responses
Section titled “Responses”The stored media was released.
One caveat worth designing around: for a model that delivers the finished video inline as the video/mp4 body of a completed POST /video/retrieve call, rather than through a persisted download_url, there may be no stored media left to release by the time this call is made. Such a call can return a 400 reporting the job as not found. If you are using an inline-delivery model, do not assume this call succeeds after a retrieve that already returned the video bytes.
object
Whether the release succeeded, for models that return a body on this call.
Example
{ "success": true}Headers
Section titled “Headers”Confirms which of the two supported locales, en or pt-BR, this response was rendered in, so a caller can detect it without reading the message text. Present on every response, success and error alike. On a chat completions stream it is committed together with the initial 200, so it appears whichever way the stream ends.
No credential was supplied, or the credential supplied is not valid. The request is rejected before any generation work begins. The body uses the shared error envelope, rendered in the negotiated locale.
Bayle’s OpenAI-shaped error envelope, shared by every error response this API returns.
object
object
A human-readable description of the failure, in the negotiated locale. See the Accept-Language request parameter for how that locale is chosen, and the Content-Language response header for which one was served.
OpenAI’s error type vocabulary, for example api_error, authentication_error, invalid_request_error, or rate_limit_error, matching the class of failure so an OpenAI SDK’s exception mapping keeps working.
The request field the failure names, when it names one. Null when the failure is not field-specific, as with authentication or rate limiting.
Bayle’s semantic error code, reusing OpenAI’s vocabulary where an equivalent exists, for example invalid_api_key or rate_limit_exceeded. Null when Bayle could not identify the specific failure; the envelope is still valid and carries a generic message. The full list lives in Bayle’s error reference rather than being enumerated here.
Examples
English (default)
{ "error": { "message": "Your Bayle API key is missing or could not be verified.", "type": "authentication_error", "param": null, "code": "invalid_api_key" }}Brazilian Portuguese (`Accept-Language: pt-BR`)
{ "error": { "message": "Sua chave de API da Bayle está ausente ou não pôde ser verificada.", "type": "authentication_error", "param": null, "code": "invalid_api_key" }}Headers
Section titled “Headers”Confirms which of the two supported locales, en or pt-BR, this response was rendered in, so a caller can detect it without reading the message text. Present on every response, success and error alike. On a chat completions stream it is committed together with the initial 200, so it appears whichever way the stream ends.
default
Section titled “default”The request failed. The body uses the shared error envelope, rendered in the locale negotiated through Accept-Language. type and code identify the specific failure when Bayle recognizes it, and fall back to type: api_error with a null code when it does not. Where a failure carries a meaningful status code, Bayle preserves it; a transport failure, such as a timeout or a refused connection, is reported as 502. The exception is an operation that documents its own time limit, which reports running past it as 504 with the request_timeout code.
Bayle’s OpenAI-shaped error envelope, shared by every error response this API returns.
object
object
A human-readable description of the failure, in the negotiated locale. See the Accept-Language request parameter for how that locale is chosen, and the Content-Language response header for which one was served.
OpenAI’s error type vocabulary, for example api_error, authentication_error, invalid_request_error, or rate_limit_error, matching the class of failure so an OpenAI SDK’s exception mapping keeps working.
The request field the failure names, when it names one. Null when the failure is not field-specific, as with authentication or rate limiting.
Bayle’s semantic error code, reusing OpenAI’s vocabulary where an equivalent exists, for example invalid_api_key or rate_limit_exceeded. Null when Bayle could not identify the specific failure; the envelope is still valid and carries a generic message. The full list lives in Bayle’s error reference rather than being enumerated here.
Examples
400: a missing or invalid parameter, for example an unknown `type` on `GET /models`, no `input` on `POST /embeddings`, `n` above 1 or an unlisted `size` on `POST /images/generations`, a numeric or unlisted `duration` on the video endpoints, or no `queue_id`
{ "error": { "message": "Bayle could not process this request because one or more parameters are invalid.", "type": "invalid_request_error", "param": null, "code": "invalid_request" }}404: a `model` that does not exist
{ "error": { "message": "The upstream model provider could not complete this request. Please try again.", "type": "api_error", "param": null, "code": null }}400: `POST /video/retrieve` or `POST /video/complete` with a `queue_id` that matches no job
{ "error": { "message": "Bayle could not find a request matching the given request ID.", "type": "invalid_request_error", "param": "request_id", "code": "request_id_not_found" }}402: the key's balance is exhausted
{ "error": { "message": "Your Bayle account does not have enough balance to complete this request.", "type": "insufficient_quota", "param": null, "code": "insufficient_quota" }}422: a prompt the content policy does not permit
{ "error": { "message": "Bayle's content policy does not permit this prompt.", "type": "invalid_request_error", "param": null, "code": "content_policy_violation" }}429: too many requests
{ "error": { "message": "You have exceeded the rate limit for Bayle's API.", "type": "rate_limit_error", "param": null, "code": "rate_limit_exceeded" }}500: the model could not complete the request, for example an embedding `dimensions` the model cannot produce
{ "error": { "message": "Bayle could not complete inference for this request.", "type": "api_error", "param": null, "code": "inference_failed" }}504: an image generation still running after four minutes
{ "error": { "message": "This request took too long to complete on Bayle and was timed out. For long-running requests, use streaming.", "type": "api_error", "param": null, "code": "request_timeout" }}Headers
Section titled “Headers”Confirms which of the two supported locales, en or pt-BR, this response was rendered in, so a caller can detect it without reading the message text. Present on every response, success and error alike. On a chat completions stream it is committed together with the initial 200, so it appears whichever way the stream ends.