Documentation
Back
  • Getting Started
    • Create Your First Ad
    • Teams, Brands, and Navigation
    • Generation Basics
  • Brands
    • Create a Brand
    • Work in a Brand
    • Manage Brand Settings
    • Brand Guidelines and Website Data
    • Connect Publishing Accounts
    • Manage Brand Members
  • Create Ads
    • Playground vs Launchpad
    • Create Video Ads
    • Create Static Ads
    • Create UGC Ads and Personas
    • Create Rich Media Ads
    • Create Carousel Ads
    • Create Product Ads
  • Tools
    • Image Studio
    • Remove Background
    • Generate Vector
    • Adapt Ad
    • Video Generator
    • Edit Video
  • Campaigns & Personalization
    • Data Sheets
    • Personalize a Static Ad
    • Review and Approve a Set
    • Work with a Creative Set
    • Export a Set
    • AI Values per Row
    • Generate a Template from a Data Sheet
    • Personalized Rich Media Sets
    • Fit Long Values in Their Box
    • Sets in Campaigns and Assistants
  • Media & Delivery
  • Team & Account
    • Compliance Settings
  • Help & Troubleshooting
  • Developers & Automation
    • API
    • MCP
      • MCP setup
    • Render Videos from a Template

Render Videos from a Template

Publish a video as an API template, then send your own data to get a finished MP4 for each row. Any field you leave out keeps the template's default.

Publish a video once, then render it from your own system with your own data. Each call sends one row, or a batch of rows, and gets back a finished MP4 per row. A field you leave out keeps the value the template was published with, so you only send what changes: a new price, another product image, a different voiceover line.

Availability: template renders are rolling out to teams gradually. If you do not see Publish for API in the video editor's Data panel, your team does not have them yet. Contact support to ask for access.

Before you start

  • A team workspace. Personal accounts cannot publish or render templates.
  • A video whose layers are bound to a data sheet in the editor's Data panel. See Data sheets.
  • An API key from Settings → API Keys. See the API overview.

1. Publish the video for the API

Publishing needs the permission to manage the team's settings, the same one that creates API keys.

  1. Open the video in the editor and open the Data panel.
  2. Choose Publish for API.
  3. Fill in the dialog:
    • Template name: what API callers see in their template list.
    • Default row: the row of the sheet whose values a call keeps for every field it leaves out.
    • Credit ceiling: the most one call may cost. A call may lower it, never raise it.
  4. Choose Publish. The video's clips, images and sounds are copied, which can take a few minutes.

When it finishes, the dialog shows Live: version 1, the Template id, the template's Fields, and an example request you can copy.

Things to know:

  • A published version is frozen. Later edits to the video, its mapping or its sheet change nothing for API callers until you choose Publish new version.
  • Fields are the sheet's column names, and only the columns the video's layers are bound to. Other columns of the sheet are never published.
  • A template has one size: the video's own.
  • The default row is checked when you publish. Publishing is refused if that row cannot render or would cost more than the ceiling, render fee included. If the default row makes AI values or reads image or video URLs, the dialog lists them as notes.
  • Calls always render the live version. Publishing a new version changes what the next call renders; a render already running keeps its version.
  • Retire stops API calls to the template until you publish again. Deleting the video or its data sheet has the same effect.

2. Read the template's fields

List the team's templates, then read one to see its fields and their defaults:

curl "https://app.adgreetz.com/api/v1/templates" \
  --header "Authorization: Bearer $ADGREETZ_API_KEY"
curl "https://app.adgreetz.com/api/v1/templates/TEMPLATE_ID" \
  --header "Authorization: Bearer $ADGREETZ_API_KEY"

Each entry in fields has a key (the name a row uses), a label, a type, a max_length and its default value. The response also gives the template's sizes, its default_max_credits, max_rows_per_render and render_credits_per_output (what each rendered video costs).

3. Send your data

Send one row in data. Every request needs an Idempotency-Key, so a retry with the same key within 24 hours never renders twice.

