POST /v1/videos: create a video job
POST /v1/videos is the endpoint to create a video job. One endpoint, several modes: image to video (image, optional last_frame), text to video (prompt, optional reference_images or assets), motion transfer (motion_video), extend (extend_video), and talking videos (voice + script, or your own audio) at 720p. resolution 1080p or 2160p is priced from a live quote: send max_credits or dry_run: true first. Answers 202 with a queued job.
At a glance
- Endpoint
POST /v1/videos- Base URL
https://bobabanana.com/api/v1- Auth
Authorization: Bearer bb_...- Success
202(or200withdry_run: true)- Safe to retry
- yes, with an
Idempotency-Keyheader - Guide
- Videos
Request#
Headers#
| Header | Required | Description |
|---|---|---|
Authorization |
yes | Bearer bb_...: your API key (or send X-API-Key: bb_...) |
Content-Type |
yes | application/json |
idempotency-key |
no | Any unique string up to 255 characters (a UUID is ideal). A retry with the same key and the same body within 24 hours returns the first job instead of making a second one; the same key with a different body is 422 idempotency_key_reused. |
Body (JSON)#
| Field | Type | Required | Default | Limits | Description |
|---|---|---|---|---|---|
webhook_url |
string | no | 0 to 500 characters | https:// URL that receives a signed POST when the job finishes | |
metadata |
object of string | no | at most 16 keys | Up to 16 keys (40 characters each) with string values (500 characters each), echoed back on the job and its webhook | |
name |
string | no | 0 to 80 characters | Label shown in the BobaBanana studio | |
max_credits |
integer | no | at least 0 | Refuse the job (400 cost_above_max, nothing held) if it would cost more than this | |
dry_run |
boolean | no | false |
true: answer 200 with what the job would cost (credits_estimate) and make nothing: nothing is queued, held or stored, and no Idempotency-Key is used | |
prompt |
string | no | 0 to 1500 characters | The scene. Used to make the first frame when no image is given, and as the motion prompt when motion is empty. | |
image |
string or Media | no | Start frame to animate. If omitted, a first frame is generated from prompt + references. | ||
last_frame |
string or Media | no | Last frame: the video moves from the first frame to this picture. Priced as a first + last frame video. | ||
extend_video |
string or Media | no | Extend a clip: an mp4, mov or webm video of 15 seconds at most (url, or data up to about 25 MB). Its last frame becomes the start frame. Instead of image; priced as plain video unless last_frame is given. | ||
motion_video |
string or Media | no | Motion transfer: a clip whose motion, performance and camera move are copied onto the subject in 'image' (or one asset in 'assets'). An mp4 or mov (H.264 or H.265), 1-15 seconds, 23.976-60 fps, each side at least 256 px, at most 50 MB (url, or data up to about 25 MB). The video is as long as the clip; duration_seconds is ignored. Made in the studio when it can be made in time, else with premium rendering; check cost.credits_estimate (the most it costs) or send max_credits. | ||
match_pose |
boolean | no | true |
Motion transfer only: first redraw the subject in the poses, framing and shape of the clip's opening, middle and closing frames (the opening frame only for clips under 2 s; one opening-frame picture when the studio makes it; each a picture step at the picture price), and guide the video with those pictures. false sends the subject as it is (then only premium rendering can make it). | |
keep_sound |
boolean | no | true |
Motion transfer only: put the clip's own sound on the result when the clip has sound. | |
first_shot_only |
boolean | no | false |
Motion transfer only: when the clip has cuts (several scenes), make only its first shot, at the normal price of a clip that long. Without it every scene is made and joined under the clip's own sound, at 1.5x the normal price (see POST /v1/videos/estimate). | |
reference_images |
list of string or Media | no | at most 10 items | ||
assets |
list of string | no | at most 10 items | ||
motion |
string | no | 0 to 400 characters | How things move, e.g. 'slow push-in, she turns and smiles' | |
duration_seconds |
number | no | 5 |
2 to 15 | 2-10 s at 720p; 3-15 s at 1080p and 2160p (10 s at most with last_frame) |
aspect_ratio |
one of 16:9, 9:16, 1:1, 4:3, 3:4 |
no | "16:9" |
||
resolution |
one of 720p, 1080p, 2160p |
no | "720p" |
720p (standard), 1080p or 2160p (4K, made with premium rendering and priced from its live quote; 16:9 or 9:16; no voice or audio). Check cost.credits_estimate, or send max_credits. | |
voice |
string or VoiceSample | no | Voice to speak the script: '@handle' of a saved voice, or a sample to clone | ||
voice_consent |
boolean | no | false |
Required with an uploaded voice sample | |
script |
string | no | 0 to 600 characters | Words the character says, lip-synced | |
audio |
string or Media | no | Pre-recorded speech or soundtrack that drives the clip (instead of voice + script) | ||
sound_effect |
SoundEffect | no |
Example request#
Image to video:
curl https://bobabanana.com/api/v1/videos \
-H "Authorization: Bearer $BOBABANANA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"image": {
"url": "https://example.com/maya.png"
},
"motion": "slow push-in, she turns and smiles",
"duration_seconds": 6,
"aspect_ratio": "9:16"
}'
import os
import uuid
import requests
r = requests.post(
"https://bobabanana.com/api/v1/videos",
headers={"Authorization": f"Bearer {os.environ['BOBABANANA_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
json={
"image": {
"url": "https://example.com/maya.png",
},
"motion": "slow push-in, she turns and smiles",
"duration_seconds": 6,
"aspect_ratio": "9:16",
},
timeout=60,
)
r.raise_for_status()
print(r.json())
const res = await fetch("https://bobabanana.com/api/v1/videos", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.BOBABANANA_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
"image": {
"url": "https://example.com/maya.png"
},
"motion": "slow push-in, she turns and smiles",
"duration_seconds": 6,
"aspect_ratio": "9:16"
}),
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
console.log(await res.json());
More request bodies#
Image to video with a last frame (last_frame):
{
"image": {
"file_id": "file_3f9c2a1b7d4e"
},
"last_frame": {
"url": "https://example.com/sofa-closeup.png"
},
"motion": "the camera glides from the room to a close-up of the sofa",
"duration_seconds": 5
}
Text to video with references (text_with_refs):
{
"prompt": "@maya walks through a rainy neon street at night",
"assets": [
"@maya"
],
"motion": "tracking shot, she looks over her shoulder",
"duration_seconds": 8,
"aspect_ratio": "16:9"
}
Talking video in a cloned voice (talking_cloned_voice):
{
"image": {
"url": "https://example.com/presenter.png"
},
"motion": "she talks to the camera, small natural gestures",
"voice": {
"url": "https://example.com/my-voice.wav",
"transcript": "Hi, this is a short sample of my voice for cloning."
},
"voice_consent": true,
"script": "Welcome back! Today I will show you three quick tips.",
"duration_seconds": 6
}
Saved voice and a sound effect (saved_voice_sfx):
{
"prompt": "@captain_fox on the deck of a ship in a storm",
"assets": [
"@captain_fox"
],
"motion": "he grips the wheel and shouts",
"voice": "@storyteller",
"script": "Hold on, everyone!",
"sound_effect": {
"prompt": "storm wind and crashing waves",
"duration_seconds": 6
},
"duration_seconds": 6
}
Driven by your own audio (own_audio):
{
"image": {
"url": "https://example.com/singer.png"
},
"audio": {
"url": "https://example.com/line.mp3"
},
"motion": "she sings to the camera",
"duration_seconds": 8
}
Motion transfer (motion_transfer):
{
"image": {
"url": "https://example.com/maya.png"
},
"motion_video": {
"url": "https://example.com/dance.mp4"
},
"prompt": "she dances in a sunny studio",
"max_credits": 200
}
Extend a clip (extend):
{
"extend_video": {
"url": "https://example.com/clip.mp4"
},
"prompt": "the camera keeps rising above the city",
"duration_seconds": 5
}
1080p or 4K with a cost cap (uhd):
{
"image": {
"url": "https://example.com/car.png"
},
"motion": "slow orbit around the car",
"resolution": "2160p",
"aspect_ratio": "16:9",
"duration_seconds": 8,
"max_credits": 400
}
Price it first, make nothing (dry_run):
{
"image": {
"url": "https://example.com/car.png"
},
"motion": "slow orbit around the car",
"resolution": "1080p",
"duration_seconds": 8,
"dry_run": true
}
Response#
200 (DryRunEstimate): dry_run: true: the price of this request. Nothing is queued, held or stored.
{
"object": "estimate",
"dry_run": true,
"type": "video",
"credits_estimate": 120,
"credits_available": 950,
"enough_credits": true,
"billing_mode": "credits",
"video_price_key": "video_1080",
"resolution": "1080p"
}
202 (Job): Successful Response
{
"id": "x_5b70e2d9c4a1",
"object": "job",
"type": "video",
"status": "queued",
"created": 1764950400,
"input": {
"image": {
"file_id": "file_9e1d4c7a2b30"
},
"motion": "slow push-in, she turns and smiles",
"duration_seconds": 6,
"aspect_ratio": "9:16",
"resolution": "720p"
},
"output": {},
"eta_seconds": 240,
"poll_after_seconds": 30,
"cost": {
"credits_estimate": 18,
"credits_charged": 0,
"credits_released": 0,
"status": "held",
"video_price_key": "video",
"resolution": "720p"
}
}
Errors#
Errors use the error object. The codes this endpoint can return (what to do about each is in Error codes):
| Status | Code | Meaning |
|---|---|---|
| 400 | bad_request |
The Content-Length header is not a number. |
| 400 | cost_above_max |
The job would cost more than max_credits. credits_estimate gives the price. |
| 400 | fetch_failed |
Downloading a URL input failed or returned an HTTP error. |
| 400 | fetch_timeout |
Downloading a URL input took too long. |
| 400 | file_too_large |
A file or inline data is over its size limit. |
| 400 | invalid_audio |
The audio could not be read. |
| 400 | invalid_base64 |
data is not valid base64. |
| 400 | invalid_image |
The image could not be opened, or it has too many pixels. |
| 400 | invalid_metadata |
metadata has more than 16 keys, a key over 40 characters or a value over 500. |
| 400 | invalid_request |
A field is missing, has the wrong type or breaks a rule. param names the field. Type and range problems found while reading the body are 422 with the same code. |
| 400 | invalid_url |
The URL is not https://, its host cannot be found, or it points to a private address. |
| 400 | invalid_video |
The video could not be read, or it breaks a clip rule (length, frame rate, size). |
| 400 | invalid_voice_sample |
The voice sample is too short or too long. |
| 400 | motion_scenes |
The motion clip has more scenes than can be made, or a scene is too short. |
| 400 | motion_unavailable |
A motion transfer cannot be made for this request right now. |
| 400 | resolution_unavailable |
1080p or 4K cannot be made for this request or workspace right now. |
| 400 | too_many_references |
More than 10 reference pictures in total (a character asset counts as two). |
| 400 | unsupported_file |
The file is not a supported image, audio or video format. |
| 400 | voice_consent_required |
A voice sample was sent without voice_consent: true. |
| 400 | wrong_asset_kind |
The asset is the wrong kind for this field (for example a voice used as a picture). |
| 400 | wrong_file_type |
An image was given where audio is needed, or the other way round. |
| 401 | invalid_api_key |
The key is wrong, revoked or belongs to no workspace. |
| 401 | missing_api_key |
No API key was sent. |
| 402 | insufficient_credits |
The workspace's available credits are less than the job's estimate. required and available give both numbers. |
| 403 | workspace_suspended |
The workspace that owns the key is suspended. |
| 404 | asset_not_found |
No approved library asset with this @handle or id. |
| 404 | file_not_found |
No live upload with this id in the workspace (expired or deleted). |
| 409 | asset_not_ready |
The asset has no approved version yet. |
| 409 | idempotency_in_progress |
A request with this Idempotency-Key is still being processed. Retry-After: 5 s. |
| 413 | too_large |
The request body is over the limit for this endpoint (JSON bodies 100 MB, uploads 64 MB). |
| 422 | idempotency_key_reused |
This Idempotency-Key was already used with a different request. |
| 422 | invalid_json |
The body is not valid JSON. |
| 429 | daily_limit_reached |
This key has used its jobs for the last 24 hours. Retry-After: 3600 s. |
| 429 | network_busy |
Every download slot is busy. Retry-After: 5 s. |
| 429 | queue_full |
The workspace has too many steps waiting. |
| 429 | too_many_active_jobs |
This key already has its maximum of unfinished jobs. Retry-After: 30 s. |
| 429 | too_many_attempts |
Too many requests with wrong keys came from your address. Retry-After is set. |
| 429 | too_many_downloads |
Two URL inputs are already being downloaded for this workspace. Retry-After: 10 s. |
| 500 | internal_error |
Something went wrong on our side. |
| 503 | engine_unavailable |
This kind of generation is not available right now. Retry-After: 300 s. |
| 503 | maintenance |
BobaBanana is being updated; changes are paused for a few minutes. Reads still work. Retry-After is set. |
| 507 | storage_quota_exceeded |
The workspace has used its storage. |
Related#
- Guide: Videos
- All endpoints
- Objects
- Error codes