Start Generation - Beeble API Documentation

Start Generation

cURL

curl --request POST \
  --url https://api.beeble.ai/v1/switchx/generations \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "source_uri": "<string>",
  "prompt": "<string>",
  "reference_image_uri": "<string>",
  "alpha_uri": "<string>",
  "alpha_keyframe_index": 12,
  "seed": 2147483647,
  "max_resolution": 1080,
  "callback_url": "<string>",
  "idempotency_key": "<string>"
}
'

Python Example

import requests

url = "https://api.beeble.ai/v1/switchx/generations"

payload = {
    "source_uri": "<string>",
    "prompt": "<string>",
    "reference_image_uri": "<string>",
    "alpha_uri": "<string>",
    "alpha_keyframe_index": 12,
    "seed": 2147483647,
    "max_resolution": 1080,
    "callback_url": "<string>",
    "idempotency_key": "<string>"
}
headers = {
    "x-api-key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

JavaScript Example

const options = {
  method: 'POST',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    source_uri: '<string>',
    prompt: '<string>',
    reference_image_uri: '<string>',
    alpha_uri: '<string>',
    alpha_keyframe_index: 12,
    seed: 2147483647,
    max_resolution: 1080,
    callback_url: '<string>',
    idempotency_key: '<string>'
  })
};

fetch('https://api.beeble.ai/v1/switchx/generations', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP Example

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.beeble.ai/v1/switchx/generations",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'source_uri' => '<string>',
    'prompt' => '<string>',
    'reference_image_uri' => '<string>',
    'alpha_uri' => '<string>',
    'alpha_keyframe_index' => 12,
    'seed' => 2147483647,
    'max_resolution' => 1080,
    'callback_url' => '<string>',
    'idempotency_key' => '<string>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "x-api-key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>

Golang Example

package main

import (
    "fmt"
    "strings"
    "net/http"
    "io"
)

func main() {

url := "https://api.beeble.ai/v1/switchx/generations"

payload := strings.NewReader("{\n  \"source_uri\": \"<string>\",\n  \"prompt\": \"<string>\",\n  \"reference_image_uri\": \"<string>\",\n  \"alpha_uri\": \"<string>\",\n  \"alpha_keyframe_index\": 12,\n  \"seed\": 2147483647,\n  \"max_resolution\": 1080,\n  \"callback_url\": \"<string>\",\n  \"idempotency_key\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
    req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}

Response Structure

{
  "id": "<string>",
  "status": "<string>",
  "progress": 72,
  "generation_type": "<string>",
  "alpha_mode": "<string>",
  "output": {
    "render": "<string>",
    "source": "<string>",
    "alpha": "<string>"
  },
  "seed": 123,
  "error": "<string>",
  "created_at": "<string>",
  "modified_at": "<string>",
  "completed_at": "<string>",
  "webhook": {
    "status": "<string>",
    "attempts": 1,
    "last_error": "<string>"
  }
}