curl --request POST "https://app.adgreetz.com/api/v1/templates/TEMPLATE_ID/renders" \
  --header "Authorization: Bearer $ADGREETZ_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: order-1042-v2" \
  --data '{
    "data": { "product_2_price": "$4.99", "product_2_image": "https://example.com/p2.jpg" },
    "webhook_url": "https://hooks.example.com/renders"
  }'
  • Leave a field out to keep its default.
  • Send "" to empty a field on purpose.
  • A field the template does not have refuses the whole request and names the field.
  • Values are text. A link to an image or a video goes in as its URL.

To render several rows in one request, send rows (up to 10) instead of data:

{
  "rows": [
    { "headline": "Hi Boise", "city": "Boise" },
    { "headline": "Hi Austin", "city": "Austin" }
  ]
}

A batch is one render: one id, one callback, and one credit ceiling for all its rows together. A row that cannot be rendered, for example a value too long for its text box, stops the whole batch and nothing is charged for it.

A retry with the same Idempotency-Key within 24 hours answers the first render, whatever the new body says: even if you changed the data, you get the first render back. After 24 hours the key is forgotten and the same key starts a new render. Use a new key for each new render.

A max_credits lower than the render fee of the videos you asked for (10 credits per video) is refused right away with HTTP 400 and details.min_credits, the least it would take.

The response is accepted with HTTP 202 and a generation id:

{
  "ok": true,
  "data": {
    "generation": { "type": "template_render", "id": "GENERATION_ID" },
    "template": { "id": "TEMPLATE_ID", "version": 1 },
    "status": "queued",
    "max_credits": 300,
    "rows": 1,
    "poll_after_seconds": 60
  }
}

4. Get the videos

Poll the status until it is completed, partial or failed, or wait for the callback and keep polling as a backstop:

curl "https://app.adgreetz.com/api/v1/generations/template_render/GENERATION_ID" \
  --header "Authorization: Bearer $ADGREETZ_API_KEY"

Then read the result:

curl "https://app.adgreetz.com/api/v1/generations/template_render/GENERATION_ID/result" \
  --header "Authorization: Bearer $ADGREETZ_API_KEY"

outputs has one entry per row, each with its row_index and a video_url. The links last one hour; read the result again for fresh ones. The result also gives usage (the credits quoted and charged for the whole render) when it is available; it can be missing, so do not rely on it being there.

If you sent a webhook_url, one callback is sent when the render ends, with the same status and result. Add a webhook_secret to have it signed. A callback your endpoint does not accept is retried for about two minutes, so do not rely on it alone.

To stop a render, call POST /api/v1/generations/template_render/GENERATION_ID/cancel. Videos that finished before the cancel are still charged and still returned.

Credits

  • Each video that renders costs 10 credits. A video that fails or is cancelled before it renders is not charged.
  • A render also costs what its AI values cost: generated voice lines, images and copy. A value already made for the brand is reused at no cost.
  • The render is approved automatically when its cost is at or under the credit ceiling. Above it, the render fails with CREDIT_CEILING_EXCEEDED and nothing is charged.
  • The ceiling covers a whole batch, not each row. For large batches, publish the template with a higher ceiling or send smaller batches.

Limits

LimitValue
Rows per requestUp to 10 (fewer for a template with a large default row; see max_rows_per_render)
Renders in progress per team10
Renders compiling at once per team2
Characters per value5,000
Output link lifetime1 hour, renewed each time you read the result

Too many renders in progress or compiling (details.reason: too_many_renders or too_many_compiles), or too many requests for your key, answers HTTP 429 with details.retry_after_seconds: retry after that delay. Too many rows or a value over 5,000 characters is refused with HTTP 400 VALIDATION_ERROR (a batch too large for its template gives details.max_rows_for_template): fix the request rather than retrying it.

When a render fails

A problem found before the render starts is answered in the response itself. A problem found afterwards shows as failed with an error_code on the status and in the callback:

error_codeWhat it means
CREDIT_CEILING_EXCEEDEDThe render would cost more than its ceiling
ROWS_BLOCKEDA row cannot be rendered; the result lists each reason
INSUFFICIENT_CREDITSThe team does not have enough credits
CANCELLEDThe render was cancelled
RENDER_FAILEDThe render ran and failed

Next

  • Every field, error and limit: the interactive reference
  • API overview
  • Data sheets
  • MCP for agents: the same steps are the tools list_templates, get_template and create_template_render