---
agentTools:
  projectIndex: https://elai.readme.io/llms.txt
---

# Render/create a personalized batch

Request to render or create a batch of videos (one or more) from a template.

At most **200** rows per request (`templateData`); beyond that the call is rejected with a `400`. Every generated video also carries the tag `api`, whether or not you send tags — which is the simplest way to find API-created videos later.

> ❗️ This endpoint accepts work, it does not complete it
>
> A `200` means the render was **queued**. Validation runs after the response is sent, so no render
> failure can reach you as an HTTP status. Failures arrive as a **`video_error`** webhook, or as
> `status: "error"` on `GET /videos/{videoId}` if you poll.
>
> Messages you may receive that way:
>
> | Message | Cause |
> | :--- | :--- |
> | `Slide N is too long. Please limit speech to Xs.` | Speech exceeds the global per-slide limit |
> | `Slide N is too long for this avatar. Please limit speech to Xs.` | Speech exceeds this avatar's own limit, which is lower |
> | `Slide N uses a premium avatar that is no longer available...` | The slide's premium avatar is not available to your plan |
> | `You do not have enough minutes to render this video...` | No minutes left, and the workspace is not allowed to overrun |
> | `Your video has N slides but your plan allows only 3 slides to render.` | Free plans render at most 3 slides |
> | `Video with music should be minimum 2 seconds long` | Background music on a video shorter than 2s |
>
> If you cannot afford to miss a `video_error` — deliveries are single-attempt, with no retry —
> reconcile with `GET /videos` instead of relying on the callback alone.

[block:callout]
{
  "type": "info",
  "title": "How to create personalized videos",
  "body": "Check how to use this API call to create personalized videos [here](https://elai.readme.io/reference/personalization)."
}
[/block]

If **templateData** contains only **single** item, then the identifier of the newly created video will be returned immediately in response, and webhook "video\_ready" will be triggered too.

[block:code]
{
  "codes": [
    {
      "code": "{\n  \"accepted\": true, \n  \"requestId\": \"FKdFTb5MciFRG1QD\",\n  \"videoId\": \"63ea63c1c00dfe1a72cc7426\"\n}",
      "language": "json",
      "name": "response for single video"
    }
  ]
}
[/block]

Otherwise, we will trigger a related webhook for each rendered video with related **requestId** and **batchRowId**, so you can map each *videoId* when it's ready to the data row in your request.
For example:

[block:code]
{
  "codes": [
    {
      "code": "{\n  \"event\": \"video_ready\",\n  \"requestId\": \"FKdFTb5MciFRG1QD\",\n  \"batchRowId\": \"0 - index of video in related batch request\",\n  \"video\": {\n    \"_id\": \"63ea63c1c00dfe1a72cc7426\",\n    \"other\": \"fields\"\n  }\n}",
      "language": "json",
      "name": "webhook body"
    }
  ]
}
[/block]

# OpenAPI definition

