Make an ad from your backend with the AI video generation API

Send a brief to Wavemaker's AI video generation API and the hosted agent makes the ad and returns checked files. Scopes, quotes and recovery.

ResourcesEngineering

Illustration of a server rack connected by one cable to a film editing desk
On this page
  1. Sessions or the twelve tools
  2. Connect with a workspace key and the read, run and write scopes
  3. Price the brief before anything runs
  4. Start a session and post the ad brief
  5. Follow events, answer approvals and collect deliveries
  6. Recover from dropped connections and restarts
  7. Limits

Wavemaker's AI video generation API is for developers and agent builders who want finished ads without driving every model call. With the session API (/v1/sessions), your backend posts a brief with attachments and typed deliverables, and the hosted agent picks the models and steps. Each finished file comes back in the turn's outcome.deliveries[], checked against the destination you named.

Sessions or the twelve tools

Developers have two ways in. The session API hands a brief to the hosted Wavemaker agent, and the agent decides the method: which image, video, voice and music models to run, in what order, and how to cut the result. The twelve tools (search, read, write, generate, edit, compose, watch, listen, compare, review, deliver, run) let your own code or agent do the work step by step over HTTP or MCP.

The API and MCP capability map sets out the split. To hand over a brief and get finished ads back, use /v1/sessions. For one model, one edit or your own timeline, call POST /v1/tools/{tool}. Both reach the same workspace and the same hosted agent, with the same validation, scopes, policies and result envelope. A backend can start with sessions and later call a single tool for one step without changing how it authenticates or reads results.

This guide covers sessions. Image, video, speech and music aren't separate endpoints per model: they're routes, model profiles and graphs behind the tools, and the agent picks them for you.

Connect with a workspace key and the read, run and write scopes

The production API is at https://api.wavemaker.io. A backend sends a workspace key in the header as Authorization: Bearer {key}. The workspace keys guide covers creating and managing keys. To connect an outside agent instead (Claude, ChatGPT, Cursor or Grok), use the MCP endpoint https://api.wavemaker.io/mcp with OAuth and PKCE. The MCP setup page has the steps for each client.

Ask for read run write. Per the capability map, the scopes cover these session calls:

  • run starts a session and posts turns, sends follow-ups and revisions, accepts or declines approvals, interrupts a running turn, closes a session and claims one after a restart.
  • read follows a session's events, reads a turn's outcome and deliveries, and lists sessions.
  • write covers the write and deliver tools, which you'll need if your code also cancels jobs or records deliveries itself.

Pricing a brief with POST /v1/quotes works with any scope.

Price the brief before anything runs

Pricing an ad brief is free. POST /v1/quotes prices a brief without opening a session. Inside a session, posting a turn to POST /v1/sessions/{id}/turns with quote_only: true prices that turn instead of running it. A quote places no hold and starts nothing. Amounts come back in microcredits: 1 credit is 1,000,000 microcredits, so divide before you show a number to a person. The quote and run guide has the field names.

There's no per-ad credit figure here, because the cost depends on what the agent makes for that brief. You pay for the media it makes (images, video, voice, music, the final render) plus the assistant's own model use, and the history shows them as separate lines. Quote the actual brief you plan to send.

When a turn runs for real, the credits help page describes four stages: credits are reserved before a step starts, the step runs, Wavemaker charges what the step used, and the unused part of the hold returns to the balance. A long step can reserve more in small amounts while it runs. Work that doesn't run returns its whole reservation, and failed GPU jobs are charged nothing.

Each workspace has its own wallet, and credits never move between workspaces. A key spends the balance of its own workspace, so a staging key and a production key in different workspaces draw from different balances. To check the balance from code, read the wm://credits resource with the read scope.

Start a session and post the ad brief

Open a session with POST /v1/sessions and post the brief as a turn with POST /v1/sessions/{id}/turns. Follow-ups and revisions are new turns on the same session, so the agent keeps the context of earlier work.

