AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How Developers Integrate the DeepBrain AI Studios REST API to Programmatically Generate Personalized Multi-Scene Avatar Videos

Zhou Jiajia · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Relying on human video editors to assemble bespoke welcome videos, dynamic billing explanations, or localized product walkthroughs in a web browser does not scale. When enterprise operations require generating tens of thousands of personalized videos populated from CRM databases, the web interface becomes an insurmountable bottleneck.

The DeepBrain AI Studios V3 REST API replaces manual timeline composition with a programmatic backend rendering pipeline. By interacting with the project creation endpoint (POST /api/odin/v3/editor/project), developers can dynamically construct complex multi-scene video timelines, bind digital avatars with synchronized speech scripts, insert personalized background graphics, and retrieve synthesized MP4 deliverables asynchronously.

At 365Finds, our engineering recommendation is decisive: treat the DeepBrain AI Studios REST API as an asynchronous job worker pipeline, never as a synchronous HTTP request. Video synthesis requires intense compute and queuing, typically taking between 1 and 10 minutes per video. Building your integration around asynchronous webhooks rather than blocking connections is mandatory for production reliability.


Architecture Overview: The Batch Video Pipeline

A resilient automated video production pipeline using DeepBrain AI connects your business systems to the AI Studios rendering engine through a decoupled event architecture:

[ CRM / Database Event ]
          │
          ▼
[ App Backend / Task Worker ] ──> Fetch Dynamic Assets (CDN images, personalized text)
          │
          ▼
[ POST /api/odin/v3/editor/project ] ──> DeepBrain AI Studios V3 Engine
          │ (Returns projectId immediately)
          ▼
[ Asynchronous Wait State ]
     ├── Preferred: DeepBrain Webhook pushes completion event to your endpoint
     └── Fallback: Worker polls GET /api/odin/v3/editor/progress/{projectId}
          │
          ▼
[ Download & Distribution ] ──> Store MP4 in cloud storage / Notify user via email or SMS

AI Studios Batch API vs. AI Human SDK

Before diving into code, clarify your operational goal:

If your objective is generating packaged video assets for users to watch on demand, the REST API is the exact tool required.


Step 1: Authentication and Prerequisites

To invoke the AI Studios V3 API, your account must meet two initial criteria:

  1. Plan Tier: An active Pro plan or higher with API access enabled.
  2. API Credentials: Generate your API key by logging into AI Studios V3, clicking on your account profile in the top-right corner, and navigating to API Key.

Copy your user token immediately upon creation; AI Studios will not display it a second time.

Target Domains

DeepBrain AI maintains distinct domain infrastructures:

All API requests require the following HTTP headers:

Authorization: YOUR_AI_STUDIOS_API_KEY
Content-Type: application/json

Step 2: Constructing the Multi-Scene Payload (POST /api/odin/v3/editor/project)

The project creation endpoint accepts a comprehensive JSON manifest describing every scene, visual layer, avatar binding, and speech script.

Endpoint Definition

The Scene Object Schema

Each entry in the scenes array requires:

  1. sceneIdx (integer): Zero-based sequence index (0, 1, 2, ...).
  2. background (object): Details the background fill color or image URL.
  3. watermark (boolean): Toggle platform branding.
  4. clips (array of objects): Visual and audio layers, including aiModel (the digital avatar), image, shape, or audio.
  5. scripts (array of objects): Voice generation instructions.

The Critical Model Binding Rule

A frequent pitfall developers face is script desynchronization. In the V3 API, every speech script in scenes[].scripts[] must strictly match the avatar clip in scenes[].clips[]:


Step 3: Complete Multi-Scene Integration Example

Below is a production-ready Node.js script demonstrating how to generate a two-scene personalized video:

import fetch from "node-fetch";

const API_KEY = process.env.DEEPBRAIN_API_KEY;
const BASE_URL = "https://app.aistudios.com";