````json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Elai Public API",
    "version": "1.0",
    "description": "Every endpoint below is served under `https://apis.elai.io/api/v1`.\n\n## Authentication\n\nSend your workspace API token as a bearer token on every request:\n\n```\nAuthorization: Bearer <your-api-token>\n```\n\nGenerate and rotate the token in the Elai web app under **Settings → API**, or through\n`POST /generateToken`. The token is scoped to one **workspace** and authenticates as that\nworkspace's admin user — it is not tied to an individual person, and it carries admin rights\ninside that workspace.\n\nA request with a missing, unknown or revoked token gets a bare `401` with no response body.\n\n> **Organizations on the Unlimited plan cannot use the API.** Their requests are rejected with the\n> same bare `401` as an invalid token, with nothing to distinguish the two. If a valid, freshly\n> generated token returns `401` on every endpoint, check the plan first.\n\n## Errors\n\nFailures carry a JSON body of the shape `{ \"message\": \"...\" }`. Validation failures on the newer\nendpoints may add an `errors` array naming the offending fields. `401` is the exception: it has no\nbody at all.\n\nBoth render endpoints are **fire-and-forget** — they queue work and return immediately, so a\n`200` means \"accepted\", not \"rendered\". Render failures surface only through the `video_error`\nwebhook, never as an HTTP error on the call that started the render.\n\n## Scope\n\nThis reference is generated from the running code rather than maintained by hand, so it cannot\nquietly fall behind the API it describes. It documents 96 operations across the\n`/api/v1` surface.\n\nEndpoints are grouped by subject in the sidebar. If something you need is missing, or an endpoint\ndoes not behave as described here, tell us.\n\n---\n\n_Generated from `chore/web-4760/api-v1-reference-build` at `5289745d` on 2026-09-04._"
  },
  "servers": [
    {
      "url": "https://apis.elai.io/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-bearer-format": "bearer",
        "x-default": "SECRET_KEY"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/videos/renderTemplate/{videoId}": {
      "post": {
        "summary": "Render/create a personalized batch",
        "description": "Request to render or create a batch of videos (one or more) from a template.\n\nAt most **200** rows per request (`templateData`); beyond that the call is rejected with a `400`. Every generated video also carries the tag `api`, whether or not you send tags — which is the simplest way to find API-created videos later.\n\n> ❗️ This endpoint accepts work, it does not complete it\n>\n> A `200` means the render was **queued**. Validation runs after the response is sent, so no render\n> failure can reach you as an HTTP status. Failures arrive as a **`video_error`** webhook, or as\n> `status: \"error\"` on `GET /videos/{videoId}` if you poll.\n>\n> Messages you may receive that way:\n>\n> | Message | Cause |\n> | :--- | :--- |\n> | `Slide N is too long. Please limit speech to Xs.` | Speech exceeds the global per-slide limit |\n> | `Slide N is too long for this avatar. Please limit speech to Xs.` | Speech exceeds this avatar's own limit, which is lower |\n> | `Slide N uses a premium avatar that is no longer available...` | The slide's premium avatar is not available to your plan |\n> | `You do not have enough minutes to render this video...` | No minutes left, and the workspace is not allowed to overrun |\n> | `Your video has N slides but your plan allows only 3 slides to render.` | Free plans render at most 3 slides |\n> | `Video with music should be minimum 2 seconds long` | Background music on a video shorter than 2s |\n>\n> If you cannot afford to miss a `video_error` — deliveries are single-attempt, with no retry —\n> reconcile with `GET /videos` instead of relying on the callback alone.",
        "operationId": "render-personalized",
        "parameters": [
          {
            "name": "videoId",
            "in": "path",
            "description": "ID of a video, that you want to use as a source (should include tags). You can find ID in your video URL when you open it in our app.",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "templateData"
                ],
                "properties": {
                  "templateData": {
                    "type": "array",
                    "description": "An array of key-value objects, where each key represents tag in your template or API id of media that needs to be replaced. Value should have a real value that your final video should have. For each object you will have one video generated.",
                    "items": {
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "For ex. name of your customer",
                          "default": "Emma"
                        },
                        "product": {
                          "type": "string",
                          "default": "PlayStation 5"
                        },
                        "457597335176": {
                          "type": "string",
                          "description": "Public URL of an image/video that will replace one in your template. Cannot be null or undefined.",
                          "default": "https://elai-media.s3.eu-west-2.amazonaws.com/production/uploads/618118806e2d6946046eff7a/888_1663770268002.png"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "tags": {
                    "type": "array",
                    "description": "You can add any custom tags to videos that will be generated by this request, so you can easier find them in the dashboard or in webhooks.",
                    "items": {
                      "type": "string"
                    }
                  },
                  "emailNotification": {
                    "type": "boolean",
                    "description": "By default for each video rendered or errored account admin will receive notification, but you can disable it by setting this param to false",
                    "default": true
                  },
                  "fitTextBox": {
                    "type": "boolean",
                    "description": "If true, Elai will fit text into it's text box. The whole text block with tag will be replaced. More info here: https://elai.readme.io/reference/templates#replace-whole-text-block-on-canvas",
                    "default": false
                  },
                  "public": {
                    "type": "boolean",
                    "description": "If true Elai will make all created videos public (they will be available for sharing using https://app.elai.io/v/:videoId link).",
                    "default": false
                  },
                  "render": {
                    "type": "boolean",
                    "description": "By default we start rendering videos right after its creation, but you can turn it off for test purpose or other reason: videos will be just created but not rendered right away.",
                    "default": true
                  },
                  "requestId": {
                    "type": "string",
                    "description": "Your own custom identifier to mark current batch request for further processing (or it will be generated automatically)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The batch was accepted. `videoId` is present only when `templateData` held a single row. This is not a completion signal — see the note above.",
            "content": {
              "application/json": {
                "examples": {
                  "Multiple videos": {
                    "value": {
                      "accepted": true,
                      "requestId": "FKdFTb5MciFRG1QD"
                    }
                  },
                  "Single video": {
                    "value": {
                      "accepted": true,
                      "requestId": "FKdFTb5MciFRG1QD",
                      "videoId": "63ea63c1c00dfe1a72cc7426"
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "boolean",
                      "example": true,
                      "description": "Always true. The batch was queued, not completed."
                    },
                    "requestId": {
                      "type": "string",
                      "example": "FKdFTb5MciFRG1QD",
                      "description": "Correlates this batch with the `requestId` on each `video_ready` / `video_error` webhook."
                    },
                    "videoId": {
                      "type": "string",
                      "example": "63ea63c1c00dfe1a72cc7426",
                      "description": "Present **only** when `templateData` held exactly one row. Absent for a multi-row batch — use the webhooks or `GET /videos` to find those."
                    }
                  },
                  "required": [
                    "accepted",
                    "requestId"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request or the template is not usable. Every message below is a real rejection from this route.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Template data is required (array)"
                    }
                  }
                },
                "examples": {
                  "templateData missing": {
                    "value": {
                      "message": "Template data is required (array)"
                    }
                  },
                  "templateData row empty": {
                    "value": {
                      "message": "Template data should not be empty"
                    }
                  },
                  "no placeholder tags": {
                    "value": {
                      "message": "Video should have at least one tag (brackets placeholder)"
                    }
                  },
                  "unsupported tag symbols": {
                    "value": {
                      "message": "One or more tags have unsupported symbols. Please use only english letters, numbers, underscores, dashes and spaces."
                    }
                  },
                  "batch too large": {
                    "value": {
                      "message": "Too many videos in one batch request, maximum is 200"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The video belongs to another workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Video is assigned to another account"
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "message": "Video is assigned to another account"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "The video does not exist, or the id is not a valid ObjectId.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Video not found"
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "message": "Video not found"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The workspace has hit its **video creation limit** — a rolling 8-hour window, not a rate limit. The ceiling depends on the plan: 50 on Free, 1000 on Creator and Team, 6000 on Enterprise (`services/security.js:80-88`). The message names the limit and the window, which is how you tell a quota 429 from a rate-limit 429.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "You have reached the limit of 1000 videos per last 8 hours, please try again later"
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "message": "You have reached the limit of 1000 videos per last 8 hours, please try again later"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "tags": [
          "Rendering"
        ]
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "tags": [
    {
      "name": "Rendering",
      "description": "Turn a video into an MP4. Both render endpoints are fire-and-forget: a `200` means the job was queued, and failures arrive through the `video_error` webhook."
    }
  ],
  "_id": {
    "buffer": {
      "0": 106,
      "1": 154,
      "2": 229,
      "3": 101,
      "4": 201,
      "5": 178,
      "6": 243,
      "7": 252,
      "8": 223,
      "9": 58,
      "10": 69,
      "11": 151
    }
  }
}
````