A turn can carry these kinds of attachment:

  • logo
  • photo
  • brand file
  • reference
  • source ad
  • audio
  • font

The turn's deliverables are typed: video, image, audio or display_set. Each one names a destination, and Wavemaker checks the finished file against that destination's spec. Video destinations include youtube/skippable-instream, youtube/bumper, youtube/shorts, tiktok/in-feed, facebook/feed, facebook/stories, facebook/reels, instagram/reels, ctv/standard and web/mobile-video.

For HTML5 banners, a display_set with formats: ["html5"] and destination: "google/display-html5" asks for ZIPs you can upload to Google Ads. The agent checks each banner against Google's rules: index.html at the top with an ad.size meta tag, at most 40 local files, a ZIP of at most 600,000 bytes, a supported display size, no clickTag, and animation that stops within 30 seconds. Use google/ad-manager for a banner that declares its own clickTag, and web/banner for one that links to your own page.

Video in a session runs on Wavemaker's self-hosted video model by default. Partner video (Veo 3.1, Kling 3.0, Runway, Luma, Seedance and others) runs when the brief names it, or as a fallback when the self-hosted model failed for a shot. In that case the agent says which shots moved and why.

There's no request body here. Copy the documented example from the Make an ad guide unchanged, then swap in your brief, attachments and destinations.

Follow events, answer approvals and collect deliveries

After the turn is posted, your backend follows it, answers anything the agent asks, and reads the files when they're done.

  1. Follow progress with GET /v1/sessions/{id}/events (scope read). Events arrive as the agent plans, makes shots and renders.
  2. When the agent asks for a decision, accept or decline it with POST /v1/sessions/{id}/approvals/{approval_id} (scope run).
  3. To change direction mid-session, post another turn to POST /v1/sessions/{id}/turns describing the revision.
  4. When the turn finishes, read its outcome with GET /v1/sessions/{id}/requests/{request_id}. Each finished file is in outcome.deliveries[].
  5. Check each delivery's measurements before you hand it on: duration, dimensions, loudness (LUFS) and true peak, measured against the destination.
  6. For an HTML5 display_set, expect three files per banner: the ZIP, a backup image and a preview MP4. Wavemaker plays each ZIP in a sandboxed browser with no network before returning it.
  7. Close the session with POST /v1/sessions/{id}/close when you're done with it.

GET /v1/sessions lists your sessions if your backend needs to rebuild its own state.

Recover from dropped connections and restarts

Every write that can start work takes a request_id, so retries are safe. If the connection drops while you're posting a turn, send the same request again with the same id. Wavemaker returns the original result and doesn't charge twice. Never generate a new id for the same work: a new id is new work, and new work is charged again. The same goes for people. Sending the brief again to check on progress starts a second piece of work.

Long-running work returns a job. Read wm://job/{id} with wait_s set to at most 25 seconds. A wait that times out means the job is still running, not that it failed, so read again. To cancel a job, use write with {"uri": "wm://job/{id}", "cancel": true}. Cancelling a job that hadn't started releases its hold at once. A cancelled running job pays for the execution that ran.

To stop a running turn in a session, call POST /v1/sessions/{id}/interrupt. If your backend restarts while a session is still open, take it back with POST /v1/sessions/{id}/claim and takeover: true, then follow its events again. The errors reference lists the error codes and which ones are safe to retry.

Limits

Generation doesn't publish anything or launch a campaign. A delivery means the file was checked against the destination's spec and recorded. Uploading it to Google Ads, YouTube or TikTok is still up to you.

deliver refuses a draft. A draft render is about 540 px on the short side, so only a final can be delivered.

A request for HTML5 can't be met with PNGs. Delivery refuses a file whose type isn't one of the formats you asked for.

The wavemaker CLI and the Python, TypeScript and Go SDKs aren't publicly released yet, so this guide uses the HTTP API only. Starter app templates aren't published either.

Start with the documented request in the Make an ad guide, price it with quote_only: true, then run it.