async function createPersonalizedVideo(userData) {
  const payload = {
    name: `Personalized_Onboarding_${userData.userId}`,
    orientation: "landscape",
    resolution: "1080",
    isExport: true,
    webhookUrl: "https://api.yourdomain.com/webhooks/deepbrain-complete",
    scenes: [
      {
        sceneIdx: 0,
        background: {
          id: "background-0",
          type: "background",
          source_type: "image",
          source_url: userData.welcomeBackgroundUrl,
          source_color: "rgb(255,255,255)"
        },
        watermark: false,
        scripts: [
          {
            org: `Welcome aboard, ${userData.firstName}! We are excited to partner with ${userData.companyName}. Let us quickly review your workspace configuration.`,
            isTTS: false,
            tts: null,
            modelId: "M000045058",
            clothId: "BG00002320"
          }
        ],
        clips: [
          {
            id: "avatar-scene-0",
            type: "aiModel",
            layer: 2,
            top: 146.74,
            left: 630.25,
            height: 2229,
            width: 679,
            scaleX: 1,
            scaleY: 1,
            model: {
              ai_name: "M000045058",
              emotion: "BG00002320",
              language: "en"
            }
          }
        ]
      },
      {
        sceneIdx: 1,
        background: {
          id: "background-1",
          type: "background",
          source_type: "image",
          source_url: "https://cdn.yourdomain.com/templates/dashboard_slide.png",
          source_color: "rgb(240,242,245)"
        },
        watermark: false,
        scripts: [
          {
            org: `Your dedicated compute tier is active with ${userData.allocatedCredits} credits available. You can launch your initial pipelines right from the admin dashboard.`,
            isTTS: false,
            tts: null,
            modelId: "M000045058",
            clothId: "BG00002320"
          }
        ],
        clips: [
          {
            id: "avatar-scene-1",
            type: "aiModel",
            layer: 2,
            top: 146.74,
            left: 100.0,
            height: 2229,
            width: 679,
            scaleX: 0.9,
            scaleY: 0.9,
            model: {
              ai_name: "M000045058",
              emotion: "BG00002320",
              language: "en"
            }
          },
          {
            id: "chart-overlay",
            type: "image",
            layer: 1,
            top: 200.0,
            left: 700.0,
            width: 1100,
            height: 650,
            scaleX: 1,
            scaleY: 1,
            source_url: userData.userChartUrl
          }
        ]
      }
    ]
  };

  const response = await fetch(`${BASE_URL}/api/odin/v3/editor/project`, {
    method: "POST",
    headers: {
      "Authorization": API_KEY,
      "Content-Type": "application/json"
    },
    body: JSON.stringify(payload)
  });

  const result = await response.json();
  if (!result.success) {
    throw new Error(`AI Studios project initiation failed: ${JSON.stringify(result)}`);
  }

  // Returns project identifier: result.data.projectId
  console.log(`Video render queued successfully. Project ID: ${result.data.projectId}`);
  return result.data.projectId;
}

Step 4: Tracking Synthesis Progress & Retrieving Video URLs

Once the project is submitted with isExport: true, the rendering engine generates the video asset asynchronously. You have two mechanisms to track status:

Method A: Webhooks (Strongly Recommended by 365Finds)

Configuring webhookUrl in the creation payload eliminates unnecessary API polling overhead. When rendering completes, DeepBrain AI sends an HTTP POST request to your specified endpoint with the following payload format:

{
  "progress": 100,
  "credit": 2,
  "backendTaskId": "65b2f1a...",
  "download_url": "https://cdn.aistudios.com/exports/Personalized_Onboarding_98234.mp4"
}

Your webhook handler can instantly save download_url, record the credit consumption to internal auditing tables, and dispatch notification emails to your end customers.

Method B: Polling via GET /api/odin/v3/editor/progress/${projectKey}

If webhooks cannot be received due to firewalls or staging environment constraints, poll the progress endpoint with an exponential or 5-second interval backoff:

async function waitForVideoRender(projectId, timeoutMinutes = 15) {
  const startTime = Date.now();
  const pollIntervalMs = 5000;

  while (Date.now() - startTime < timeoutMinutes * 60 * 1000) {
    const res = await fetch(`${BASE_URL}/api/odin/v3/editor/progress/${projectId}`, {
      method: "GET",
      headers: {
        "Authorization": API_KEY,
        "Content-Type": "application/json"
      }
    });

    const body = await res.json();
    if (!body.success) {
      throw new Error(`Progress query error: ${JSON.stringify(body)}`);
    }

    const { progress, downloadUrl } = body.data;
    console.log(`Rendering project ${projectId}: ${progress}% completed`);

    if (progress >= 100 && downloadUrl) {
      console.log(`Render complete! Download URL: ${downloadUrl}`);
      return downloadUrl;
    }

    await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
  }

  throw new Error(`Rendering timed out after ${timeoutMinutes} minutes.`);
}

Production Trade-offs and Best Practices

Architecture ComponentRecommended ApproachPitfalls to Avoid
Template EngineeringBuild a baseline template inside the AI Studios web editor, inspect/export its JSON structure, and programmatically alter only dynamic text and image URLs.Hand-coding nested clip coordinates, transforms, and bounding boxes from scratch without visual calibration.
Model & Voice MatchingQuery GET /api/odin/v3/dropdown/models to store valid IDs; guarantee modelId and clothId in scripts match ai_name and emotion in clips.Mixing up avatar IDs, causing the synthesis engine to fail silently or render a default character.
Asset AvailabilityEnsure all image, logo, and background URLs passed to source_url are publicly accessible over HTTPS with fast CDN delivery.Passing authenticated S3 pre-signed URLs with expiring query parameters or localhost URLs.
Throughput & ConcurrencyUse background message queues (such as BullMQ, Celery, or AWS SQS) with concurrency governors matching your plan tier rate limits.Firing thousands of concurrent synchronous API calls directly from customer-facing web workers.

The 365Finds Verdict

DeepBrain AI Studios V3 provides one of the most mature, high-fidelity avatar rendering engines on the commercial market. Its REST API offers exceptional programmatic control over multi-scene transitions, avatar positioning, and audio synthesis.

However, teams must be prepared for the verbosity of its clip layout JSON schema. We strongly recommend that development teams establish a template extraction workflow: design visual compositions once in the web GUI, extract the clean JSON payload, and use template injection scripts in production to substitute user-specific variables. Paired with webhook callbacks, this pattern establishes an automated, highly reliable video factory.


References