Scaling video production from manual studio editing to programmatic generation is a critical milestone for modern growth and technical teams. Delivering dynamic, personalized avatar videos—such as customized SaaS onboarding welcomes, milestone achievements, or personalized sales pitch summaries—boosts user engagement dramatically. However, clicking buttons inside a browser-based creative suite fails the moment user sign-ups reach hundreds or thousands per day.
To solve this operational bottleneck, Elai.io provides a robust REST API and webhook infrastructure designed to run headless video pipelines. At 365Finds, our research indicates that building an enterprise-grade automated pipeline on Elai.io requires more than firing simple HTTP POST requests. Because video rendering is computationally heavy, Elai.io adopts an asynchronous, fire-and-forget architecture. Developers must master exact JSON slide composition, implement bulletproof webhook receivers with HMAC signature verification, and build a hybrid reconciliation loop to guard against dropped events and rolling quota constraints.
Here is 365Finds' definitive technical blueprint for integrating the Elai.io API and webhooks into high-throughput production environments.
Architectural Pathways: Template Batching vs. Headless Canvas Assembly
When automating video creation in Elai.io, developers face a foundational architectural choice between two distinct API strategies:
┌───────────────────────────────────────┐
│ Dynamic Business Data / User Profiles │
└──────────────────┬────────────────────┘
│
┌───────────────────────┴───────────────────────┐
│ │
▼ ▼
[Approach A: Template Batch] [Approach B: Headless Canvas]
POST /videos/renderTemplate/{id} POST /videos
- Visual layout built in studio - Programmatic JSON slide composition
- Dynamic tag substitution ({{name}}) - Dynamic avatar, voice, and canvas math
- Up to 200 items per request - POST /videos/render/{id} trigger
│ │
└───────────────────────┬───────────────────────┘
│
▼
┌───────────────────────────────────────┐
│ Elai.io Render Cluster │
│ (Asynchronous Fire-and-Forget 200) │
└──────────────────┬────────────────────┘
│
Webhook Callback│(POST, 10s timeout)
▼
┌───────────────────────────────────────┐
│ Ingestion Gateway / Buffer Queue │
│ - HMAC-SHA256 Raw Body Check │
│ - Immediate 200 OK (< 50ms) │
│ - Push to BullMQ / SQS Worker │
└──────────────────┬────────────────────┘
│
▼
┌───────────────────────────────────────┐
│ Downstream Delivery & Media CDN Sync │
└───────────────────────────────────────┘
1. Approach A: Template Personalization (POST /videos/renderTemplate/{videoId})
- How it works: You design a master video in the Elai.io web editor with variable tags enclosed in double curly brackets, such as
{{firstName}}in the speech script or text boxes, and identify media elements by their sidebar API IDs. Your server sends an array of up to 200 key-value objects intemplateData. - Best suited for: Marketing outreach, standardized customer onboarding, and dynamic text/image swaps where visual styling remains uniform.
- 365Finds Verdict: Approach A is our primary institutional recommendation for 90% of business applications. It allows creative and marketing teams to tweak visual layouts in the UI without requiring full-stack engineers to redeploy backend coordinate math.
2. Approach B: Programmatic Headless Assembly (POST /videos + POST /videos/render/{videoId})
- How it works: Your backend dynamically builds the complete JSON document—defining canvas objects, Fabric.js coordinates, avatar models, voice synthesis engines, and timing parameters from scratch. The video document is created in
draftstatus, and a subsequent call triggers the rendering process. - Best suited for: Highly variable programmatic slide decks, dynamically generated analytical charts, multi-avatar dialogues with varying scene counts, and headless SaaS white-label products.
| Dimension | Template Personalization (/renderTemplate) | Headless Assembly (/videos) |
|---|---|---|
| Primary Endpoint | POST /api/v1/videos/renderTemplate/{videoId} | POST /api/v1/videos followed by /videos/render/{id} |
| Batch Capacity | Up to 200 rows per request | 1 video document per request |
| Layout Control | Managed visually in Elai Builder | Programmed in JSON via Fabric.js objects |
| Development Complexity | Low to moderate; JSON tag mapping | High; requires exact canvas math and schema handling |
| Maintenance Burden | Low; visual updates require no code changes | High; slide coordinate changes require code updates |
Authentication and Workspace Prerequisites
All calls to the Elai.io API operate under the base URL:
https://apis.elai.io/api/v1
1. Bearer Token Provisioning
Authentication is handled via HTTP Bearer tokens in the Authorization header:
Authorization: Bearer <YOUR_API_TOKEN>
Accept: application/json
Content-Type: application/json
Workspace administrators can generate, rotate, or revoke keys under Settings → API in the Elai.io web application, or programmatically via POST /generateToken. Note that tokens are bound to the workspace administrator and carry full workspace privileges.
2. The Unlimited Plan API Gotcha
365Finds highlights a critical documentation detail: organizations on Elai.io's Unlimited plan cannot access the REST API. API requests made with tokens from an Unlimited workspace are rejected with a bare HTTP 401 Unauthorized without a JSON error body. If a freshly generated admin token consistently returns 401, verify that your workspace is on a Creator, Team, or Enterprise plan before troubleshooting network headers.
Constructing the Multi-Slide Dynamic JSON Payload
When implementing Approach B via POST /api/v1/videos, you must provide a valid slides array and video configuration. Elai.io uses Fabric.js (v4.4.0) under the hood for canvas rendering.
Key Payload Rules
- Slide and Canvas Object IDs: Every slide must have a unique numeric integer
id. Withincanvas.objects, every visual element must also feature an integerid. - Avatar Specification: An avatar must be defined in two complementary places per slide:
avatar: A high-level object containingcode(formatted as{avatarCode}.{variantCode}, e.g.,gia.casualordylan.casual),gender, and thumbnailcanvasURL.canvas.objects: Exactly one object with"type": "avatar", providing spatial coordinates (top,left,scaleX,scaleY,avatarType: "transparent").
- Canvas Scaling Math: To position and scale the avatar accurately on a standard 1080p canvas, use Elai's editor conversion formula: $$\text{scaleY} = \frac{360}{1080} \times \text{targetHeightRatio}$$ $$\text{scaleX} = \frac{640}{1080} \times \text{targetWidthRatio}$$
- Voice Engine Integration: The
voiceProviderparameter acceptsazure,google, orelevenlabs. Pair this with a corresponding voice identifier from the platform's voice catalog (such asen-US-AriaNeural). - Speech Duration Constraints: Standard avatars enforce a 60-second limit per slide. Avatars marked with
"limit": 300support extended speech up to 5 minutes per slide. Exceeding these thresholds results in asynchronous render errors.
Complete Production Payload Example
{
"name": "Personalized Welcome - Customer #10842",
"tags": ["automated-onboarding", "tier-enterprise"],
"data": {
"format": "16_9",
"resolution": "FullHD",
"subtitlesEnabled": "burn",
"musicUrl": "https://elai-media.s3.eu-west-2.amazonaws.com/music/mixkit-driving-ambition-32.mp3",
"musicVolume": 0.15
},
"slides": [
{
"id": 1,
"status": "edited",
"language": "English",
"speech": "Welcome aboard, Sarah! We have configured your cloud workspace with enterprise SSO and high-throughput API clusters.",
"voiceType": "text",
"voiceProvider": "azure",
"voice": "en-US-AriaNeural",
"animation": "fade_in",
"avatar": {
"code": "gia.casual",
"gender": "female",
"name": "Gia Casual",
"canvas": "https://elai-avatars.s3.us-east-2.amazonaws.com/common/gia/casual/gia_casual.png"
},
"canvas": {
"version": "4.4.0",
"background": "#0f172a",
"objects": [
{
"id": 101,
"type": "avatar",
"avatarType": "transparent",
"src": "https://elai-avatars.s3.us-east-2.amazonaws.com/common/gia/casual/gia_casual.png",
"left": 120.0,
"top": 40.0,
"scaleX": 0.32,
"scaleY": 0.32,
"width": 1080,
"height": 1080,
"animation": { "type": null, "exitType": null }
},
{
"id": 102,
"type": "textbox",
"text": "Welcome Sarah | Acme Corp",
"fontSize": 24,
"fontFamily": "Inter",
"fill": "#38bdf8",
"left": 400.0,
"top": 120.0,
"width": 500
}
]
}
}
]
}
Once posted to POST /api/v1/videos, Elai returns the draft video object with an assigned _id. To initiate compilation, execute:
curl -X POST "https://apis.elai.io/api/v1/videos/render/420c6769343dc7bb51513e63" \
-H "Authorization: Bearer <API_TOKEN>" \
-H "Accept: application/json"
Configuring Webhooks and Cryptographic Verification
Because video compilation takes between 45 seconds and several minutes depending on duration, synchronous polling degrades server performance and exhausts network sockets. Webhooks provide real-time notification when rendering finishes or fails.
1. Subscription Protocol & The Secret Order Trap
You can register your webhook listener programmatically:
curl -X POST "https://apis.elai.io/api/v1/webhook/" \
-H "Authorization: Bearer <API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.yourdomain.com/v1/webhooks/elai",
"techEmail": "devops-alerts@yourdomain.com",
"enabled": true
}'
[!CAUTION] The Secret Order Trap: Elai.io only stores a signing secret if an active webhook is already enabled. If you call
POST /api/v1/webhook/secretbeforePOST /api/v1/webhook/, or while the webhook is disabled, the secret is silently dropped. The endpoint still returns HTTP 200, but outgoing deliveries will arrive completely unsigned. Always subscribe first, set the secret second, and verify the configuration withGET /apiConfig.
Set the signing secret immediately after subscription:
curl -X POST "https://apis.elai.io/api/v1/webhook/secret" \
-H "Authorization: Bearer <API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{ "secret": "your-cryptographically-secure-random-secret" }'
2. Event Types and Webhook Payload
Elai.io emits exactly two webhook events:
video_ready: Emitted when rendering succeeds. Thevideo.urlproperty contains the public MP4 download link.video_error: Emitted when asset validation, avatar length check, or rendering fails. Theerrorfield contains descriptive failure details.- Note: If a video is flagged for content review (
moderation), no webhook event is emitted. The video transitions tostatus: "moderation", which can only be detected by queryingGET /videos/{videoId}.
{
"event": "video_ready",
"error": null,
"requestId": "FKdFTb5MciFRG1QD",
"batchRowId": 0,
"video": {
"_id": "627e1c5ef461482766f35f4a",
"name": "Personalized Welcome - Customer #10842",
"status": "ready",
"duration": 14.8,
"thumbnail": "https://elai-media.s3.eu-west-2.amazonaws.com/videos/.../thumbnail.jpg",
"url": "https://elai-media.s3.eu-west-2.amazonaws.com/videos/.../video.mp4",
"createdAt": "2026-11-05T06:00:00.000Z",
"updatedAt": "2026-11-05T06:02:15.000Z"
}
}
3. The Single-Attempt Zero-Retry Rule
This is the most critical operational constraint in Elai.io's developer documentation:
- Elai delivers webhooks exactly once with a 10-second timeout.
- There is no built-in exponential backoff, retry queue, or dead-letter mechanism.
- If your endpoint takes longer than 10 seconds to respond, is down, or returns HTTP 500, that event is permanently lost.
- Automatic Disabling: After 10 consecutive delivery failures across your workspace, Elai.io automatically disables the webhook and sends an alert to
techEmail.
Production Webhook Implementation (Node.js & Express)
To prevent lost events and timing attacks, the receiver must capture raw request bytes, verify HMAC-SHA256 signatures in constant time, enforce timestamp freshness, and acknowledge with HTTP 200 immediately before dispatching tasks to an internal message queue.
import crypto from 'node:crypto';
import express from 'express';
const app = express();
const WEBHOOK_SECRET = process.env.ELAI_WEBHOOK_SECRET;
const MAX_DRIFT_MS = 5 * 60 * 1000; // 5-minute replay tolerance
// Capture exact raw bytes prior to JSON parsing
app.use(
express.json({
verify: (req, _res, buf) => {
req.rawBody = buf.toString('utf8');
},
})
);
function verifyElaiSignature(req) {
const timestamp = req.headers['elai-timestamp'];
const signature = req.headers['elai-signature'];
if (!timestamp || !signature || !req.rawBody) return false;
// Protect against replay attacks
const eventTime = parseInt(timestamp, 10);
if (Math.abs(Date.now() - eventTime) > MAX_DRIFT_MS) return false;
const expectedSignature = crypto
.createHmac('sha256', WEBHOOK_SECRET)
.update(`${timestamp}.${req.rawBody}`)
.digest('hex');
// Constant-time comparison prevents timing analysis
if (signature.length !== expectedSignature.length) return false;
return crypto.timingSafeEqual(
Buffer.from(signature, 'hex'),
Buffer.from(expectedSignature, 'hex')
);
}
app.post('/api/v1/webhooks/elai', async (req, res) => {
if (!verifyElaiSignature(req)) {
return res.status(401).json({ error: 'Invalid HMAC signature or expired timestamp' });
}
// Acknowledge within 50ms to satisfy the strict 10s single-attempt window
res.status(200).json({ received: true });
const { event, error, video, requestId, batchRowId } = req.body;
try {
if (event === 'video_ready') {
// Offload to worker queue (BullMQ, Celery, or AWS SQS)
await messageQueue.add('process_video_ready', {
videoId: video._id,
downloadUrl: video.url,
duration: video.duration,
requestId,
batchRowId,
});
} else if (event === 'video_error') {
await messageQueue.add('process_video_error', {
videoId: video?._id,
errorMessage: error,
requestId,
});
}
} catch (queueErr) {
console.error('Failed to enqueue webhook task:', queueErr);
}
});
Quotas, Rate Limits, and High-Throughput Engineering
When generating thousands of personalized videos, enterprise systems encounter two distinct types of HTTP 429 errors. Handling them identically will cause pipeline stalls.
1. Differentiating the Two Flavors of HTTP 429
- Flavor 1: Rate Limiting ("Too Many Requests"):
Triggered when exceeding per-minute or per-hour thresholds on specific endpoints.
- Response payload:
{"message": "Too many requests per minute, please try again later.", "retryAfter": 42} - Response headers:
Retry-After,X-RateLimit-Limit-Min,X-RateLimit-Remaining-Min,X-RateLimit-Reset-Min. - Remedy: Pause outbound workers for the exact number of seconds specified in
Retry-After.
- Response payload:
- Flavor 2: Entity Creation Quota ("Window Ceiling Reached"):
Triggered when reaching the rolling 8-hour video creation limit.
- Response payload:
{"message": "You have reached the limit of 1000 videos per last 8 hours, please try again later"} - Remedy: Immediate exponential retries are futile. Outbound video creation must pause until the rolling 8-hour window elapses, or the workspace must be upgraded.
- Response payload:
| Plan Tier | Rolling 8-Hour Video Creation Limit | Upload Media Cap | Max Slides per Video |
|---|---|---|---|
| Free | 50 videos | 200 assets | 3 slides rendered |
| Creator | 1,000 videos | 1,000 assets | 100 slides |
| Team | 1,000 videos | 1,000 assets | 100 slides |
| Enterprise | 6,000 videos | 1,000 assets | 100 slides |
2. The Hybrid Reconciliation Strategy
Because Elai.io webhooks do not retry dropped packets, resilient production architectures must not rely on callbacks alone. 365Finds strongly advises implementing a Hybrid Push-Pull Reconciler:
- Primary Push Path: Webhooks process 99% of completed videos instantly.
- Safety Net Polling Cron: A scheduled cron worker queries
GET /api/v1/videos?status=renderingevery 5 to 10 minutes. Any video that has been inrenderingstatus for longer than 20 minutes is actively checked viaGET /api/v1/videos/{videoId}. If the video is markedreadyorerror, the system triggers the downstream worker and resolves the internal database record.
365Finds Institutional Verdict & Recommendations
Automating personalized video rendering via Elai.io provides substantial efficiency gains over manual studio production, but developer teams must architect around the platform's distributed constraints:
- Default to Template Personalization: Unless your application requires entirely unpredictable multi-scene canvas logic, use
POST /videos/renderTemplate/{videoId}. Passing arrays of up to 200 recipients per batch drastically reduces API overhead and insulates backend code from layout redesigns. - Never Execute Business Logic in Webhook Handlers: Respond with HTTP 200 inside 50ms and push payloads to a background worker queue. A slow database query or synchronous S3 download inside the webhook handler will trigger a 10-second timeout, risking lost events and automatic webhook shutdown.
- Always Subscribe Before Setting Secrets: Remember the webhook secret ordering trap. Test your webhook pipeline by verifying that incoming requests include both
Elai-TimestampandElai-Signatureheaders. - Deploy the Push-Pull Safety Net: Due to Elai's single-attempt webhook delivery model, pairing your webhook listener with a lightweight polling cron is mandatory for zero-loss enterprise workflows.